mirror of
https://gitlab.com/mysocialportal/relatica
synced 2024-10-18 15:53:32 +00:00
Add show/hide comments toggle
This commit is contained in:
parent
6a05db91e0
commit
9031ab98f5
1 changed files with 14 additions and 3 deletions
|
@ -40,6 +40,8 @@ class _StatusControlState extends State<StatusControl> {
|
|||
|
||||
var showContent = true;
|
||||
|
||||
var showComments = false;
|
||||
|
||||
EntryTreeItem get item => widget.originalItem;
|
||||
|
||||
TimelineEntry get entry => item.entry;
|
||||
|
@ -101,10 +103,19 @@ class _StatusControlState extends State<StatusControl> {
|
|||
),
|
||||
if (isPost && hasComments)
|
||||
TextButton(
|
||||
onPressed: () async => await manager.refreshStatusChain(item.id),
|
||||
child: Text('Load Comments'),
|
||||
onPressed: () async {
|
||||
setState(() {
|
||||
showComments = !showComments;
|
||||
});
|
||||
if (showComments) {
|
||||
await manager.refreshStatusChain(item.id);
|
||||
}
|
||||
},
|
||||
child:
|
||||
Text(showComments ? 'Hide Comments' : 'Load & Show Comments'),
|
||||
),
|
||||
if (item.totalChildren > 0) buildChildComments(context),
|
||||
if (item.totalChildren > 0 && showComments)
|
||||
buildChildComments(context),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
|
Loading…
Reference in a new issue