| <uses-permission android:name="android.permission.CAMERA" /> | <uses-permission android:name="android.permission.CAMERA" /> | ||||
| <application | <application | ||||
| android:name=".Application" | android:name=".Application" | ||||
| android:label="Smart Farm" | |||||
| android:label="Aztrace - Nhật ký canh tác" | |||||
| android:icon="@mipmap/ic_launcher" | android:icon="@mipmap/ic_launcher" | ||||
| android:requestLegacyExternalStorage="true"> | android:requestLegacyExternalStorage="true"> | ||||
| <meta-data | <meta-data |
| <key>CFBundleVersion</key> | <key>CFBundleVersion</key> | ||||
| <string>1.0</string> | <string>1.0</string> | ||||
| <key>MinimumOSVersion</key> | <key>MinimumOSVersion</key> | ||||
| <string>9.0</string> | |||||
| <string>11.0</string> | |||||
| </dict> | </dict> | ||||
| </plist> | </plist> |
| - SDWebImageWebPCoder (0.14.0): | - SDWebImageWebPCoder (0.14.0): | ||||
| - libwebp (~> 1.0) | - libwebp (~> 1.0) | ||||
| - SDWebImage/Core (~> 5.17) | - SDWebImage/Core (~> 5.17) | ||||
| - shared_preferences (0.0.1): | |||||
| - shared_preferences_foundation (0.0.1): | |||||
| - Flutter | - Flutter | ||||
| - FlutterMacOS | |||||
| - sqflite (0.0.3): | - sqflite (0.0.3): | ||||
| - Flutter | - Flutter | ||||
| - FMDB (>= 2.7.5) | - FMDB (>= 2.7.5) | ||||
| - package_info_plus (from `.symlinks/plugins/package_info_plus/ios`) | - package_info_plus (from `.symlinks/plugins/package_info_plus/ios`) | ||||
| - path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/ios`) | - path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/ios`) | ||||
| - qr_code_scanner (from `.symlinks/plugins/qr_code_scanner/ios`) | - qr_code_scanner (from `.symlinks/plugins/qr_code_scanner/ios`) | ||||
| - shared_preferences (from `.symlinks/plugins/shared_preferences/ios`) | |||||
| - shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/ios`) | |||||
| - sqflite (from `.symlinks/plugins/sqflite/ios`) | - sqflite (from `.symlinks/plugins/sqflite/ios`) | ||||
| SPEC REPOS: | SPEC REPOS: | ||||
| :path: ".symlinks/plugins/path_provider_foundation/ios" | :path: ".symlinks/plugins/path_provider_foundation/ios" | ||||
| qr_code_scanner: | qr_code_scanner: | ||||
| :path: ".symlinks/plugins/qr_code_scanner/ios" | :path: ".symlinks/plugins/qr_code_scanner/ios" | ||||
| shared_preferences: | |||||
| :path: ".symlinks/plugins/shared_preferences/ios" | |||||
| shared_preferences_foundation: | |||||
| :path: ".symlinks/plugins/shared_preferences_foundation/ios" | |||||
| sqflite: | sqflite: | ||||
| :path: ".symlinks/plugins/sqflite/ios" | :path: ".symlinks/plugins/sqflite/ios" | ||||
| qr_code_scanner: bb67d64904c3b9658ada8c402e8b4d406d5d796e | qr_code_scanner: bb67d64904c3b9658ada8c402e8b4d406d5d796e | ||||
| SDWebImage: 96e0c18ef14010b7485210e92fac888587ebb958 | SDWebImage: 96e0c18ef14010b7485210e92fac888587ebb958 | ||||
| SDWebImageWebPCoder: 3027af94522d94df79c21c070894c8a2128927ff | SDWebImageWebPCoder: 3027af94522d94df79c21c070894c8a2128927ff | ||||
| shared_preferences: af6bfa751691cdc24be3045c43ec037377ada40d | |||||
| shared_preferences_foundation: 5b919d13b803cadd15ed2dc053125c68730e5126 | |||||
| sqflite: 31f7eba61e3074736dff8807a9b41581e4f7f15a | sqflite: 31f7eba61e3074736dff8807a9b41581e4f7f15a | ||||
| SwiftyGif: 93a1cc87bf3a51916001cf8f3d63835fb64c819f | SwiftyGif: 93a1cc87bf3a51916001cf8f3d63835fb64c819f | ||||
| ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; | ||||
| CLANG_ENABLE_MODULES = YES; | CLANG_ENABLE_MODULES = YES; | ||||
| CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; | CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; | ||||
| CURRENT_PROJECT_VERSION = 14; | |||||
| CODE_SIGN_IDENTITY = "Apple Development"; | |||||
| CODE_SIGN_STYLE = Automatic; | |||||
| CURRENT_PROJECT_VERSION = 20; | |||||
| DEVELOPMENT_TEAM = C3DTD2JH94; | DEVELOPMENT_TEAM = C3DTD2JH94; | ||||
| ENABLE_BITCODE = NO; | ENABLE_BITCODE = NO; | ||||
| FRAMEWORK_SEARCH_PATHS = ( | FRAMEWORK_SEARCH_PATHS = ( | ||||
| "$(inherited)", | "$(inherited)", | ||||
| "$(PROJECT_DIR)/Flutter", | "$(PROJECT_DIR)/Flutter", | ||||
| ); | ); | ||||
| MARKETING_VERSION = 1.1.1; | |||||
| MARKETING_VERSION = 1.1.5; | |||||
| PRODUCT_BUNDLE_IDENTIFIER = vn.azteam.farmdemo; | PRODUCT_BUNDLE_IDENTIFIER = vn.azteam.farmdemo; | ||||
| PRODUCT_NAME = "$(TARGET_NAME)"; | PRODUCT_NAME = "$(TARGET_NAME)"; | ||||
| PROVISIONING_PROFILE_SPECIFIER = ""; | |||||
| SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; | ||||
| SWIFT_VERSION = 5.0; | SWIFT_VERSION = 5.0; | ||||
| VERSIONING_SYSTEM = "apple-generic"; | VERSIONING_SYSTEM = "apple-generic"; | ||||
| 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 = 14; | |||||
| CURRENT_PROJECT_VERSION = 20; | |||||
| DEVELOPMENT_TEAM = C3DTD2JH94; | DEVELOPMENT_TEAM = C3DTD2JH94; | ||||
| ENABLE_BITCODE = NO; | ENABLE_BITCODE = NO; | ||||
| FRAMEWORK_SEARCH_PATHS = ( | FRAMEWORK_SEARCH_PATHS = ( | ||||
| "$(inherited)", | "$(inherited)", | ||||
| "$(PROJECT_DIR)/Flutter", | "$(PROJECT_DIR)/Flutter", | ||||
| ); | ); | ||||
| MARKETING_VERSION = 1.1.1; | |||||
| MARKETING_VERSION = 1.1.5; | |||||
| PRODUCT_BUNDLE_IDENTIFIER = vn.azteam.farmdemo; | PRODUCT_BUNDLE_IDENTIFIER = vn.azteam.farmdemo; | ||||
| PRODUCT_NAME = "$(TARGET_NAME)"; | PRODUCT_NAME = "$(TARGET_NAME)"; | ||||
| PROVISIONING_PROFILE_SPECIFIER = ""; | PROVISIONING_PROFILE_SPECIFIER = ""; | ||||
| ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; | ||||
| CLANG_ENABLE_MODULES = YES; | CLANG_ENABLE_MODULES = YES; | ||||
| CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; | CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; | ||||
| CURRENT_PROJECT_VERSION = 14; | |||||
| CODE_SIGN_IDENTITY = "Apple Development"; | |||||
| CODE_SIGN_STYLE = Automatic; | |||||
| CURRENT_PROJECT_VERSION = 20; | |||||
| DEVELOPMENT_TEAM = C3DTD2JH94; | DEVELOPMENT_TEAM = C3DTD2JH94; | ||||
| ENABLE_BITCODE = NO; | ENABLE_BITCODE = NO; | ||||
| FRAMEWORK_SEARCH_PATHS = ( | FRAMEWORK_SEARCH_PATHS = ( | ||||
| "$(inherited)", | "$(inherited)", | ||||
| "$(PROJECT_DIR)/Flutter", | "$(PROJECT_DIR)/Flutter", | ||||
| ); | ); | ||||
| MARKETING_VERSION = 1.1.1; | |||||
| MARKETING_VERSION = 1.1.5; | |||||
| PRODUCT_BUNDLE_IDENTIFIER = vn.azteam.farmdemo; | PRODUCT_BUNDLE_IDENTIFIER = vn.azteam.farmdemo; | ||||
| PRODUCT_NAME = "$(TARGET_NAME)"; | PRODUCT_NAME = "$(TARGET_NAME)"; | ||||
| PROVISIONING_PROFILE_SPECIFIER = ""; | |||||
| SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; | ||||
| SWIFT_VERSION = 5.0; | SWIFT_VERSION = 5.0; | ||||
| VERSIONING_SYSTEM = "apple-generic"; | VERSIONING_SYSTEM = "apple-generic"; |
| selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" | selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" | ||||
| selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" | selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" | ||||
| shouldUseLaunchSchemeArgsEnv = "YES"> | shouldUseLaunchSchemeArgsEnv = "YES"> | ||||
| <Testables> | |||||
| </Testables> | |||||
| <MacroExpansion> | <MacroExpansion> | ||||
| <BuildableReference | <BuildableReference | ||||
| BuildableIdentifier = "primary" | BuildableIdentifier = "primary" | ||||
| ReferencedContainer = "container:Runner.xcodeproj"> | ReferencedContainer = "container:Runner.xcodeproj"> | ||||
| </BuildableReference> | </BuildableReference> | ||||
| </MacroExpansion> | </MacroExpansion> | ||||
| <AdditionalOptions> | |||||
| </AdditionalOptions> | |||||
| <Testables> | |||||
| </Testables> | |||||
| </TestAction> | </TestAction> | ||||
| <LaunchAction | <LaunchAction | ||||
| buildConfiguration = "Debug" | buildConfiguration = "Debug" | ||||
| ReferencedContainer = "container:Runner.xcodeproj"> | ReferencedContainer = "container:Runner.xcodeproj"> | ||||
| </BuildableReference> | </BuildableReference> | ||||
| </BuildableProductRunnable> | </BuildableProductRunnable> | ||||
| <AdditionalOptions> | |||||
| </AdditionalOptions> | |||||
| </LaunchAction> | </LaunchAction> | ||||
| <ProfileAction | <ProfileAction | ||||
| buildConfiguration = "Profile" | buildConfiguration = "Profile" |
| <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||||
| <plist version="1.0"> | <plist version="1.0"> | ||||
| <dict> | <dict> | ||||
| <key>CADisableMinimumFrameDurationOnPhone</key> | |||||
| <true/> | |||||
| <key>CFBundleDevelopmentRegion</key> | <key>CFBundleDevelopmentRegion</key> | ||||
| <string>$(DEVELOPMENT_LANGUAGE)</string> | <string>$(DEVELOPMENT_LANGUAGE)</string> | ||||
| <key>CFBundleExecutable</key> | <key>CFBundleExecutable</key> | ||||
| <key>CFBundleInfoDictionaryVersion</key> | <key>CFBundleInfoDictionaryVersion</key> | ||||
| <string>6.0</string> | <string>6.0</string> | ||||
| <key>CFBundleName</key> | <key>CFBundleName</key> | ||||
| <string>Smart Farm</string> | |||||
| <string>Aztrace - Nhật ký canh tác</string> | |||||
| <key>CFBundlePackageType</key> | <key>CFBundlePackageType</key> | ||||
| <string>APPL</string> | <string>APPL</string> | ||||
| <key>CFBundleShortVersionString</key> | <key>CFBundleShortVersionString</key> | ||||
| <string>Ứng dụng Smart Farm cần quay video để sử dụng cho hoạt động canh tác</string> | <string>Ứng dụng Smart Farm cần quay video để sử dụng cho hoạt động canh tác</string> | ||||
| <key>NSPhotoLibraryUsageDescription</key> | <key>NSPhotoLibraryUsageDescription</key> | ||||
| <string>Ứng dụng Smart Farm cần truy cập thư viện ảnh để sử dụng cho các hoạt động canh tác.</string> | <string>Ứng dụng Smart Farm cần truy cập thư viện ảnh để sử dụng cho các hoạt động canh tác.</string> | ||||
| <key>UIApplicationSupportsIndirectInputEvents</key> | |||||
| <true/> | |||||
| <key>UIBackgroundModes</key> | <key>UIBackgroundModes</key> | ||||
| <array> | <array> | ||||
| <string>fetch</string> | <string>fetch</string> | ||||
| </array> | </array> | ||||
| <key>UIViewControllerBasedStatusBarAppearance</key> | <key>UIViewControllerBasedStatusBarAppearance</key> | ||||
| <false/> | <false/> | ||||
| <key>CADisableMinimumFrameDurationOnPhone</key> | |||||
| <true/> | |||||
| <key>UIApplicationSupportsIndirectInputEvents</key> | |||||
| <true/> | |||||
| </dict> | </dict> | ||||
| </plist> | </plist> |
| import 'package:dio/dio.dart'; | import 'package:dio/dio.dart'; | ||||
| import 'package:dio/native_imp.dart'; | import 'package:dio/native_imp.dart'; | ||||
| import 'package:flutter_bloc/flutter_bloc.dart'; | import 'package:flutter_bloc/flutter_bloc.dart'; | ||||
| import 'package:get/get.dart' as getx; | |||||
| import '../../app.dart'; | import '../../app.dart'; | ||||
| import '../../authentication/bloc/authentication_bloc.dart'; | import '../../authentication/bloc/authentication_bloc.dart'; | ||||
| import '../../environment/app_config.dart'; | import '../../environment/app_config.dart'; | ||||
| import '../../presentation/screens/login/login_page.dart'; | |||||
| import '../../utils/const_enum.dart'; | import '../../utils/const_enum.dart'; | ||||
| import '../../utils/local_storage.dart'; | import '../../utils/local_storage.dart'; | ||||
| err.type == DioErrorType.response && err.response?.statusCode == HttpStatus.unauthorized && !err.requestOptions.path.contains('authenticate'); | err.type == DioErrorType.response && err.response?.statusCode == HttpStatus.unauthorized && !err.requestOptions.path.contains('authenticate'); | ||||
| if (checkUnauthorized) { | if (checkUnauthorized) { | ||||
| LocalStorage.clearUserInfo(); | LocalStorage.clearUserInfo(); | ||||
| getx.Get.offAll(() => const LoginPage()); | |||||
| BlocProvider.of<AuthenticationBloc>(globalNavigator.currentContext!).add( | BlocProvider.of<AuthenticationBloc>(globalNavigator.currentContext!).add( | ||||
| const AuthenticationStatusChanged(AuthenticationStatus.unauthenticated), | const AuthenticationStatusChanged(AuthenticationStatus.unauthenticated), | ||||
| ); | ); |
| final String? invalidMessage; | final String? invalidMessage; | ||||
| final String tag; | final String tag; | ||||
| final String tbSupply; | final String tbSupply; | ||||
| DropdownSupplyWidget( | |||||
| {this.titleName, | |||||
| required this.hint, | |||||
| required this.tag, | |||||
| this.value, | |||||
| required this.condition, | |||||
| required this.onPressed, | |||||
| this.invalidMessage, | |||||
| required this.tbSupply}); | |||||
| DropdownSupplyWidget({ | |||||
| this.titleName, | |||||
| required this.hint, | |||||
| required this.tag, | |||||
| this.value, | |||||
| required this.condition, | |||||
| required this.onPressed, | |||||
| this.invalidMessage, | |||||
| required this.tbSupply, | |||||
| }); | |||||
| @override | @override | ||||
| _DropdownSupplyWidgetState createState() => _DropdownSupplyWidgetState(); | _DropdownSupplyWidgetState createState() => _DropdownSupplyWidgetState(); | ||||
| @override | @override | ||||
| Widget build(BuildContext context) { | Widget build(BuildContext context) { | ||||
| // return Container(); | |||||
| return GetBuilder<ChangeDropdownController>( | return GetBuilder<ChangeDropdownController>( | ||||
| tag: widget.tag, | |||||
| tag: 's', | |||||
| init: controller, | |||||
| builder: (data) { | builder: (data) { | ||||
| return SizedBox( | |||||
| width: double.infinity, | |||||
| height: Validators.stringNotNullOrEmpty(widget.invalidMessage ?? '') ? 85 : 65, | |||||
| child: Column( | |||||
| crossAxisAlignment: CrossAxisAlignment.start, | |||||
| children: [ | |||||
| Validators.stringNotNullOrEmpty(data?.currentData?.name ?? '') | |||||
| ? Text( | |||||
| widget.hint ?? '', | |||||
| style: TextStyle( | |||||
| color: Validators.stringNotNullOrEmpty(widget.invalidMessage ?? '') ? Colors.red : Colors.black54, fontSize: 13.0), | |||||
| ) | |||||
| : Text( | |||||
| '', | |||||
| style: TextStyle( | |||||
| color: Validators.stringNotNullOrEmpty(widget.invalidMessage ?? '') ? Colors.red : Colors.black54, fontSize: 13.0), | |||||
| ), | |||||
| SizedBox( | |||||
| width: double.infinity, | |||||
| height: 44, | |||||
| child: TextButton( | |||||
| onPressed: () { | |||||
| Navigator.of(context) | |||||
| .push(MaterialPageRoute( | |||||
| builder: (_) => CommonDataHelperScreen( | |||||
| titleName: widget.titleName ?? '', | |||||
| tbSupply: widget.tbSupply ?? '', | |||||
| condition: widget.condition ?? '', | |||||
| selectedId: data?.selectedId ?? -1, | |||||
| currentItems: [], | |||||
| currentEditId: -1), | |||||
| fullscreenDialog: false)) | |||||
| .then((value) { | |||||
| if (value != null) { | |||||
| var result = value as CommonData; | |||||
| controller?.change(result); | |||||
| widget.onPressed(result); | |||||
| } | |||||
| }); | |||||
| }, | |||||
| child: Column( | |||||
| crossAxisAlignment: CrossAxisAlignment.start, | |||||
| children: [ | |||||
| Container( | |||||
| padding: EdgeInsets.only(top: 0.0, right: 0.0, bottom: 10.5, left: 0.0), | |||||
| decoration: BoxDecoration( | |||||
| border: Border( | |||||
| bottom: BorderSide( | |||||
| width: 0.5, | |||||
| color: Validators.stringNotNullOrEmpty(widget.invalidMessage ?? '') ? Colors.red : Colors.black54)), | |||||
| ), | |||||
| child: Row( | |||||
| children: [ | |||||
| Expanded( | |||||
| child: Validators.stringNotNullOrEmpty(data?.currentData?.name ?? '') | |||||
| ? Text(data?.currentData?.name ?? '', style: TextStyle(fontSize: 16.0, color: Colors.black)) | |||||
| : Text(widget.hint, style: TextStyle(fontSize: 16.0, color: Colors.black54)), | |||||
| ), | |||||
| Icon( | |||||
| Icons.arrow_drop_down, | |||||
| color: Colors.grey, | |||||
| ), | |||||
| ], | |||||
| )) | |||||
| ], | |||||
| )), | |||||
| ), | |||||
| Validators.stringNotNullOrEmpty(widget.invalidMessage ?? '') | |||||
| ? Text( | |||||
| widget.invalidMessage ?? '', | |||||
| style: TextStyle(fontSize: 12.0, color: Colors.red, fontWeight: FontWeight.normal), | |||||
| textAlign: TextAlign.left, | |||||
| ) | |||||
| : SizedBox(), | |||||
| ], | |||||
| ), | |||||
| ); | |||||
| return Container(); | |||||
| }); | }); | ||||
| // return GetBuilder<ChangeDropdownController>( | |||||
| // tag: widget.tag, | |||||
| // builder: (data) { | |||||
| // return Container(); | |||||
| // return SizedBox( | |||||
| // width: double.infinity, | |||||
| // height: Validators.stringNotNullOrEmpty(widget.invalidMessage ?? '') ? 85 : 65, | |||||
| // child: Column( | |||||
| // crossAxisAlignment: CrossAxisAlignment.start, | |||||
| // children: [ | |||||
| // Validators.stringNotNullOrEmpty(data?.currentData?.name ?? '') | |||||
| // ? Text( | |||||
| // widget.hint ?? '', | |||||
| // style: TextStyle( | |||||
| // color: Validators.stringNotNullOrEmpty(widget.invalidMessage ?? '') ? Colors.red : Colors.black54, fontSize: 13.0), | |||||
| // ) | |||||
| // : Text( | |||||
| // '', | |||||
| // style: TextStyle( | |||||
| // color: Validators.stringNotNullOrEmpty(widget.invalidMessage ?? '') ? Colors.red : Colors.black54, fontSize: 13.0), | |||||
| // ), | |||||
| // SizedBox( | |||||
| // width: double.infinity, | |||||
| // height: 44, | |||||
| // child: TextButton( | |||||
| // onPressed: () { | |||||
| // Navigator.of(context) | |||||
| // .push(MaterialPageRoute( | |||||
| // builder: (_) => CommonDataHelperScreen( | |||||
| // titleName: widget.titleName ?? '', | |||||
| // tbSupply: widget.tbSupply ?? '', | |||||
| // condition: widget.condition ?? '', | |||||
| // selectedId: data?.selectedId ?? -1, | |||||
| // currentItems: [], | |||||
| // currentEditId: -1), | |||||
| // fullscreenDialog: false)) | |||||
| // .then((value) { | |||||
| // if (value != null) { | |||||
| // var result = value as CommonData; | |||||
| // controller?.change(result); | |||||
| // widget.onPressed(result); | |||||
| // } | |||||
| // }); | |||||
| // }, | |||||
| // child: Column( | |||||
| // crossAxisAlignment: CrossAxisAlignment.start, | |||||
| // children: [ | |||||
| // Container( | |||||
| // padding: EdgeInsets.only(top: 0.0, right: 0.0, bottom: 10.5, left: 0.0), | |||||
| // decoration: BoxDecoration( | |||||
| // border: Border( | |||||
| // bottom: BorderSide( | |||||
| // width: 0.5, | |||||
| // color: Validators.stringNotNullOrEmpty(widget.invalidMessage ?? '') ? Colors.red : Colors.black54)), | |||||
| // ), | |||||
| // child: Row( | |||||
| // children: [ | |||||
| // Expanded( | |||||
| // child: Validators.stringNotNullOrEmpty(data?.currentData?.name ?? '') | |||||
| // ? Text(data?.currentData?.name ?? '', style: TextStyle(fontSize: 16.0, color: Colors.black)) | |||||
| // : Text(widget.hint, style: TextStyle(fontSize: 16.0, color: Colors.black54)), | |||||
| // ), | |||||
| // Icon( | |||||
| // Icons.arrow_drop_down, | |||||
| // color: Colors.grey, | |||||
| // ), | |||||
| // ], | |||||
| // )) | |||||
| // ], | |||||
| // )), | |||||
| // ), | |||||
| // Validators.stringNotNullOrEmpty(widget.invalidMessage ?? '') | |||||
| // ? Text( | |||||
| // widget.invalidMessage ?? '', | |||||
| // style: TextStyle(fontSize: 12.0, color: Colors.red, fontWeight: FontWeight.normal), | |||||
| // textAlign: TextAlign.left, | |||||
| // ) | |||||
| // : SizedBox(), | |||||
| // ], | |||||
| // ), | |||||
| // ); | |||||
| // }); | |||||
| } | } | ||||
| } | } |
| class Utils { | class Utils { | ||||
| static void showSnackBarSuccess({String? message}) { | static void showSnackBarSuccess({String? message}) { | ||||
| if (Get.isSnackbarOpen) Get.back(); | if (Get.isSnackbarOpen) Get.back(); | ||||
| Get.snackbar(null, message, | |||||
| Get.snackbar('Thành công', message ?? '', | |||||
| icon: Icon( | icon: Icon( | ||||
| Icons.done, | Icons.done, | ||||
| color: Colors.white, | color: Colors.white, | ||||
| static void showSnackBarError({String? message}) { | static void showSnackBarError({String? message}) { | ||||
| if (Get.isSnackbarOpen) Get.back(); | if (Get.isSnackbarOpen) Get.back(); | ||||
| Get.snackbar(null, message, | |||||
| Get.snackbar('Lỗi', message ?? '', | |||||
| icon: Icon( | icon: Icon( | ||||
| Icons.error, | Icons.error, | ||||
| color: Colors.white, | color: Colors.white, | ||||
| static void showSnackBarWarning({String? message}) { | static void showSnackBarWarning({String? message}) { | ||||
| if (Get.isSnackbarOpen) Get.back(); | if (Get.isSnackbarOpen) Get.back(); | ||||
| Get.snackbar(null, message, | |||||
| Get.snackbar('Cảnh báo', message ?? '', | |||||
| icon: Icon( | icon: Icon( | ||||
| Icons.warning, | Icons.warning, | ||||
| color: Colors.yellow, | color: Colors.yellow, | ||||
| static void showDialog( | static void showDialog( | ||||
| {required String title, required String message, required String textConfirm, required String textCancel, required Function() onConfirm}) { | {required String title, required String message, required String textConfirm, required String textCancel, required Function() onConfirm}) { | ||||
| if (Get.isDialogOpen) Get.back(); | |||||
| if (Get.isDialogOpen ?? false) Get.back(); | |||||
| Get.defaultDialog( | Get.defaultDialog( | ||||
| title: title, | title: title, | ||||
| middleText: message, | middleText: message, | ||||
| } | } | ||||
| static void showDialogConfirmSupply({required Function() onConfirm}) { | static void showDialogConfirmSupply({required Function() onConfirm}) { | ||||
| if (Get.isDialogOpen) Get.back(); | |||||
| if (Get.isDialogOpen ?? false) Get.back(); | |||||
| Get.defaultDialog( | Get.defaultDialog( | ||||
| title: "Vật tư chưa được thêm", | title: "Vật tư chưa được thêm", | ||||
| middleText: "Bạn có muốn cập nhật?", | middleText: "Bạn có muốn cập nhật?", |
| final _executeByController = TextEditingController(); | final _executeByController = TextEditingController(); | ||||
| DateTime executeTime = DateTime.now(); | DateTime executeTime = DateTime.now(); | ||||
| List<String> filePaths = <String>[]; | List<String> filePaths = <String>[]; | ||||
| var controller = Get.put(ChangeDropdownController()); | |||||
| var changeFileController = Get.put(ChangeFileController()); | var changeFileController = Get.put(ChangeFileController()); | ||||
| Map<String, TextEditingController> textFieldControllers = {}; | Map<String, TextEditingController> textFieldControllers = {}; | ||||
| Map<String, String> valueObjects = {}; | Map<String, String> valueObjects = {}; | ||||
| children: [ | children: [ | ||||
| groupName(field.groupName ?? ''), | groupName(field.groupName ?? ''), | ||||
| DropdownSupplyWidget( | DropdownSupplyWidget( | ||||
| titleName: field.description ?? '', | |||||
| tbSupply: field.tbActivityExtendTypeExternalTable ?? '', | |||||
| tag: field.name ?? '', | |||||
| value: field.description, | |||||
| hint: '${field.description} ${(field.isMandatory ?? false) ? '*' : ''}', | |||||
| condition: field.tbActivityExtendTypeCondition ?? '', | |||||
| invalidMessage: '', | |||||
| onPressed: (commonData) { | |||||
| valueObjects[field.id.toString()] = commonData.id.toString(); | |||||
| }), | |||||
| titleName: field.description ?? '', | |||||
| tbSupply: field.tbActivityExtendTypeExternalTable ?? '', | |||||
| tag: field.name ?? '', | |||||
| value: field.description, | |||||
| hint: '${field.description} ${(field.isMandatory ?? false) ? '*' : ''}', | |||||
| condition: field.tbActivityExtendTypeCondition ?? '', | |||||
| invalidMessage: '', | |||||
| onPressed: (commonData) { | |||||
| valueObjects[field.id.toString()] = commonData.id.toString(); | |||||
| }, | |||||
| ), | |||||
| ], | ], | ||||
| ); | ); | ||||
| } else if (field.tbControlTypeName == 'radiobutton') { | } else if (field.tbControlTypeName == 'radiobutton') { |
| import 'package:get/get_state_manager/get_state_manager.dart'; | |||||
| // import 'package:get/get_state_manager/get_state_manager.dart'; | |||||
| import 'package:farm_tpf/custom_model/action_form/CommonData.dart'; | import 'package:farm_tpf/custom_model/action_form/CommonData.dart'; | ||||
| import 'package:get/get.dart'; | |||||
| class ChangeDropdownController extends GetxController { | class ChangeDropdownController extends GetxController { | ||||
| CommonData? currentData; | CommonData? currentData; |
| Widget build(BuildContext context) { | Widget build(BuildContext context) { | ||||
| _blocContext = context; | _blocContext = context; | ||||
| return Scaffold( | return Scaffold( | ||||
| backgroundColor: Colors.white, | |||||
| body: BlocProvider<DeviceBloc>(create: (context) => DeviceBloc(repository: Repository())..add(OpenScreen()), child: _buildContent())); | |||||
| backgroundColor: Colors.white, | |||||
| body: BlocProvider<DeviceBloc>( | |||||
| create: (context) => DeviceBloc(repository: Repository())..add(OpenScreen()), | |||||
| child: _buildContent(), | |||||
| ), | |||||
| ); | |||||
| } | } | ||||
| Widget _buildContent() { | Widget _buildContent() { | ||||
| child: BlocBuilder<DeviceBloc, DeviceState>( | child: BlocBuilder<DeviceBloc, DeviceState>( | ||||
| bloc: _deviceBloc, | bloc: _deviceBloc, | ||||
| builder: (context, state) { | builder: (context, state) { | ||||
| print(state.toString()); | |||||
| if (state is DisplayDevice) { | if (state is DisplayDevice) { | ||||
| if (state.loading ?? false) { | |||||
| return Container( | |||||
| child: Center( | |||||
| child: CircularProgressIndicator(), | |||||
| ), | |||||
| ); | |||||
| } | |||||
| // if (state.loading ?? false) { | |||||
| // print('loading'); | |||||
| // return Container( | |||||
| // child: Center( | |||||
| // child: CircularProgressIndicator(), | |||||
| // ), | |||||
| // ); | |||||
| // } | |||||
| if (state.devices != null) { | if (state.devices != null) { | ||||
| print('devices'); | |||||
| return Container( | return Container( | ||||
| child: WidgetDeviceList( | child: WidgetDeviceList( | ||||
| devices: state.devices ?? [], | devices: state.devices ?? [], |
| void initState() { | void initState() { | ||||
| super.initState(); | super.initState(); | ||||
| if (kDebugMode) { | if (kDebugMode) { | ||||
| loginBloc.usernameCtl.text = 'lecaoanhquoc'; | |||||
| loginBloc.usernameCtl.text = 'quanly2'; | |||||
| loginBloc.passwordCtl.text = '123456'; | loginBloc.passwordCtl.text = '123456'; | ||||
| } | } | ||||
| } | } |
| } else { | } else { | ||||
| isChanged = false; | isChanged = false; | ||||
| } | } | ||||
| if (oldValue.isNullOrBlank && newValue.isEmpty) { | |||||
| if (newValue.isEmpty) { | |||||
| isChanged = false; | isChanged = false; | ||||
| } | } | ||||
| update(); | update(); |
| final changeTabbar = Get.put(TabbarSelected()); | final changeTabbar = Get.put(TabbarSelected()); | ||||
| List<TabbarItem> itemsTabbar = [ | List<TabbarItem> itemsTabbar = [ | ||||
| TabbarItem(icon: AppIcons.icPlot, title: 'Lô trồng', index: TabBarIndex.plot), | TabbarItem(icon: AppIcons.icPlot, title: 'Lô trồng', index: TabBarIndex.plot), | ||||
| // TabbarItem(icon: AppIcons.icDevice, title: 'Thiết bị', index: TabBarIndex.device), | |||||
| TabbarItem(icon: AppIcons.icQrManage, title: 'Quản lý QR', index: TabBarIndex.qrManage), | |||||
| TabbarItem(icon: AppIcons.icDevice, title: 'Thiết bị', index: TabBarIndex.device), | |||||
| // TabbarItem(icon: AppIcons.icQrManage, title: 'Quản lý QR', index: TabBarIndex.qrManage), | |||||
| TabbarItem(icon: AppIcons.icQr, title: 'Quét QR', index: TabBarIndex.qr), | TabbarItem(icon: AppIcons.icQr, title: 'Quét QR', index: TabBarIndex.qr), | ||||
| TabbarItem(icon: AppIcons.icNotification, title: 'Thông báo', index: TabBarIndex.notification), | TabbarItem(icon: AppIcons.icNotification, title: 'Thông báo', index: TabBarIndex.notification), | ||||
| TabbarItem(icon: AppIcons.icPerson, title: 'Cá nhân', index: TabBarIndex.account) | TabbarItem(icon: AppIcons.icPerson, title: 'Cá nhân', index: TabBarIndex.account) | ||||
| case TabBarIndex.plot: | case TabBarIndex.plot: | ||||
| return PlotListScreen(); | return PlotListScreen(); | ||||
| break; | break; | ||||
| // case TabBarIndex.device: | |||||
| // return ControlDeviceScreen(); | |||||
| // break; | |||||
| case TabBarIndex.qrManage: | |||||
| return CodePage(); | |||||
| case TabBarIndex.device: | |||||
| return ControlDeviceScreen(); | |||||
| break; | break; | ||||
| // case TabBarIndex.qrManage: | |||||
| // return CodePage(); | |||||
| // break; | |||||
| case TabBarIndex.qr: | case TabBarIndex.qr: | ||||
| return Container(); | return Container(); | ||||
| break; | break; | ||||
| // scan(context); | // scan(context); | ||||
| Get.to( | Get.to( | ||||
| QrCodeScannerScreen(), | QrCodeScannerScreen(), | ||||
| ).then((value) { | |||||
| )?.then((value) { | |||||
| if (value != null) { | if (value != null) { | ||||
| _showAlertCheckCropCode(value); | _showAlertCheckCropCode(value); | ||||
| } | } | ||||
| try { | try { | ||||
| await repository.getPlotDetailByCode(cropCode).then((value) { | await repository.getPlotDetailByCode(cropCode).then((value) { | ||||
| print("ok"); | print("ok"); | ||||
| if (Get.isDialogOpen) Get.back(); | |||||
| if (Get.isDialogOpen ?? false) Get.back(); | |||||
| Get.to(PlotDetailScreen(cropId: value.tbCropDTO?.id ?? -1, cropType: value.tbCropDTO?.tbCropTypeId ?? -1, initialIndex: 0)); | Get.to(PlotDetailScreen(cropId: value.tbCropDTO?.id ?? -1, cropType: value.tbCropDTO?.tbCropTypeId ?? -1, initialIndex: 0)); | ||||
| }).catchError((onError) { | }).catchError((onError) { | ||||
| Utils.showDialog( | Utils.showDialog( | ||||
| enum TabBarIndex { | enum TabBarIndex { | ||||
| plot, | plot, | ||||
| // device, | |||||
| qrManage, | |||||
| device, | |||||
| // qrManage, | |||||
| qr, | qr, | ||||
| notification, | notification, | ||||
| account, | account, |
| @override | @override | ||||
| Future<String> getString(String key) async { | Future<String> getString(String key) async { | ||||
| final prefs = await SharedPreferences.getInstance(); | final prefs = await SharedPreferences.getInstance(); | ||||
| return prefs.getString(key); | |||||
| return prefs.getString(key) ?? ''; | |||||
| } | } | ||||
| } | } | ||||
| dependency: "direct main" | dependency: "direct main" | ||||
| description: | description: | ||||
| name: get | name: get | ||||
| sha256: e476dffba6f181fd7f48e9785fe000923392644ecd2b10365b631eef440ee833 | |||||
| sha256: "2ba20a47c8f1f233bed775ba2dd0d3ac97b4cf32fc17731b3dfc672b06b0e92a" | |||||
| url: "https://pub.dev" | url: "https://pub.dev" | ||||
| source: hosted | source: hosted | ||||
| version: "3.26.0" | |||||
| version: "4.6.5" | |||||
| glob: | glob: | ||||
| dependency: transitive | dependency: transitive | ||||
| description: | description: | ||||
| dependency: "direct main" | dependency: "direct main" | ||||
| description: | description: | ||||
| name: shared_preferences | name: shared_preferences | ||||
| sha256: "08d8df06bf32ab574b6dee0b09f6df7e37a04022b5660492c3993efc38b46d97" | |||||
| sha256: "81429e4481e1ccfb51ede496e916348668fd0921627779233bd24cc3ff6abd02" | |||||
| url: "https://pub.dev" | url: "https://pub.dev" | ||||
| source: hosted | source: hosted | ||||
| version: "0.5.7+3" | |||||
| shared_preferences_macos: | |||||
| version: "2.2.2" | |||||
| shared_preferences_android: | |||||
| dependency: transitive | dependency: transitive | ||||
| description: | description: | ||||
| name: shared_preferences_macos | |||||
| sha256: "1e66de5365055e1c7a47ea10d77bcc96330041f168bbbdf7a2bfdd4381667901" | |||||
| name: shared_preferences_android | |||||
| sha256: "8568a389334b6e83415b6aae55378e158fbc2314e074983362d20c562780fb06" | |||||
| url: "https://pub.dev" | url: "https://pub.dev" | ||||
| source: hosted | source: hosted | ||||
| version: "0.0.1+11" | |||||
| version: "2.2.1" | |||||
| shared_preferences_foundation: | |||||
| dependency: transitive | |||||
| description: | |||||
| name: shared_preferences_foundation | |||||
| sha256: "7bf53a9f2d007329ee6f3df7268fd498f8373602f943c975598bbb34649b62a7" | |||||
| url: "https://pub.dev" | |||||
| source: hosted | |||||
| version: "2.3.4" | |||||
| shared_preferences_linux: | |||||
| dependency: transitive | |||||
| description: | |||||
| name: shared_preferences_linux | |||||
| sha256: "9f2cbcf46d4270ea8be39fa156d86379077c8a5228d9dfdb1164ae0bb93f1faa" | |||||
| url: "https://pub.dev" | |||||
| source: hosted | |||||
| version: "2.3.2" | |||||
| shared_preferences_platform_interface: | shared_preferences_platform_interface: | ||||
| dependency: transitive | dependency: transitive | ||||
| description: | description: | ||||
| name: shared_preferences_platform_interface | name: shared_preferences_platform_interface | ||||
| sha256: "10958ff09d5b0caaf199fdc436b3433cb9f7491e5f71e4b3d98b451edfee34f4" | |||||
| sha256: d4ec5fc9ebb2f2e056c617112aa75dcf92fc2e4faaf2ae999caa297473f75d8a | |||||
| url: "https://pub.dev" | url: "https://pub.dev" | ||||
| source: hosted | source: hosted | ||||
| version: "1.0.4" | |||||
| version: "2.3.1" | |||||
| shared_preferences_web: | shared_preferences_web: | ||||
| dependency: transitive | dependency: transitive | ||||
| description: | description: | ||||
| name: shared_preferences_web | name: shared_preferences_web | ||||
| sha256: "345b8f659aa4aedaabc3665a63f563c62b08dc209dd23304bc155d69ebcd388d" | |||||
| sha256: d762709c2bbe80626ecc819143013cc820fa49ca5e363620ee20a8b15a3e3daf | |||||
| url: "https://pub.dev" | |||||
| source: hosted | |||||
| version: "2.2.1" | |||||
| shared_preferences_windows: | |||||
| dependency: transitive | |||||
| description: | |||||
| name: shared_preferences_windows | |||||
| sha256: "841ad54f3c8381c480d0c9b508b89a34036f512482c407e6df7a9c4aa2ef8f59" | |||||
| url: "https://pub.dev" | url: "https://pub.dev" | ||||
| source: hosted | source: hosted | ||||
| version: "0.1.2+7" | |||||
| version: "2.3.2" | |||||
| shimmer: | shimmer: | ||||
| dependency: "direct main" | dependency: "direct main" | ||||
| description: | description: |
| description: A new Flutter project. | description: A new Flutter project. | ||||
| publish_to: 'none' | publish_to: 'none' | ||||
| version: 1.1.1+8 | |||||
| version: 1.1.5+20 | |||||
| environment: | environment: | ||||
| sdk: ">=2.17.0 <=3.0.0" | sdk: ">=2.17.0 <=3.0.0" | ||||
| cupertino_icons: ^1.0.6 | cupertino_icons: ^1.0.6 | ||||
| meta: ^1.1.8 | meta: ^1.1.8 | ||||
| shared_preferences: any | |||||
| shared_preferences: ^2.0.5 | |||||
| flutter_bloc: ^7.0.0 | flutter_bloc: ^7.0.0 | ||||
| equatable: ^2.0.5 | equatable: ^2.0.5 | ||||
| dio: ^4.0.0 | dio: ^4.0.0 | ||||
| change_app_package_name: ^1.1.0 | change_app_package_name: ^1.1.0 | ||||
| #flutter pub run change_app_package_name:main vn.azteam.farmdemo | #flutter pub run change_app_package_name:main vn.azteam.farmdemo | ||||
| firebase_messaging: ^14.7.0 | firebase_messaging: ^14.7.0 | ||||
| get: ^3.8.0 | |||||
| get: ^4.1.2 | |||||
| intl: ^0.18.1 | intl: ^0.18.1 | ||||
| flutter_datetime_picker: ^1.5.1 | flutter_datetime_picker: ^1.5.1 | ||||
| # http: ^1.1.0 | # http: ^1.1.0 |