|
|
|
@@ -100,169 +100,162 @@ class _PlotInformationScreenState extends State<PlotInformationScreen> |
|
|
|
|
|
|
|
@override |
|
|
|
Widget build(BuildContext context) => KeyboardDismisser( |
|
|
|
gestures: [ |
|
|
|
GestureType.onTap, |
|
|
|
GestureType.onPanUpdateDownDirection, |
|
|
|
], |
|
|
|
child: Container( |
|
|
|
color: AppColors.ITEM_BG, |
|
|
|
child: SafeArea( |
|
|
|
top: false, |
|
|
|
bottom: true, |
|
|
|
child: Scaffold( |
|
|
|
appBar: widget.isShowAppbar |
|
|
|
? AppBarWidget() |
|
|
|
: PreferredSize( |
|
|
|
preferredSize: Size(0, 0), |
|
|
|
child: SizedBox(), |
|
|
|
), |
|
|
|
key: _scaffoldKey, |
|
|
|
body: KeyboardDismisser( |
|
|
|
child: StreamBuilder( |
|
|
|
stream: getPlotInfoBloc.actions, |
|
|
|
builder: (BuildContext context, |
|
|
|
AsyncSnapshot<dynamic> snapshot) { |
|
|
|
if (snapshot.hasData) { |
|
|
|
return Form( |
|
|
|
key: _formKey, |
|
|
|
autovalidate: _autoValidate, |
|
|
|
child: SingleChildScrollView( |
|
|
|
padding: EdgeInsets.all(8.0), |
|
|
|
child: Column( |
|
|
|
children: <Widget>[ |
|
|
|
WidgetRowPlotInfo( |
|
|
|
color: AppColors.DEFAULT |
|
|
|
.withOpacity(0.1), |
|
|
|
name: 'Mã lô', |
|
|
|
value: |
|
|
|
'${cropPlot.tbCropDTO.code}'), |
|
|
|
WidgetRowPlotInfo( |
|
|
|
color: AppColors.DEFAULT |
|
|
|
.withOpacity(0.3), |
|
|
|
name: 'Trạng thái', |
|
|
|
value: '$statusCrop'), |
|
|
|
WidgetRowPlotInfo( |
|
|
|
color: AppColors.DEFAULT |
|
|
|
.withOpacity(0.1), |
|
|
|
name: 'Nhà màng', |
|
|
|
value: |
|
|
|
'${cropPlot.tbCropDTO.netHouseName ?? '--'}'), |
|
|
|
WidgetRowPlotInfo( |
|
|
|
color: AppColors.DEFAULT |
|
|
|
.withOpacity(0.3), |
|
|
|
name: 'Giống', |
|
|
|
value: |
|
|
|
'${cropPlot.tbCropDTO.suppliesName ?? '--'}'), |
|
|
|
WidgetRowPlotInfo( |
|
|
|
color: AppColors.DEFAULT |
|
|
|
.withOpacity(0.1), |
|
|
|
name: 'Ngày gieo trồng', |
|
|
|
value: |
|
|
|
'${cropPlot.sowingDate.format_DDMMYY_HHmm() ?? '--'}'), |
|
|
|
WidgetRowPlotInfo( |
|
|
|
color: AppColors.DEFAULT |
|
|
|
.withOpacity(0.3), |
|
|
|
name: 'Thời gian ngâm hạt', |
|
|
|
value: |
|
|
|
'${cropPlot.soakSeedsTime ?? '--'}'), |
|
|
|
WidgetRowPlotInfo( |
|
|
|
color: AppColors.DEFAULT |
|
|
|
.withOpacity(0.1), |
|
|
|
name: 'Ngày vô khây ươm', |
|
|
|
value: |
|
|
|
'${cropPlot.seedIncubationTime ?? '--'}'), |
|
|
|
WidgetRowPlotInfo( |
|
|
|
color: AppColors.DEFAULT |
|
|
|
.withOpacity(0.3), |
|
|
|
name: 'Số lượng cây trồng', |
|
|
|
value: |
|
|
|
'${cropPlot.numberPlants ?? '--'}'), |
|
|
|
WidgetRowPlotInfo( |
|
|
|
color: AppColors.DEFAULT |
|
|
|
.withOpacity(0.1), |
|
|
|
name: 'Số lượng cây hiện tại', |
|
|
|
value: |
|
|
|
'${cropPlot.numberCurrentPlants ?? '--'}'), |
|
|
|
WidgetRowPlotInfo( |
|
|
|
color: AppColors.DEFAULT |
|
|
|
.withOpacity(0.3), |
|
|
|
name: 'Ngày kết thúc canh tác', |
|
|
|
value: |
|
|
|
'${cropPlot.tbCropDTO.endDate.format_DDMMYY_HHmm() ?? '--'}'), |
|
|
|
WidgetRowPlotInfo( |
|
|
|
color: AppColors.DEFAULT |
|
|
|
.withOpacity(0.1), |
|
|
|
name: 'Kỹ sư trực tiếp', |
|
|
|
value: '$technicians'), |
|
|
|
WidgetRowPlotInfo( |
|
|
|
color: AppColors.DEFAULT |
|
|
|
.withOpacity(0.3), |
|
|
|
name: 'Diện tích (m\u00B2)', |
|
|
|
value: |
|
|
|
'${cropPlot.tbCropDTO.areaM2.formatNumtoStringDecimal()}'), |
|
|
|
SizedBox( |
|
|
|
height: 8, |
|
|
|
), |
|
|
|
_descriptionField(), |
|
|
|
SizedBox( |
|
|
|
height: 16, |
|
|
|
), |
|
|
|
GetBuilder< |
|
|
|
DescriptionChangeControler>( |
|
|
|
builder: (_) { |
|
|
|
return SizedBox( |
|
|
|
width: double.infinity, |
|
|
|
height: 55, |
|
|
|
child: FlatButton( |
|
|
|
onPressed: |
|
|
|
controller.isChanged == |
|
|
|
false |
|
|
|
? () {} |
|
|
|
: () { |
|
|
|
FocusScopeNode |
|
|
|
currentFocus = |
|
|
|
FocusScope.of( |
|
|
|
context); |
|
|
|
if (!currentFocus |
|
|
|
.hasPrimaryFocus) { |
|
|
|
currentFocus |
|
|
|
.unfocus(); |
|
|
|
} |
|
|
|
_validateInputs(); |
|
|
|
}, |
|
|
|
color: controller.isChanged |
|
|
|
? AppColors.DEFAULT |
|
|
|
: Colors.grey[400], |
|
|
|
shape: |
|
|
|
RoundedRectangleBorder( |
|
|
|
borderRadius: |
|
|
|
new BorderRadius |
|
|
|
.circular(7.0), |
|
|
|
), |
|
|
|
child: Text( |
|
|
|
'Cập nhật' |
|
|
|
.toUpperCase(), |
|
|
|
style: TextStyle( |
|
|
|
fontWeight: |
|
|
|
FontWeight.bold, |
|
|
|
color: |
|
|
|
AppColors.WHITE, |
|
|
|
fontSize: 18)), |
|
|
|
), |
|
|
|
); |
|
|
|
}, |
|
|
|
) |
|
|
|
], |
|
|
|
gestures: [GestureType.onTap], |
|
|
|
child: Container( |
|
|
|
color: AppColors.ITEM_BG, |
|
|
|
child: SafeArea( |
|
|
|
top: false, |
|
|
|
bottom: true, |
|
|
|
child: Scaffold( |
|
|
|
appBar: widget.isShowAppbar |
|
|
|
? AppBarWidget() |
|
|
|
: PreferredSize( |
|
|
|
preferredSize: Size(0, 0), |
|
|
|
child: SizedBox(), |
|
|
|
), |
|
|
|
key: _scaffoldKey, |
|
|
|
body: KeyboardDismisser( |
|
|
|
child: StreamBuilder( |
|
|
|
stream: getPlotInfoBloc.actions, |
|
|
|
builder: (BuildContext context, |
|
|
|
AsyncSnapshot<dynamic> snapshot) { |
|
|
|
if (snapshot.hasData) { |
|
|
|
return Form( |
|
|
|
key: _formKey, |
|
|
|
autovalidate: _autoValidate, |
|
|
|
child: SingleChildScrollView( |
|
|
|
padding: EdgeInsets.all(8.0), |
|
|
|
child: Column( |
|
|
|
children: <Widget>[ |
|
|
|
WidgetRowPlotInfo( |
|
|
|
color: AppColors.DEFAULT |
|
|
|
.withOpacity(0.1), |
|
|
|
name: 'Mã lô', |
|
|
|
value: |
|
|
|
'${cropPlot.tbCropDTO.code}'), |
|
|
|
WidgetRowPlotInfo( |
|
|
|
color: AppColors.DEFAULT |
|
|
|
.withOpacity(0.3), |
|
|
|
name: 'Trạng thái', |
|
|
|
value: '$statusCrop'), |
|
|
|
WidgetRowPlotInfo( |
|
|
|
color: AppColors.DEFAULT |
|
|
|
.withOpacity(0.1), |
|
|
|
name: 'Nhà màng', |
|
|
|
value: |
|
|
|
'${cropPlot.tbCropDTO.netHouseName ?? '--'}'), |
|
|
|
WidgetRowPlotInfo( |
|
|
|
color: AppColors.DEFAULT |
|
|
|
.withOpacity(0.3), |
|
|
|
name: 'Giống', |
|
|
|
value: |
|
|
|
'${cropPlot.tbCropDTO.suppliesName ?? '--'}'), |
|
|
|
WidgetRowPlotInfo( |
|
|
|
color: AppColors.DEFAULT |
|
|
|
.withOpacity(0.1), |
|
|
|
name: 'Ngày gieo trồng', |
|
|
|
value: |
|
|
|
'${cropPlot.sowingDate.format_DDMMYY_HHmm() ?? '--'}'), |
|
|
|
WidgetRowPlotInfo( |
|
|
|
color: AppColors.DEFAULT |
|
|
|
.withOpacity(0.3), |
|
|
|
name: 'Thời gian ngâm hạt', |
|
|
|
value: |
|
|
|
'${cropPlot.soakSeedsTime ?? '--'}'), |
|
|
|
WidgetRowPlotInfo( |
|
|
|
color: AppColors.DEFAULT |
|
|
|
.withOpacity(0.1), |
|
|
|
name: 'Ngày vô khây ươm', |
|
|
|
value: |
|
|
|
'${cropPlot.seedIncubationTime ?? '--'}'), |
|
|
|
WidgetRowPlotInfo( |
|
|
|
color: AppColors.DEFAULT |
|
|
|
.withOpacity(0.3), |
|
|
|
name: 'Số lượng cây trồng', |
|
|
|
value: |
|
|
|
'${cropPlot.numberPlants ?? '--'}'), |
|
|
|
WidgetRowPlotInfo( |
|
|
|
color: AppColors.DEFAULT |
|
|
|
.withOpacity(0.1), |
|
|
|
name: 'Số lượng cây hiện tại', |
|
|
|
value: |
|
|
|
'${cropPlot.numberCurrentPlants ?? '--'}'), |
|
|
|
WidgetRowPlotInfo( |
|
|
|
color: AppColors.DEFAULT |
|
|
|
.withOpacity(0.3), |
|
|
|
name: 'Ngày kết thúc canh tác', |
|
|
|
value: |
|
|
|
'${cropPlot.tbCropDTO.endDate.format_DDMMYY_HHmm() ?? '--'}'), |
|
|
|
WidgetRowPlotInfo( |
|
|
|
color: AppColors.DEFAULT |
|
|
|
.withOpacity(0.1), |
|
|
|
name: 'Kỹ sư trực tiếp', |
|
|
|
value: '$technicians'), |
|
|
|
WidgetRowPlotInfo( |
|
|
|
color: AppColors.DEFAULT |
|
|
|
.withOpacity(0.3), |
|
|
|
name: 'Diện tích (m\u00B2)', |
|
|
|
value: |
|
|
|
'${cropPlot.tbCropDTO.areaM2.formatNumtoStringDecimal()}'), |
|
|
|
SizedBox( |
|
|
|
height: 8, |
|
|
|
), |
|
|
|
)); |
|
|
|
} else if (snapshot.hasError) { |
|
|
|
return Center( |
|
|
|
child: Text(snapshot.error.toString()), |
|
|
|
); |
|
|
|
} else { |
|
|
|
return LoadingListPage(); |
|
|
|
} |
|
|
|
})))))); |
|
|
|
_descriptionField(), |
|
|
|
SizedBox( |
|
|
|
height: 16, |
|
|
|
), |
|
|
|
GetBuilder<DescriptionChangeControler>( |
|
|
|
builder: (_) { |
|
|
|
return SizedBox( |
|
|
|
width: double.infinity, |
|
|
|
height: 55, |
|
|
|
child: FlatButton( |
|
|
|
onPressed: |
|
|
|
controller.isChanged == |
|
|
|
false |
|
|
|
? () {} |
|
|
|
: () { |
|
|
|
FocusScopeNode |
|
|
|
currentFocus = |
|
|
|
FocusScope.of( |
|
|
|
context); |
|
|
|
if (!currentFocus |
|
|
|
.hasPrimaryFocus) { |
|
|
|
currentFocus |
|
|
|
.unfocus(); |
|
|
|
} |
|
|
|
_validateInputs(); |
|
|
|
}, |
|
|
|
color: controller.isChanged |
|
|
|
? AppColors.DEFAULT |
|
|
|
: Colors.grey[400], |
|
|
|
shape: RoundedRectangleBorder( |
|
|
|
borderRadius: |
|
|
|
new BorderRadius.circular( |
|
|
|
7.0), |
|
|
|
), |
|
|
|
child: Text( |
|
|
|
'Cập nhật'.toUpperCase(), |
|
|
|
style: TextStyle( |
|
|
|
fontWeight: |
|
|
|
FontWeight.bold, |
|
|
|
color: AppColors.WHITE, |
|
|
|
fontSize: 18)), |
|
|
|
), |
|
|
|
); |
|
|
|
}, |
|
|
|
) |
|
|
|
], |
|
|
|
), |
|
|
|
)); |
|
|
|
} else if (snapshot.hasError) { |
|
|
|
return Center( |
|
|
|
child: Text(snapshot.error.toString()), |
|
|
|
); |
|
|
|
} else { |
|
|
|
return LoadingListPage(); |
|
|
|
} |
|
|
|
})))))); |
|
|
|
|
|
|
|
@override |
|
|
|
void dispose() { |