I am using pluto_layout (GitHub) in my FlutterApp for Windows. But I don't understand how to update the contents of the tabs.
The usual way I do it is using setState. But no changes can be seen. On the GitHub Page is a usage example. Below I am using that and I implement a simple counter in the left tab. When I replace the left tab
left: PlutoLayoutContainer(
child: PlutoLayoutTabs(
items: [
PlutoLayoutTabItem(
id: 'left1',
title: 'left1',
tabViewBuilder: (e) => const Text('left1'),
),
],
),
),
with
left: PlutoLayoutContainer(
child: PlutoLayoutTabs(
items: [
PlutoLayoutTabItem(
id: 'left1',
title: 'left1',
tabViewWidget: Column(
children: [
Text('number of times clicked: ${counter}'),
TextButton(
onPressed: () {
setState(() {
counter++;
print(counter);
});
},
child: Text(
'click',
),
),
],
),
),
],
),
),
the visuals won't update.
Any ideas on how to update the tabs would be appreciated. Thanks!
Ok when I put the counter in a new Widget it works fine. For example in a widget like this:
class Count extends StatefulWidget {
const Count({super.key});
@override
State<Count> createState() => _CountState();
}
class _CountState extends State<Count> {
@override
Widget build(BuildContext context) {
return Column(
children: [
Text('${counter}'),
TextButton(onPressed: () {
setState(() {
counter++;
print(counter);
});
}, child: Text('click'),)
],
);
}
}
And in the above example I replace the Column in tabViewWidget with the Count Widget.