Skip to content

Commit

Permalink
fix(screens): Fix ThreadPage thread title covered on the top
Browse files Browse the repository at this point in the history
  • Loading branch information
realth000 committed Nov 28, 2023
1 parent da4316c commit 4bc6519
Showing 1 changed file with 41 additions and 38 deletions.
79 changes: 41 additions & 38 deletions lib/screens/thread/thread_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -67,48 +67,51 @@ class _ThreadPageState extends ConsumerState<ThreadPage> {
// 2. `title`: Title found in html document.
// 3. `context.t.appName`: Default application name.
// appBar: AppBar(title: Text(widget.title ?? title ?? '')),
body: Column(
children: [
Expanded(
child: PostList<Post>(
widget.threadID,
widget._fetchUrl,
title: widget.title ?? title ?? '',
listBuilder: (document) {
final threadDataNode = document.querySelector('div#postlist');
if (threadDataNode == null) {
debug('thread postlist not found');
return <Post>[];
}
body: SafeArea(
child: Column(
children: [
Expanded(
child: PostList<Post>(
widget.threadID,
widget._fetchUrl,
title: widget.title ?? title ?? '',
listBuilder: (document) {
final threadDataNode =
document.querySelector('div#postlist');
if (threadDataNode == null) {
debug('thread postlist not found');
return <Post>[];
}

// Sometimes we do not know the web page title outside this widget,
// so here should use the title in html document as fallback.
//
// Note that the specified title (in widget constructor) is prior to
// this html document title, only use html title when that title is null.
if (widget.title == null && mounted) {
setState(() {
title = document.querySelector('title')?.text;
});
}
// Sometimes we do not know the web page title outside this widget,
// so here should use the title in html document as fallback.
//
// Note that the specified title (in widget constructor) is prior to
// this html document title, only use html title when that title is null.
if (widget.title == null && mounted) {
setState(() {
title = document.querySelector('title')?.text;
});
}

return Post.buildListFromThreadDataNode(threadDataNode);
},
widgetBuilder: (context, post) => PostCard(
post,
replyCallback: replyPostCallback,
return Post.buildListFromThreadDataNode(threadDataNode);
},
widgetBuilder: (context, post) => PostCard(
post,
replyCallback: replyPostCallback,
),
canFetchMorePages: true,
replyFormHashCallback: (replyParameters) {
_replyBarController.replyParameters = replyParameters;
},
useDivider: true,
),
canFetchMorePages: true,
replyFormHashCallback: (replyParameters) {
_replyBarController.replyParameters = replyParameters;
},
useDivider: true,
),
),
ReplyBar(
controller: _replyBarController,
),
],
ReplyBar(
controller: _replyBarController,
),
],
),
),
);
}

0 comments on commit 4bc6519

Please sign in to comment.