Skip to content

Commit

Permalink
Merge pull request #25 from avuenja/bugfix/slowCommentList
Browse files Browse the repository at this point in the history
Bug fix em lentidão de comentários da lista
  • Loading branch information
avuenja authored Nov 26, 2022
2 parents 70fbe1a + d5fee34 commit c7916d8
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 31 deletions.
68 changes: 38 additions & 30 deletions lib/src/ui/pages/content.dart
Original file line number Diff line number Diff line change
Expand Up @@ -55,41 +55,49 @@ class _ContentPageState extends State<ContentPage> {
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,
),
],
),
),
Expand Down
1 change: 0 additions & 1 deletion lib/src/ui/widgets/comments.dart
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ class _CommentsRootWidgetState extends State<CommentsRootWidget> {
timeago.setLocaleMessages('pt-BR', timeago.PtBrMessages());

return ListView.separated(
shrinkWrap: true,
controller: widget.controller,
itemCount: comments.length,
separatorBuilder: (context, index) => const Divider(),
Expand Down

0 comments on commit c7916d8

Please sign in to comment.