|
|
|
@@ -4,7 +4,9 @@ import 'package:farm_tpf/custom_model/Nursery.dart'; |
|
|
|
import 'package:farm_tpf/custom_model/NurseryDetail.dart'; |
|
|
|
import 'package:farm_tpf/data/repository/repository.dart'; |
|
|
|
import 'package:farm_tpf/models/index.dart'; |
|
|
|
import 'package:farm_tpf/presentation/custom_widgets/widget_loading.dart'; |
|
|
|
import 'package:farm_tpf/presentation/custom_widgets/widget_media_picker.dart'; |
|
|
|
import 'package:farm_tpf/presentation/screens/actions/bloc/action_detail_bloc.dart'; |
|
|
|
import 'package:farm_tpf/presentation/screens/actions/nursery/bloc/expansion_list_bloc.dart'; |
|
|
|
import 'package:farm_tpf/presentation/screens/resources/sc_resource_helper.dart'; |
|
|
|
import 'package:farm_tpf/utils/bloc/bloc/status_add_form_bloc.dart'; |
|
|
|
@@ -475,71 +477,101 @@ class _EditActionNurseryState extends State<EditActionNurseryScreen> { |
|
|
|
), |
|
|
|
BlocProvider<StatusAddFormBloc>( |
|
|
|
create: (context) => StatusAddFormBloc(), |
|
|
|
) |
|
|
|
), |
|
|
|
BlocProvider<ActionDetailBloc>( |
|
|
|
create: (context) => ActionDetailBloc( |
|
|
|
repository: Repository()) |
|
|
|
..add( |
|
|
|
FetchData(isNeedFetchData: true, activityId: 1))) |
|
|
|
], |
|
|
|
child: Form( |
|
|
|
key: _formKey, |
|
|
|
autovalidate: _autoValidate, |
|
|
|
child: SingleChildScrollView( |
|
|
|
padding: EdgeInsets.all(8.0), |
|
|
|
child: Column( |
|
|
|
children: <Widget>[ |
|
|
|
Container( |
|
|
|
width: double.infinity, |
|
|
|
child: Text( |
|
|
|
"Ngày thực hiện", |
|
|
|
style: TextStyle( |
|
|
|
color: Colors.black54, fontSize: 13.0), |
|
|
|
), |
|
|
|
), |
|
|
|
_btnExecuteTimePicker(), |
|
|
|
SizedBox( |
|
|
|
height: 8.0, |
|
|
|
), |
|
|
|
Container( |
|
|
|
width: double.infinity, |
|
|
|
child: Text( |
|
|
|
"Tên giống", |
|
|
|
style: TextStyle( |
|
|
|
color: Colors.black54, fontSize: 13.0), |
|
|
|
), |
|
|
|
), |
|
|
|
_btnSelectSeed(), |
|
|
|
SizedBox( |
|
|
|
height: 8.0, |
|
|
|
), |
|
|
|
_seedLengthField(), |
|
|
|
SizedBox( |
|
|
|
height: 8.0, |
|
|
|
), |
|
|
|
_quantityField(), |
|
|
|
SizedBox( |
|
|
|
height: 8.0, |
|
|
|
), |
|
|
|
_seedIncubationTimeField(), |
|
|
|
SizedBox( |
|
|
|
height: 8.0, |
|
|
|
), |
|
|
|
_desciptionField(), |
|
|
|
SizedBox( |
|
|
|
height: 8.0, |
|
|
|
), |
|
|
|
_btnAddWorker(), |
|
|
|
SizedBox( |
|
|
|
height: 8.0, |
|
|
|
), |
|
|
|
_buildListAddWorker(), |
|
|
|
SizedBox( |
|
|
|
height: 8.0, |
|
|
|
), |
|
|
|
WidgetMediaPicker(onChangeFiles: (filePaths) { |
|
|
|
Get.find<ChangeFileController>() |
|
|
|
.addAllFile(filePaths); |
|
|
|
// setState(() { |
|
|
|
// filePaths = filePaths; |
|
|
|
// }); |
|
|
|
}) |
|
|
|
], |
|
|
|
child: BlocConsumer<ActionDetailBloc, |
|
|
|
ActionDetailState>( |
|
|
|
listener: (context, state) { |
|
|
|
if (state is ActionDetailFailure) { |
|
|
|
print("fail"); |
|
|
|
LoadingDialog.hideLoadingDialog(context); |
|
|
|
} else if (state is ActionDetailSuccess) { |
|
|
|
LoadingDialog.hideLoadingDialog(context); |
|
|
|
print("success"); |
|
|
|
_nursery = Nursery.fromJson(state.item); |
|
|
|
_quantityController.text = |
|
|
|
"sfdf ${_nursery.id}"; |
|
|
|
} else if (state is ActionDetailInitial) { |
|
|
|
print("init"); |
|
|
|
} else if (state is ActionDetailLoading) { |
|
|
|
print("loading"); |
|
|
|
LoadingDialog.showLoadingDialog(context); |
|
|
|
} |
|
|
|
}, |
|
|
|
builder: (context, state) { |
|
|
|
return Column( |
|
|
|
children: <Widget>[ |
|
|
|
Container( |
|
|
|
width: double.infinity, |
|
|
|
child: Text( |
|
|
|
"Ngày thực hiện", |
|
|
|
style: TextStyle( |
|
|
|
color: Colors.black54, |
|
|
|
fontSize: 13.0), |
|
|
|
), |
|
|
|
), |
|
|
|
_btnExecuteTimePicker(), |
|
|
|
SizedBox( |
|
|
|
height: 8.0, |
|
|
|
), |
|
|
|
Container( |
|
|
|
width: double.infinity, |
|
|
|
child: Text( |
|
|
|
"Tên giống", |
|
|
|
style: TextStyle( |
|
|
|
color: Colors.black54, |
|
|
|
fontSize: 13.0), |
|
|
|
), |
|
|
|
), |
|
|
|
_btnSelectSeed(), |
|
|
|
SizedBox( |
|
|
|
height: 8.0, |
|
|
|
), |
|
|
|
_seedLengthField(), |
|
|
|
SizedBox( |
|
|
|
height: 8.0, |
|
|
|
), |
|
|
|
_quantityField(), |
|
|
|
SizedBox( |
|
|
|
height: 8.0, |
|
|
|
), |
|
|
|
_seedIncubationTimeField(), |
|
|
|
SizedBox( |
|
|
|
height: 8.0, |
|
|
|
), |
|
|
|
_desciptionField(), |
|
|
|
SizedBox( |
|
|
|
height: 8.0, |
|
|
|
), |
|
|
|
_btnAddWorker(), |
|
|
|
SizedBox( |
|
|
|
height: 8.0, |
|
|
|
), |
|
|
|
_buildListAddWorker(), |
|
|
|
SizedBox( |
|
|
|
height: 8.0, |
|
|
|
), |
|
|
|
WidgetMediaPicker( |
|
|
|
onChangeFiles: (filePaths) { |
|
|
|
Get.find<ChangeFileController>() |
|
|
|
.addAllFile(filePaths); |
|
|
|
// setState(() { |
|
|
|
// filePaths = filePaths; |
|
|
|
// }); |
|
|
|
}) |
|
|
|
], |
|
|
|
); |
|
|
|
}, |
|
|
|
), |
|
|
|
)))))); |
|
|
|
@override |