|
|
|
@@ -47,69 +47,63 @@ class _PlotActionScreenState extends State<PlotActionScreen> { |
|
|
|
} |
|
|
|
|
|
|
|
_initActionButtons() { |
|
|
|
actions.add(ActionType( |
|
|
|
plot_action_nursery, |
|
|
|
null, |
|
|
|
EditActionNurseryScreen( |
|
|
|
cropId: widget.cropId, |
|
|
|
))); |
|
|
|
actions.add(ActionType( |
|
|
|
plot_action_plant, |
|
|
|
null, |
|
|
|
EditActionPlantScreen( |
|
|
|
cropId: widget.cropId, |
|
|
|
))); |
|
|
|
//TODO: Check is nursery |
|
|
|
if (1 == 1) { |
|
|
|
actions.add(ActionType( |
|
|
|
plot_action_nursery, |
|
|
|
EditActionNurseryScreen( |
|
|
|
cropId: widget.cropId, |
|
|
|
))); |
|
|
|
} else { |
|
|
|
actions.add(ActionType( |
|
|
|
plot_action_plant, |
|
|
|
EditActionPlantScreen( |
|
|
|
cropId: widget.cropId, |
|
|
|
))); |
|
|
|
} |
|
|
|
|
|
|
|
actions.add(ActionType( |
|
|
|
plot_action_crop_status, |
|
|
|
null, |
|
|
|
EditActionCropStatusScreen( |
|
|
|
cropId: widget.cropId, |
|
|
|
))); |
|
|
|
actions.add(ActionType( |
|
|
|
plot_action_environment_update, |
|
|
|
null, |
|
|
|
EditActionEnvironmentUpdate( |
|
|
|
cropId: widget.cropId, |
|
|
|
))); |
|
|
|
actions.add(ActionType( |
|
|
|
plot_action_dung, |
|
|
|
null, |
|
|
|
EditActionDungScreen( |
|
|
|
cropId: widget.cropId, |
|
|
|
))); |
|
|
|
actions.add(ActionType( |
|
|
|
plot_action_spraying, |
|
|
|
null, |
|
|
|
EditActionSprayingScreen( |
|
|
|
cropId: widget.cropId, |
|
|
|
))); |
|
|
|
actions.add(ActionType( |
|
|
|
plot_action_disease, |
|
|
|
null, |
|
|
|
EditActionDiseaseScreen( |
|
|
|
cropId: widget.cropId, |
|
|
|
))); |
|
|
|
actions.add(ActionType( |
|
|
|
plot_action_use_water, |
|
|
|
null, |
|
|
|
EditActionUseWaterScreen( |
|
|
|
cropId: widget.cropId, |
|
|
|
))); |
|
|
|
actions.add(ActionType( |
|
|
|
plot_action_other, |
|
|
|
null, |
|
|
|
EditActionOtherScreen( |
|
|
|
cropId: widget.cropId, |
|
|
|
))); |
|
|
|
actions.add(ActionType( |
|
|
|
plot_action_harvest, |
|
|
|
null, |
|
|
|
EditActionHarvestScreen( |
|
|
|
cropId: widget.cropId, |
|
|
|
))); |
|
|
|
actions.add(ActionType( |
|
|
|
plot_action_finish, |
|
|
|
null, |
|
|
|
EditActionEndScreen( |
|
|
|
cropId: widget.cropId, |
|
|
|
))); |
|
|
|
@@ -134,61 +128,34 @@ class _PlotActionScreenState extends State<PlotActionScreen> { |
|
|
|
}); |
|
|
|
}, |
|
|
|
child: Container( |
|
|
|
height: 75, |
|
|
|
margin: EdgeInsets.all(4.0), |
|
|
|
padding: EdgeInsets.all(0.0), |
|
|
|
margin: EdgeInsets.all(2.5), |
|
|
|
decoration: BoxDecoration( |
|
|
|
color: COLOR_CONST.WHITE, |
|
|
|
borderRadius: BorderRadius.only( |
|
|
|
topLeft: Radius.circular(8.0), |
|
|
|
bottomLeft: Radius.circular(8.0), |
|
|
|
bottomRight: Radius.circular(8.0), |
|
|
|
topRight: Radius.circular(8.0)), |
|
|
|
borderRadius: BorderRadius.all(Radius.circular(4.0)), |
|
|
|
boxShadow: <BoxShadow>[ |
|
|
|
BoxShadow( |
|
|
|
color: COLOR_CONST.GRAY1.withOpacity(0.2), |
|
|
|
offset: Offset(1.1, 1.1), |
|
|
|
blurRadius: 10.0), |
|
|
|
], |
|
|
|
), |
|
|
|
child: Stack( |
|
|
|
children: <Widget>[ |
|
|
|
Positioned( |
|
|
|
top: -10, |
|
|
|
right: -3, |
|
|
|
child: (actionType.addScreen == null) |
|
|
|
? Container() |
|
|
|
: IconButton( |
|
|
|
icon: Icon( |
|
|
|
Icons.add_circle, |
|
|
|
size: 40, |
|
|
|
color: Colors.green, |
|
|
|
), |
|
|
|
onPressed: () { |
|
|
|
Navigator.of(context).push(MaterialPageRoute( |
|
|
|
builder: (context) => actionType.addScreen)); |
|
|
|
})), |
|
|
|
Positioned.fill( |
|
|
|
child: Align( |
|
|
|
alignment: Alignment.center, |
|
|
|
child: Text( |
|
|
|
actionType.actionName, |
|
|
|
textAlign: TextAlign.center, |
|
|
|
style: TextStyle( |
|
|
|
fontWeight: FontWeight.w400, |
|
|
|
fontSize: 13, |
|
|
|
color: COLOR_CONST.BLACK2, |
|
|
|
), |
|
|
|
)), |
|
|
|
), |
|
|
|
blurRadius: 4.0), |
|
|
|
], |
|
|
|
), |
|
|
|
child: Align( |
|
|
|
alignment: Alignment.center, |
|
|
|
child: Text( |
|
|
|
actionType.actionName, |
|
|
|
textAlign: TextAlign.center, |
|
|
|
style: TextStyle( |
|
|
|
fontWeight: FontWeight.w400, |
|
|
|
fontSize: 11, |
|
|
|
color: COLOR_CONST.BLACK2, |
|
|
|
), |
|
|
|
)), |
|
|
|
)), |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
bool _showTitle(BuildContext context) { |
|
|
|
var kExpandedHeight = MediaQuery.of(context).size.width * 1.125 + 32; |
|
|
|
var kExpandedHeight = MediaQuery.of(context).size.width * 0.625 + 24; |
|
|
|
return _scrollController.hasClients && |
|
|
|
_scrollController.offset > kExpandedHeight - kToolbarHeight; |
|
|
|
} |
|
|
|
@@ -205,8 +172,8 @@ class _PlotActionScreenState extends State<PlotActionScreen> { |
|
|
|
leading: Container(), |
|
|
|
title: null, |
|
|
|
// title: _showTitle(context) ? Text(plot_detail_title) : null, |
|
|
|
//Height flexibleSpace : WidthScreen /2 * 6/16 * 6(row) + 8(space) *4 |
|
|
|
expandedHeight: MediaQuery.of(context).size.width * 1.125 + 32, |
|
|
|
//Height flexibleSpace : WidthScreen /2 * 4/16 * 5(row) + 8(space) *3 |
|
|
|
expandedHeight: MediaQuery.of(context).size.width * 0.625 + 24, |
|
|
|
flexibleSpace: _showTitle(context) |
|
|
|
? null |
|
|
|
: BlocProvider<PlotDetailBloc>( |
|
|
|
@@ -218,7 +185,7 @@ class _PlotActionScreenState extends State<PlotActionScreen> { |
|
|
|
title: GridView.count( |
|
|
|
shrinkWrap: true, |
|
|
|
crossAxisCount: 2, |
|
|
|
childAspectRatio: 16 / 6, |
|
|
|
childAspectRatio: 16 / 4, |
|
|
|
children: actions.map( |
|
|
|
(item) { |
|
|
|
return _createActionButtons(item, contextB); |
|
|
|
@@ -496,12 +463,10 @@ class ItemInfinityWidget extends StatelessWidget { |
|
|
|
} |
|
|
|
|
|
|
|
class ActionType { |
|
|
|
Widget addScreen; |
|
|
|
Widget listScreen; |
|
|
|
String actionName; |
|
|
|
ActionType(String actionName, Widget addScreen, Widget listScreen) { |
|
|
|
ActionType(String actionName, Widget listScreen) { |
|
|
|
this.actionName = actionName; |
|
|
|
this.addScreen = addScreen; |
|
|
|
this.listScreen = listScreen; |
|
|
|
} |
|
|
|
} |