✨ Better overflow effect
This commit is contained in:
		| @@ -21,7 +21,7 @@ class _DraftBoxScreenState extends State<DraftBoxScreen> { | ||||
|   final PagingController<int, Post> _pagingController = | ||||
|       PagingController(firstPageKey: 0); | ||||
|  | ||||
|   getPosts(int pageKey) async { | ||||
|   _getPosts(int pageKey) async { | ||||
|     final PostProvider provider = Get.find(); | ||||
|  | ||||
|     Response resp; | ||||
| @@ -49,7 +49,7 @@ class _DraftBoxScreenState extends State<DraftBoxScreen> { | ||||
|   @override | ||||
|   void initState() { | ||||
|     super.initState(); | ||||
|     _pagingController.addPageRequestListener(getPosts); | ||||
|     _pagingController.addPageRequestListener(_getPosts); | ||||
|   } | ||||
|  | ||||
|   @override | ||||
| @@ -76,6 +76,7 @@ class _DraftBoxScreenState extends State<DraftBoxScreen> { | ||||
|               itemBuilder: (context, item, index) { | ||||
|                 return PostOwnedListEntry( | ||||
|                   item: item, | ||||
|                   isFullContent: true, | ||||
|                   backgroundColor: | ||||
|                       Theme.of(context).colorScheme.surfaceContainerLow, | ||||
|                   onTap: () async { | ||||
|   | ||||
| @@ -273,14 +273,49 @@ class _PostItemState extends State<PostItem> { | ||||
|         crossAxisAlignment: CrossAxisAlignment.start, | ||||
|         children: [ | ||||
|           _buildHeader().paddingSymmetric(horizontal: 12), | ||||
|           MarkdownTextContent( | ||||
|             content: item.body['content'], | ||||
|             isSelectable: widget.isContentSelectable, | ||||
|           ).paddingOnly( | ||||
|             left: 16, | ||||
|             right: 12, | ||||
|             top: 2, | ||||
|             bottom: hasAttachment ? 4 : 0, | ||||
|           Stack( | ||||
|             children: [ | ||||
|               SizedContainer( | ||||
|                 maxWidth: 640, | ||||
|                 maxHeight: widget.isFullContent ? double.infinity : 80, | ||||
|                 child: _MeasureSize( | ||||
|                   onChange: (size) { | ||||
|                     setState(() => _contentHeight = size.height); | ||||
|                   }, | ||||
|                   child: MarkdownTextContent( | ||||
|                     content: item.body['content'], | ||||
|                     isSelectable: widget.isContentSelectable, | ||||
|                   ).paddingOnly( | ||||
|                     left: 16, | ||||
|                     right: 12, | ||||
|                     top: 2, | ||||
|                     bottom: hasAttachment ? 4 : 0, | ||||
|                   ), | ||||
|                 ), | ||||
|               ), | ||||
|               if (_contentHeight >= 80 && !widget.isFullContent) | ||||
|                 Align( | ||||
|                   alignment: Alignment.bottomCenter, | ||||
|                   child: IgnorePointer( | ||||
|                     child: Container( | ||||
|                       height: 80, | ||||
|                       decoration: BoxDecoration( | ||||
|                         gradient: LinearGradient( | ||||
|                           begin: Alignment.bottomCenter, | ||||
|                           end: Alignment.topCenter, | ||||
|                           colors: [ | ||||
|                             Theme.of(context).colorScheme.surfaceContainerLow, | ||||
|                             Theme.of(context) | ||||
|                                 .colorScheme | ||||
|                                 .surface | ||||
|                                 .withOpacity(0), | ||||
|                           ], | ||||
|                         ), | ||||
|                       ), | ||||
|                     ), | ||||
|                   ), | ||||
|                 ), | ||||
|             ], | ||||
|           ), | ||||
|           _buildFooter().paddingOnly(left: 16), | ||||
|           if (attachments.isNotEmpty) | ||||
| @@ -330,33 +365,46 @@ class _PostItemState extends State<PostItem> { | ||||
|                   crossAxisAlignment: CrossAxisAlignment.start, | ||||
|                   children: [ | ||||
|                     _buildHeader(), | ||||
|                     SizedContainer( | ||||
|                       maxWidth: 640, | ||||
|                       maxHeight: widget.isFullContent ? double.infinity : 320, | ||||
|                       child: _MeasureSize( | ||||
|                         onChange: (size) { | ||||
|                           _contentHeight = size.height; | ||||
|                         }, | ||||
|                         child: MarkdownTextContent( | ||||
|                           content: item.body['content'], | ||||
|                           isSelectable: widget.isContentSelectable, | ||||
|                         ).paddingOnly(left: 12, right: 8), | ||||
|                       ), | ||||
|                     ), | ||||
|                     if (_contentHeight >= 320 && | ||||
|                         widget.isClickable && | ||||
|                         !widget.isFullContent) | ||||
|                       InkWell( | ||||
|                         child: Text( | ||||
|                           'readMore'.tr, | ||||
|                           style: TextStyle( | ||||
|                             color: Theme.of(context).colorScheme.primary, | ||||
|                     Stack( | ||||
|                       children: [ | ||||
|                         SizedContainer( | ||||
|                           maxWidth: 640, | ||||
|                           maxHeight: | ||||
|                               widget.isFullContent ? double.infinity : 320, | ||||
|                           child: _MeasureSize( | ||||
|                             onChange: (size) { | ||||
|                               setState(() => _contentHeight = size.height); | ||||
|                             }, | ||||
|                             child: MarkdownTextContent( | ||||
|                               content: item.body['content'], | ||||
|                               isSelectable: widget.isContentSelectable, | ||||
|                             ).paddingOnly(left: 12, right: 8), | ||||
|                           ), | ||||
|                         ), | ||||
|                         onTap: () { | ||||
|                           openContainer(); | ||||
|                         }, | ||||
|                       ).paddingOnly(left: 12, top: 4), | ||||
|                         if (_contentHeight >= 320 && !widget.isFullContent) | ||||
|                           Align( | ||||
|                             alignment: Alignment.bottomCenter, | ||||
|                             child: IgnorePointer( | ||||
|                               child: Container( | ||||
|                                 height: 320, | ||||
|                                 decoration: BoxDecoration( | ||||
|                                   gradient: LinearGradient( | ||||
|                                     begin: Alignment.bottomCenter, | ||||
|                                     end: Alignment.topCenter, | ||||
|                                     colors: [ | ||||
|                                       Theme.of(context).colorScheme.surface, | ||||
|                                       Theme.of(context) | ||||
|                                           .colorScheme | ||||
|                                           .surface | ||||
|                                           .withOpacity(0), | ||||
|                                     ], | ||||
|                                   ), | ||||
|                                 ), | ||||
|                               ), | ||||
|                             ), | ||||
|                           ), | ||||
|                       ], | ||||
|                     ), | ||||
|                     if (widget.item.replyTo != null && widget.isShowEmbed) | ||||
|                       _buildReply(context).paddingOnly(top: 4), | ||||
|                     if (widget.item.repostTo != null && widget.isShowEmbed) | ||||
|   | ||||
| @@ -6,12 +6,14 @@ import 'package:solian/widgets/posts/post_item.dart'; | ||||
| class PostOwnedListEntry extends StatelessWidget { | ||||
|   final Post item; | ||||
|   final Function onTap; | ||||
|   final bool isFullContent; | ||||
|   final Color? backgroundColor; | ||||
|  | ||||
|   const PostOwnedListEntry({ | ||||
|     super.key, | ||||
|     required this.item, | ||||
|     required this.onTap, | ||||
|     this.isFullContent = false, | ||||
|     this.backgroundColor, | ||||
|   }); | ||||
|  | ||||
| @@ -29,6 +31,7 @@ class PostOwnedListEntry extends StatelessWidget { | ||||
|               isClickable: false, | ||||
|               isShowReply: false, | ||||
|               isReactable: false, | ||||
|               isFullContent: isFullContent, | ||||
|               backgroundColor: backgroundColor, | ||||
|             ).paddingSymmetric(vertical: 8), | ||||
|           ], | ||||
|   | ||||
		Reference in New Issue
	
	Block a user