13 required BuildContext context,
18 final TextEditingController firstWeightController = TextEditingController();
25 builder: (BuildContext context) {
26 return BlocBuilder<UnloadingBloc, UnloadingState>(
27 builder: (context, state) {
28 if (state is GetWarehouseResponsibleLoading) {
30 shape: RoundedRectangleBorder(
31 borderRadius: BorderRadius.circular(16.sp),
36 mainAxisSize: MainAxisSize.min,
38 CircularProgressIndicator(),
40 Text(
'Loading warehouse responsible list...')
45 }
else if (state is GetWarehouseResponsibleLoaded) {
46 final List<WarehouseResponsibleEntity> responsibleList = state.warehouseResponsibleList;
48 return StatefulBuilder(
49 builder: (context, setState) {
51 return selectedUser != null &&
52 firstWeightController.text.isNotEmpty &&
53 double.tryParse(firstWeightController.text) != null;
57 shape: RoundedRectangleBorder(
58 borderRadius: BorderRadius.circular(14.sp),
61 backgroundColor: Colors.transparent,
62 child: SingleChildScrollView(
65 decoration: BoxDecoration(
67 borderRadius: BorderRadius.circular(16.sp),
70 color: Colors.black.withValues(alpha: 0.1),
72 offset:
const Offset(0, 5),
77 mainAxisSize: MainAxisSize.min,
81 decoration: BoxDecoration(
83 shape: BoxShape.circle,
86 Icons.check_circle_outline,
93 'unloading.confirmation_dialog.title'.tr(),
96 fontWeight: FontWeight.bold,
97 color: Colors.black87,
102 'unloading.confirmation_dialog.instruction'.tr(),
103 textAlign: TextAlign.center,
106 color: Colors.grey[600],
111 padding: EdgeInsets.symmetric(horizontal: 12.sp),
112 decoration: BoxDecoration(
113 borderRadius: BorderRadius.circular(8.sp),
114 border: Border.all(
color: Colors.grey[300]!),
116 child: DropdownButtonHideUnderline(
117 child: DropdownButton<String>(
120 'unloading.confirmation_dialog.select_responsible'.tr(),
123 color: Colors.grey[600],
131 color: Colors.black87,
133 onChanged: (
String? newValue) {
135 selectedUser = newValue;
139 return DropdownMenuItem<String>(
140 value: responsible.id?.toString(),
141 child:
Text(responsible.warehouseResponsible ??
"--"),
149 padding: EdgeInsets.symmetric(horizontal: 12.sp),
150 decoration: BoxDecoration(
151 borderRadius: BorderRadius.circular(8.sp),
155 controller: firstWeightController,
156 keyboardType: TextInputType.number,
157 onChanged: (
_) => setState(() {}),
158 decoration: InputDecoration(
159 border: InputBorder.none,
160 hintText:
'unloading.confirmation_dialog.enter_weight'.tr(),
161 hintStyle: TextStyle(
163 color: Colors.grey[600],
165 labelText:
'unloading.confirmation_dialog.first_weight'.tr(),
166 labelStyle: TextStyle(
168 color: Colors.grey[600],
171 suffixStyle: TextStyle(
173 color: Colors.grey[600],
185 Navigator.of(context).pop();
187 style: TextButton.styleFrom(
188 padding: EdgeInsets.symmetric(vertical: 12.sp),
189 shape: RoundedRectangleBorder(
190 borderRadius: BorderRadius.circular(8.sp),
195 'unloading.cancel'.tr(),
208 Navigator.of(context).pop();
211 double.parse(firstWeightController.text)
215 style: TextButton.styleFrom(
216 padding: EdgeInsets.symmetric(vertical: 12.sp),
218 shape: RoundedRectangleBorder(
219 borderRadius: BorderRadius.circular(8.sp),
226 'common.confirm'.tr(),
229 fontWeight: FontWeight.w500,
246 shape: RoundedRectangleBorder(
247 borderRadius: BorderRadius.circular(16.sp),
250 padding: EdgeInsets.all(20.sp),
252 mainAxisSize: MainAxisSize.min,
254 Icon(Icons.error_outline,
color: Colors.red, size: 48.sp),
256 Text(
'Error: ${state.message}'),
260 Navigator.of(context).pop();
270 shape: RoundedRectangleBorder(
271 borderRadius: BorderRadius.circular(16.sp),
274 padding: EdgeInsets.all(20.sp),
276 mainAxisSize: MainAxisSize.min,
278 CircularProgressIndicator(),
style Column(crossAxisAlignment:CrossAxisAlignment.end, children:[Container(padding:EdgeInsets.symmetric(horizontal:8.w, vertical:4.h), decoration:BoxDecoration(color:ColorPalette.tiffanyBlue.withValues(alpha:0.1), borderRadius:BorderRadius.circular(12),), child:Text(collection.type ?? '', style:Theme.of(context).textTheme.bodySmall?.copyWith(color:ColorPalette.tiffanyBlue, fontWeight:FontWeight.bold,),),),],)