Browse Source

set initial tab

master
daivph 5 years ago
parent
commit
fa368cd783
2 changed files with 8 additions and 4 deletions
  1. +4
    -2
      lib/presentation/screens/plot/sc_plot.dart
  2. +4
    -2
      lib/presentation/screens/plot_detail/sc_plot_detail.dart

+ 4
- 2
lib/presentation/screens/plot/sc_plot.dart View File

Navigator.push( Navigator.push(
context, context,
MaterialPageRoute( MaterialPageRoute(
builder: (BuildContext context) =>
PlotDetailScreen(cropId: item.id)));
builder: (BuildContext context) => PlotDetailScreen(
cropId: item.id,
initialIndex: 1,
)));
}); });
} }
} }

+ 4
- 2
lib/presentation/screens/plot_detail/sc_plot_detail.dart View File



class PlotDetailScreen extends StatefulWidget { class PlotDetailScreen extends StatefulWidget {
final int cropId; final int cropId;
PlotDetailScreen({@required this.cropId});
int initialIndex;
PlotDetailScreen({@required this.cropId, this.initialIndex = 0});
@override @override
_PlotDetailScreenState createState() => _PlotDetailScreenState(); _PlotDetailScreenState createState() => _PlotDetailScreenState();
} }
], ],
), ),
body: DefaultTabController( body: DefaultTabController(
initialIndex: widget.initialIndex,
length: 2, length: 2,
child: new Scaffold( child: new Scaffold(
backgroundColor: COLOR_CONST.ITEM_BG, backgroundColor: COLOR_CONST.ITEM_BG,
bottomNavigationBar: new TabBar( bottomNavigationBar: new TabBar(
tabs: [ tabs: [
Tab( Tab(
text: "Chỉ số",
text: ''' Chỉ số ''',
), ),
Tab( Tab(
text: "Canh tác", text: "Canh tác",

Loading…
Cancel
Save