diff --git a/.vscode/cspell.json b/.vscode/cspell.json index 16fea5b3..3eb2a07c 100644 --- a/.vscode/cspell.json +++ b/.vscode/cspell.json @@ -200,7 +200,8 @@ "giffy", "giphy", "ccon", - "nodoc" + "nodoc", + "ChildLayouter" ], "ignorePaths": [ ".github/workflows/**", diff --git a/lib/chats/chat/widgets/message/chat_message_factory.dart b/lib/chats/chat/widgets/message/chat_message_factory.dart index da950895..eef164cb 100644 --- a/lib/chats/chat/widgets/message/chat_message_factory.dart +++ b/lib/chats/chat/widgets/message/chat_message_factory.dart @@ -12,15 +12,13 @@ class ChatMessageFactory { Widget createChatNotificationFromText({ required BuildContext context, - required RichableText text, + required CustomRichText text, }) { return _Notification( - // TODOwrap to DefaultTextStyle for custom emoji text: text.toInlineSpan(context), ); } - // TODOmove to another class for message parts Widget createChatNotificationBubble({required InlineSpan span}) => _Notification(text: span); @@ -35,7 +33,6 @@ class ChatMessageFactory { child: Container( padding: const EdgeInsets.only(top: 3, bottom: 3, left: 6, right: 6), decoration: BoxDecoration( - // TODOextract color to styles color: Colors.black.withAlpha(60), borderRadius: const BorderRadius.all(Radius.circular(16)), ), diff --git a/lib/chats/chat/widgets/message/message_caption.dart b/lib/chats/chat/widgets/message/message_caption.dart index 1455521f..e67d9ab6 100644 --- a/lib/chats/chat/widgets/message/message_caption.dart +++ b/lib/chats/chat/widgets/message/message_caption.dart @@ -11,7 +11,7 @@ class MessageCaption extends StatelessWidget { this.padding, }); - final s.RichableText text; + final s.CustomRichText text; final Widget shortInfo; final EdgeInsets? padding; diff --git a/lib/chats/chat/widgets/message/message_content.dart b/lib/chats/chat/widgets/message/message_content.dart index 812c68aa..1bb95208 100644 --- a/lib/chats/chat/widgets/message/message_content.dart +++ b/lib/chats/chat/widgets/message/message_content.dart @@ -30,12 +30,8 @@ class _ContentRenderBox extends RenderBox final constraints = this.constraints; final width = _computeWidth( constraints: constraints, - // TODOreplace by dryLayoutChild, need implement computeDryLayout - // in MessageSkeleton layoutChild: ChildLayoutHelper.layoutChild, ); - // TODOconstraints.minHeight, - // maybe using calculated height from _computeWidth? size = Size(width, constraints.minHeight); _layout(constraints.copyWith(maxWidth: width)); } diff --git a/lib/chats/chat/widgets/message/message_text.dart b/lib/chats/chat/widgets/message/message_text.dart index cf50c118..ea85c310 100644 --- a/lib/chats/chat/widgets/message/message_text.dart +++ b/lib/chats/chat/widgets/message/message_text.dart @@ -7,13 +7,12 @@ import 'package:shared/shared.dart' as s; class MessageText extends StatelessWidget { const MessageText({required this.text, required this.shortInfo, super.key}); - final s.RichableText text; + final s.CustomRichText text; final Widget shortInfo; @override Widget build(BuildContext context) { return MessageWrap( - // TODOwrap to DefaultTextStyle for custom emoji wrapGravity: WrapGravity.top, content: Text.rich(text.toInlineSpan(context)), shortInfo: Padding( @@ -24,11 +23,10 @@ class MessageText extends StatelessWidget { } } -extension RichTextExt on s.RichableText { +extension RichTextExt on s.CustomRichText { InlineSpan toInlineSpan(BuildContext context) { return TextSpan( children: entities.map((s.Entity e) { - // TODOsupport multiple types return e.types.first.map( planeText: (_) { return TextSpan(text: e.text); diff --git a/lib/chats/chat/widgets/message_wrap_showcase_page.dart b/lib/chats/chat/widgets/message_wrap_showcase_page.dart index 3fba7d8f..af3da8b5 100644 --- a/lib/chats/chat/widgets/message_wrap_showcase_page.dart +++ b/lib/chats/chat/widgets/message_wrap_showcase_page.dart @@ -85,7 +85,7 @@ class MessageAnimation extends StatelessWidget { right: chatContextData.horizontalPadding, top: chatContextData.verticalPadding, ), - text: RichableText.planeText( + text: CustomRichText.planeText( 'Hi fa fe fa fa f', ), shortInfo: shortInfoFactory.create( diff --git a/lib/feed/post/widgets/post_popup.dart b/lib/feed/post/widgets/post_popup.dart index 9f2f0e60..ac76099a 100644 --- a/lib/feed/post/widgets/post_popup.dart +++ b/lib/feed/post/widgets/post_popup.dart @@ -178,7 +178,7 @@ class _PostPopupState extends State valueListenable: _isLiked, child: RepaintBoundary( key: ValueKey( - '${widget.block.id}${widget.block.createdAt}repaintBoundry', + '${widget.block.id}${widget.block.createdAt}-repaintBoundary', ), child: widget.builder.call(context), ), diff --git a/packages/shared/lib/src/models/rich_text.dart b/packages/shared/lib/src/models/rich_text.dart index d5b45db8..a5564778 100644 --- a/packages/shared/lib/src/models/rich_text.dart +++ b/packages/shared/lib/src/models/rich_text.dart @@ -3,13 +3,13 @@ import 'package:shared/src/models/entity.dart'; import 'package:shared/src/models/type.dart' as t; -class RichableText { - const RichableText({ +class CustomRichText { + const CustomRichText({ required this.entities, }); - factory RichableText.planeText(String text) { - return RichableText( + factory CustomRichText.planeText(String text) { + return CustomRichText( entities: [ Entity(text: text, types: [const t.Type.planeText()]), ],