@@ -27,7 +27,8 @@ class TabsControl extends StatefulWidget {
2727}
2828
2929class _TabsControlState extends State <TabsControl >
30- with SingleTickerProviderStateMixin {
30+ with TickerProviderStateMixin {
31+ int _tabsCount = 0 ;
3132 List <String > _tabsIndex = [];
3233 String ? _value;
3334 TabController ? _tabController;
@@ -36,7 +37,8 @@ class _TabsControlState extends State<TabsControl>
3637 void initState () {
3738 super .initState ();
3839 _tabsIndex = widget.children.map ((c) => c.attrString ("key" , "" )! ).toList ();
39- _tabController = TabController (length: widget.children.length, vsync: this );
40+ _tabsCount = widget.children.length;
41+ _tabController = TabController (length: _tabsCount, vsync: this );
4042 _tabController! .addListener (() {
4143 if (_tabController! .indexIsChanging == true ) {
4244 return ;
@@ -53,6 +55,11 @@ class _TabsControlState extends State<TabsControl>
5355 Widget build (BuildContext context) {
5456 debugPrint ("TabsControl build: ${widget .control .id }" );
5557
58+ if (widget.children.length != _tabsCount) {
59+ _tabsCount = widget.children.length;
60+ _tabController = TabController (length: _tabsCount, vsync: this );
61+ }
62+
5663 bool disabled = widget.control.isDisabled || widget.parentDisabled;
5764
5865 String ? value = widget.control.attrString ("value" );
0 commit comments