From baf0d88602a6de90b9e224c09ee127ccfb17753a Mon Sep 17 00:00:00 2001 From: Pedro Bueno Date: Fri, 25 Nov 2022 19:24:31 -0300 Subject: [PATCH] removendo swrinkWrap e trocando scroller por slive --- lib/src/ui/pages/content.dart | 68 ++++++++++++++++++-------------- lib/src/ui/widgets/comments.dart | 1 - 2 files changed, 38 insertions(+), 31 deletions(-) diff --git a/lib/src/ui/pages/content.dart b/lib/src/ui/pages/content.dart index 34cee45..1b68a55 100644 --- a/lib/src/ui/pages/content.dart +++ b/lib/src/ui/pages/content.dart @@ -55,41 +55,49 @@ class _ContentPageState extends State { onRefresh: _getContent, body: isLoading ? const AppProgressIndicator() - : SingleChildScrollView( - controller: _controller, + : Padding( padding: const EdgeInsets.all(10.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.stretch, - children: [ - Text( - '${content.ownerUsername} · ${timeago.format(DateTime.parse(content.publishedAt!), locale: "pt-BR")}', - style: const TextStyle().copyWith( - color: context.isDarkMode - ? Colors.grey.shade400 - : Colors.grey.shade700, + child: CustomScrollView( + controller: _controller, + slivers: [ + SliverToBoxAdapter( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + '${content.ownerUsername} · ${timeago.format(DateTime.parse(content.publishedAt!), locale: "pt-BR")}', + style: const TextStyle().copyWith( + color: context.isDarkMode + ? Colors.grey.shade400 + : Colors.grey.shade700, + ), + ), + const SizedBox(height: 10.0), + Text( + content.parentId != null + ? 'Em resposta a...' + : '${content.title}', + style: const TextStyle().copyWith( + fontSize: 18.0, + fontWeight: FontWeight.w700, + ), + ), + MarkedownReader( + body: '${content.body}', + controller: _controller, + ), + const SizedBox(height: 30.0), + const Divider(), + const SizedBox(height: 30.0), + ], ), ), - const SizedBox(height: 10.0), - Text( - content.parentId != null - ? 'Em resposta a...' - : '${content.title}', - style: const TextStyle().copyWith( - fontSize: 18.0, - fontWeight: FontWeight.w700, + SliverFillRemaining( + child: CommentsRootWidget( + slug: '${widget.username}/${widget.slug}', + controller: _controller, ), ), - MarkedownReader( - body: '${content.body}', - controller: _controller, - ), - const SizedBox(height: 30.0), - const Divider(), - const SizedBox(height: 30.0), - CommentsRootWidget( - slug: '${widget.username}/${widget.slug}', - controller: _controller, - ), ], ), ), diff --git a/lib/src/ui/widgets/comments.dart b/lib/src/ui/widgets/comments.dart index 870ddc3..a3b1de1 100644 --- a/lib/src/ui/widgets/comments.dart +++ b/lib/src/ui/widgets/comments.dart @@ -43,7 +43,6 @@ class _CommentsRootWidgetState extends State { timeago.setLocaleMessages('pt-BR', timeago.PtBrMessages()); return ListView.separated( - shrinkWrap: true, controller: widget.controller, itemCount: comments.length, separatorBuilder: (context, index) => const Divider(),