| } | } | ||||
| android { | android { | ||||
| compileSdkVersion 33 | |||||
| compileSdkVersion 34 | |||||
| ndkVersion "21.1.6352462" | ndkVersion "21.1.6352462" | ||||
| sourceSets { | sourceSets { | ||||
| // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). | ||||
| applicationId "vn.azteam.farmdemo" | applicationId "vn.azteam.farmdemo" | ||||
| minSdkVersion 24 | minSdkVersion 24 | ||||
| targetSdkVersion 33 | |||||
| targetSdkVersion 34 | |||||
| versionCode flutterVersionCode.toInteger() | versionCode flutterVersionCode.toInteger() | ||||
| versionName flutterVersionName | versionName flutterVersionName | ||||
| } | } |
| CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; | CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; | ||||
| CODE_SIGN_IDENTITY = "Apple Development"; | CODE_SIGN_IDENTITY = "Apple Development"; | ||||
| CODE_SIGN_STYLE = Automatic; | CODE_SIGN_STYLE = Automatic; | ||||
| CURRENT_PROJECT_VERSION = 25; | |||||
| CURRENT_PROJECT_VERSION = 26; | |||||
| DEVELOPMENT_TEAM = C3DTD2JH94; | DEVELOPMENT_TEAM = C3DTD2JH94; | ||||
| ENABLE_BITCODE = NO; | ENABLE_BITCODE = NO; | ||||
| FRAMEWORK_SEARCH_PATHS = ( | FRAMEWORK_SEARCH_PATHS = ( | ||||
| CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; | CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; | ||||
| CODE_SIGN_IDENTITY = "Apple Development"; | CODE_SIGN_IDENTITY = "Apple Development"; | ||||
| CODE_SIGN_STYLE = Automatic; | CODE_SIGN_STYLE = Automatic; | ||||
| CURRENT_PROJECT_VERSION = 25; | |||||
| CURRENT_PROJECT_VERSION = 26; | |||||
| DEVELOPMENT_TEAM = C3DTD2JH94; | DEVELOPMENT_TEAM = C3DTD2JH94; | ||||
| ENABLE_BITCODE = NO; | ENABLE_BITCODE = NO; | ||||
| FRAMEWORK_SEARCH_PATHS = ( | FRAMEWORK_SEARCH_PATHS = ( | ||||
| CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; | CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; | ||||
| CODE_SIGN_IDENTITY = "Apple Development"; | CODE_SIGN_IDENTITY = "Apple Development"; | ||||
| CODE_SIGN_STYLE = Automatic; | CODE_SIGN_STYLE = Automatic; | ||||
| CURRENT_PROJECT_VERSION = 25; | |||||
| CURRENT_PROJECT_VERSION = 26; | |||||
| DEVELOPMENT_TEAM = C3DTD2JH94; | DEVELOPMENT_TEAM = C3DTD2JH94; | ||||
| ENABLE_BITCODE = NO; | ENABLE_BITCODE = NO; | ||||
| FRAMEWORK_SEARCH_PATHS = ( | FRAMEWORK_SEARCH_PATHS = ( |
| child: Column( | child: Column( | ||||
| crossAxisAlignment: CrossAxisAlignment.start, | crossAxisAlignment: CrossAxisAlignment.start, | ||||
| children: [ | children: [ | ||||
| ItemColumnWidget( | |||||
| title: 'Giao việc cho', | |||||
| child: ValueListenableBuilder<String>( | |||||
| valueListenable: bloc.selectedPEmployee, | |||||
| builder: (context, selected, _) { | |||||
| return ValueListenableBuilder<List<ItemDropDown>>( | |||||
| valueListenable: bloc.employees, | |||||
| builder: (context, employees, _) { | |||||
| return DropdownBottomSheet( | |||||
| dataSources: employees, | |||||
| initValue: selected, | |||||
| onSelected: (val) { | |||||
| bloc.selectedPEmployee.value = val.key ?? ''; | |||||
| }, | |||||
| hint: 'Giao việc cho', | |||||
| ); | |||||
| }, | |||||
| ); | |||||
| }, | |||||
| ), | |||||
| ), | |||||
| const SizedBox( | |||||
| height: 8, | |||||
| ), | |||||
| // ItemColumnWidget( | |||||
| // title: 'Giao việc cho', | |||||
| // child: ValueListenableBuilder<String>( | |||||
| // valueListenable: bloc.selectedPEmployee, | |||||
| // builder: (context, selected, _) { | |||||
| // return ValueListenableBuilder<List<ItemDropDown>>( | |||||
| // valueListenable: bloc.employees, | |||||
| // builder: (context, employees, _) { | |||||
| // return DropdownBottomSheet( | |||||
| // dataSources: employees, | |||||
| // initValue: selected, | |||||
| // onSelected: (val) { | |||||
| // bloc.selectedPEmployee.value = val.key ?? ''; | |||||
| // }, | |||||
| // hint: 'Giao việc cho', | |||||
| // ); | |||||
| // }, | |||||
| // ); | |||||
| // }, | |||||
| // ), | |||||
| // ), | |||||
| // const SizedBox( | |||||
| // height: 8, | |||||
| // ), | |||||
| ItemColumnWidget( | ItemColumnWidget( | ||||
| title: 'Tiêu đề', | title: 'Tiêu đề', | ||||
| child: TextFieldNormal( | child: TextFieldNormal( |
| final detailCtl = TextEditingController(); | final detailCtl = TextEditingController(); | ||||
| var deadline = ValueNotifier(DateTime.now()); | var deadline = ValueNotifier(DateTime.now()); | ||||
| var employeeRaws = <Employee>[]; | |||||
| var employees = ValueNotifier(<ItemDropDown>[]); | |||||
| var selectedPEmployee = ValueNotifier(''); | |||||
| // var employeeRaws = <Employee>[]; | |||||
| // var employees = ValueNotifier(<ItemDropDown>[]); | |||||
| // var selectedPEmployee = ValueNotifier(''); | |||||
| // var existedCreateTask = UpdateCreateTask(); | // var existedCreateTask = UpdateCreateTask(); | ||||
| void dispose() { | void dispose() { | ||||
| } | } | ||||
| Future<void> preparedData({required int cropId}) async { | Future<void> preparedData({required int cropId}) async { | ||||
| try { | |||||
| await Future.delayed(const Duration(seconds: 0)); | |||||
| emit(CreateTaskLoading()); | |||||
| // try { | |||||
| // await Future.delayed(const Duration(seconds: 0)); | |||||
| // emit(CreateTaskLoading()); | |||||
| employeeRaws = await repository.getEmployees(); | |||||
| employees.value = employeeRaws | |||||
| .map( | |||||
| (e) => ItemDropDown(key: e.id?.toString(), value: e.name), | |||||
| ) | |||||
| .toList(); | |||||
| emit(CreateTaskPrepareDataSuccessful()); | |||||
| } catch (e) { | |||||
| emit(CreateTaskFailure(AppException.handleError(e))); | |||||
| } | |||||
| // employeeRaws = await repository.getEmployees(); | |||||
| // employees.value = employeeRaws | |||||
| // .map( | |||||
| // (e) => ItemDropDown(key: e.id?.toString(), value: e.name), | |||||
| // ) | |||||
| // .toList(); | |||||
| // emit(CreateTaskPrepareDataSuccessful()); | |||||
| // } catch (e) { | |||||
| // emit(CreateTaskFailure(AppException.handleError(e))); | |||||
| // } | |||||
| } | } | ||||
| Future<void> onSubmit(int cropId) async { | Future<void> onSubmit(int cropId) async { | ||||
| if (formKey.currentState!.validate()) { | if (formKey.currentState!.validate()) { | ||||
| if (selectedPEmployee.value.isEmpty) { | |||||
| Utils.showSnackBarWarning(message: 'Vui lòng chọn nhân viên'); | |||||
| return; | |||||
| } else if (titleNameCtl.text.trim().isEmpty) { | |||||
| // if (selectedPEmployee.value.isEmpty) { | |||||
| // Utils.showSnackBarWarning(message: 'Vui lòng chọn nhân viên'); | |||||
| // return; | |||||
| // } | |||||
| if (titleNameCtl.text.trim().isEmpty) { | |||||
| Utils.showSnackBarWarning(message: 'Vui lòng nhập tiêu đề'); | Utils.showSnackBarWarning(message: 'Vui lòng nhập tiêu đề'); | ||||
| return; | return; | ||||
| } else if (detailCtl.text.trim().isEmpty) { | } else if (detailCtl.text.trim().isEmpty) { | ||||
| ..cropId = cropId | ..cropId = cropId | ||||
| ..title = titleNameCtl.text | ..title = titleNameCtl.text | ||||
| ..detail = detailCtl.text | ..detail = detailCtl.text | ||||
| ..userAssignedId = int.tryParse(selectedPEmployee.value) | |||||
| // ..userAssignedId = int.tryParse(selectedPEmployee.value) | |||||
| ..deadline = deadline.value.convertLocalDateTimeToStringUtcDateTime(); | ..deadline = deadline.value.convertLocalDateTimeToStringUtcDateTime(); | ||||
| print(requestTask.toJson()); | print(requestTask.toJson()); | ||||
| UtilWidget.showLoading(); | UtilWidget.showLoading(); |
| String? title; | String? title; | ||||
| String? detail; | String? detail; | ||||
| String? deadline; | String? deadline; | ||||
| int? userAssignedId; | |||||
| // int? userAssignedId; | |||||
| int? cropId; | int? cropId; | ||||
| RequestTask({ | RequestTask({ | ||||
| this.title, | this.title, | ||||
| this.detail, | this.detail, | ||||
| this.deadline, | this.deadline, | ||||
| this.userAssignedId, | |||||
| // this.userAssignedId, | |||||
| this.cropId, | this.cropId, | ||||
| }); | }); | ||||
| title = json['title']; | title = json['title']; | ||||
| detail = json['detail']; | detail = json['detail']; | ||||
| deadline = json['deadline']; | deadline = json['deadline']; | ||||
| userAssignedId = json['user_assigned_id']; | |||||
| // userAssignedId = json['user_assigned_id']; | |||||
| cropId = json['crop_id']; | cropId = json['crop_id']; | ||||
| } | } | ||||
| data['title'] = this.title; | data['title'] = this.title; | ||||
| data['detail'] = this.detail; | data['detail'] = this.detail; | ||||
| data['deadline'] = this.deadline; | data['deadline'] = this.deadline; | ||||
| data['user_assigned_id'] = this.userAssignedId; | |||||
| // data['user_assigned_id'] = this.userAssignedId; | |||||
| data['crop_id'] = this.cropId; | data['crop_id'] = this.cropId; | ||||
| return data; | return data; | ||||
| } | } |
| description: A new Flutter project. | description: A new Flutter project. | ||||
| publish_to: 'none' | publish_to: 'none' | ||||
| version: 1.1.8+25 | |||||
| version: 1.1.9+27 | |||||
| environment: | environment: | ||||
| sdk: ">=3.0.0 <4.0.0" | sdk: ">=3.0.0 <4.0.0" |