1

I have a list and go to that list there will be 4 tabbars widget. When I move to another tabbar and return to the original tab, my last scroll position changed.

How do I make the scroll position in 'tab 1' for example then when going to 'tab 2' the position of 'tab 1' remains like its last position?

following the code snippet on the home tab:

class HomeTabDetail extends StatefulWidget {
  final Fixture fixture;
  final FixtureModel model;


  HomeTabDetail({this.fixture, this.model});

  @override
  _HomeTabDetailState createState() => _HomeTabDetailState();
}

class _HomeTabDetailState extends State<HomeTabDetail> {

 @override
   void initState() {
     // TODO: implement initState
     super.initState();
    loadData();  
   }

     Future loadData() async {
    await Future.wait([
      widget.model.fetchVenue(widget.fixture.venueId.toString()),
      widget.model.fetchCountry(widget.fixture.league.countryId.toString())

    ]); 
  }

  @override
  Widget build(BuildContext context) {
    return DefaultTabController(
      length: 4,
      child: Scaffold(
        appBar: AppBar(
          title: Text('Info Pertandingan'),
          bottom: TabBar(
            tabs: <Widget>[
              Tab(text: 'RINCIAN'),
              Tab(text: 'MEDIA'),
              Tab(text: 'LINEUP'),
              Tab(text: 'KLASEMEN'),
            ],
          ),
        ),
        body: ScopedModelDescendant<FixtureModel>(builder: 
        (context, child, model){
          return TabBarView(
          children: <Widget>[
            DetailMatchTab(widget.fixture),
            MediaMatchTab(),
            LineupMatchTab(),
            KlasemenMatchTab()
          ],
        );
        })


      ),
    );
  }
}
Kitereative Indonesia
  • 1,097
  • 6
  • 19
  • 39

0 Answers0