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

@@ -153,8 +153,10 @@ class ItemInfinityWidget extends StatelessWidget {
Navigator.push(
context,
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

@@ -9,7 +9,8 @@ import 'package:get/get.dart';

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

Loading…
Cancel
Save