| /Users/daivph/fvm/versions/2.5.0 |
| { | |||||
| "flutterSdkVersion": "2.5.0", | |||||
| "flavors": {} | |||||
| } |
| { | |||||
| "dart.flutterSdkPath": "~/fvm/versions/2.5.0" | |||||
| } |
| android { | android { | ||||
| compileSdkVersion 29 | compileSdkVersion 29 | ||||
| ndkVersion "21.1.6352462" | |||||
| sourceSets { | sourceSets { | ||||
| main.java.srcDirs += 'src/main/kotlin' | main.java.srcDirs += 'src/main/kotlin' |
| class _RestClient implements RestClient { | class _RestClient implements RestClient { | ||||
| _RestClient(this._dio, {this.baseUrl}) { | _RestClient(this._dio, {this.baseUrl}) { | ||||
| ArgumentError.checkNotNull(_dio, '_dio'); | ArgumentError.checkNotNull(_dio, '_dio'); | ||||
| baseUrl ??= 'https://smartfarm.aztrace.vn'; | |||||
| baseUrl ??= 'https://tpf.aztrace.vn'; | |||||
| } | } | ||||
| final Dio _dio; | final Dio _dio; | ||||
| final queryParameters = <String, dynamic>{}; | final queryParameters = <String, dynamic>{}; | ||||
| final _data = <String, dynamic>{}; | final _data = <String, dynamic>{}; | ||||
| _data.addAll(userRequest?.toJson() ?? <String, dynamic>{}); | _data.addAll(userRequest?.toJson() ?? <String, dynamic>{}); | ||||
| final _result = await _dio.request<Map<String, dynamic>>( | |||||
| '/api/authenticate', | |||||
| final _result = await _dio.request<Map<String, dynamic>>('/api/authenticate', | |||||
| queryParameters: queryParameters, | queryParameters: queryParameters, | ||||
| options: RequestOptions( | |||||
| method: 'POST', | |||||
| headers: <String, dynamic>{}, | |||||
| extra: _extra, | |||||
| baseUrl: baseUrl), | |||||
| options: RequestOptions(method: 'POST', headers: <String, dynamic>{}, extra: _extra, baseUrl: baseUrl), | |||||
| data: _data); | data: _data); | ||||
| final value = User.fromJson(_result.data); | final value = User.fromJson(_result.data); | ||||
| return value; | return value; | ||||
| final _data = <String, dynamic>{}; | final _data = <String, dynamic>{}; | ||||
| final _result = await _dio.request<Map<String, dynamic>>('/api/account', | final _result = await _dio.request<Map<String, dynamic>>('/api/account', | ||||
| queryParameters: queryParameters, | queryParameters: queryParameters, | ||||
| options: RequestOptions( | |||||
| method: 'GET', | |||||
| headers: <String, dynamic>{}, | |||||
| extra: _extra, | |||||
| baseUrl: baseUrl), | |||||
| options: RequestOptions(method: 'GET', headers: <String, dynamic>{}, extra: _extra, baseUrl: baseUrl), | |||||
| data: _data); | data: _data); | ||||
| final value = Account.fromJson(_result.data); | final value = Account.fromJson(_result.data); | ||||
| return value; | return value; | ||||
| final _data = email; | final _data = email; | ||||
| await _dio.request<void>('/api/account/reset-password/init', | await _dio.request<void>('/api/account/reset-password/init', | ||||
| queryParameters: queryParameters, | queryParameters: queryParameters, | ||||
| options: RequestOptions( | |||||
| method: 'POST', | |||||
| headers: <String, dynamic>{}, | |||||
| extra: _extra, | |||||
| baseUrl: baseUrl), | |||||
| options: RequestOptions(method: 'POST', headers: <String, dynamic>{}, extra: _extra, baseUrl: baseUrl), | |||||
| data: _data); | data: _data); | ||||
| return null; | return null; | ||||
| } | } | ||||
| _data.addAll(password?.toJson() ?? <String, dynamic>{}); | _data.addAll(password?.toJson() ?? <String, dynamic>{}); | ||||
| await _dio.request<void>('/api/account/reset-password/finish', | await _dio.request<void>('/api/account/reset-password/finish', | ||||
| queryParameters: queryParameters, | queryParameters: queryParameters, | ||||
| options: RequestOptions( | |||||
| method: 'POST', | |||||
| headers: <String, dynamic>{}, | |||||
| extra: _extra, | |||||
| baseUrl: baseUrl), | |||||
| options: RequestOptions(method: 'POST', headers: <String, dynamic>{}, extra: _extra, baseUrl: baseUrl), | |||||
| data: _data); | data: _data); | ||||
| return null; | return null; | ||||
| } | } | ||||
| _data.addAll(password?.toJson() ?? <String, dynamic>{}); | _data.addAll(password?.toJson() ?? <String, dynamic>{}); | ||||
| await _dio.request<void>('/api/account/change-password', | await _dio.request<void>('/api/account/change-password', | ||||
| queryParameters: queryParameters, | queryParameters: queryParameters, | ||||
| options: RequestOptions( | |||||
| method: 'POST', | |||||
| headers: <String, dynamic>{}, | |||||
| extra: _extra, | |||||
| baseUrl: baseUrl), | |||||
| options: RequestOptions(method: 'POST', headers: <String, dynamic>{}, extra: _extra, baseUrl: baseUrl), | |||||
| data: _data); | data: _data); | ||||
| return null; | return null; | ||||
| } | } | ||||
| final queryParameters = <String, dynamic>{}; | final queryParameters = <String, dynamic>{}; | ||||
| final _data = <String, dynamic>{}; | final _data = <String, dynamic>{}; | ||||
| _data.addAll(account?.toJson() ?? <String, dynamic>{}); | _data.addAll(account?.toJson() ?? <String, dynamic>{}); | ||||
| final _result = await _dio.request<Map<String, dynamic>>( | |||||
| '/api/update-my-profile', | |||||
| final _result = await _dio.request<Map<String, dynamic>>('/api/update-my-profile', | |||||
| queryParameters: queryParameters, | queryParameters: queryParameters, | ||||
| options: RequestOptions( | |||||
| method: 'PUT', | |||||
| headers: <String, dynamic>{}, | |||||
| extra: _extra, | |||||
| baseUrl: baseUrl), | |||||
| options: RequestOptions(method: 'PUT', headers: <String, dynamic>{}, extra: _extra, baseUrl: baseUrl), | |||||
| data: _data); | data: _data); | ||||
| final value = Account.fromJson(_result.data); | final value = Account.fromJson(_result.data); | ||||
| return value; | return value; | ||||
| final newOptions = newRequestOptions(options); | final newOptions = newRequestOptions(options); | ||||
| newOptions.extra.addAll(_extra); | newOptions.extra.addAll(_extra); | ||||
| newOptions.headers.addAll(<String, dynamic>{}); | newOptions.headers.addAll(<String, dynamic>{}); | ||||
| final _result = await _dio.request<List<dynamic>>( | |||||
| '/api/list-supplies-in-warehouses/$type?q=$query', | |||||
| queryParameters: queryParameters, | |||||
| options: newOptions.merge(method: 'GET', baseUrl: baseUrl), | |||||
| data: _data); | |||||
| var value = _result.data | |||||
| .map((dynamic i) => Supply.fromJson(i as Map<String, dynamic>)) | |||||
| .toList(); | |||||
| final _result = await _dio.request<List<dynamic>>('/api/list-supplies-in-warehouses/$type?q=$query', | |||||
| queryParameters: queryParameters, options: newOptions.merge(method: 'GET', baseUrl: baseUrl), data: _data); | |||||
| var value = _result.data.map((dynamic i) => Supply.fromJson(i as Map<String, dynamic>)).toList(); | |||||
| return value; | return value; | ||||
| } | } | ||||
| final _data = token; | final _data = token; | ||||
| await _dio.request<void>('/api/update-fcmToken', | await _dio.request<void>('/api/update-fcmToken', | ||||
| queryParameters: queryParameters, | queryParameters: queryParameters, | ||||
| options: RequestOptions( | |||||
| method: 'PUT', | |||||
| headers: <String, dynamic>{}, | |||||
| extra: _extra, | |||||
| baseUrl: baseUrl), | |||||
| options: RequestOptions(method: 'PUT', headers: <String, dynamic>{}, extra: _extra, baseUrl: baseUrl), | |||||
| data: _data); | data: _data); | ||||
| return null; | return null; | ||||
| } | } | ||||
| final _data = token; | final _data = token; | ||||
| await _dio.request<void>('/api/delete-fcmToken', | await _dio.request<void>('/api/delete-fcmToken', | ||||
| queryParameters: queryParameters, | queryParameters: queryParameters, | ||||
| options: RequestOptions( | |||||
| method: 'PUT', | |||||
| headers: <String, dynamic>{}, | |||||
| extra: _extra, | |||||
| baseUrl: baseUrl), | |||||
| options: RequestOptions(method: 'PUT', headers: <String, dynamic>{}, extra: _extra, baseUrl: baseUrl), | |||||
| data: _data); | data: _data); | ||||
| return null; | return null; | ||||
| } | } | ||||
| final queryParameters = <String, dynamic>{}; | final queryParameters = <String, dynamic>{}; | ||||
| queryParameters.removeWhere((k, v) => v == null); | queryParameters.removeWhere((k, v) => v == null); | ||||
| final _data = <String, dynamic>{}; | final _data = <String, dynamic>{}; | ||||
| final _result = await _dio.request<List<dynamic>>( | |||||
| '/api/_search/tb-crops?page=$page&size=$size&sort=id,asc&query=$query', | |||||
| final _result = await _dio.request<List<dynamic>>('/api/_search/tb-crops?page=$page&size=$size&sort=id,asc&query=$query', | |||||
| queryParameters: queryParameters, | queryParameters: queryParameters, | ||||
| options: RequestOptions( | |||||
| method: 'GET', | |||||
| headers: <String, dynamic>{}, | |||||
| extra: _extra, | |||||
| baseUrl: baseUrl), | |||||
| options: RequestOptions(method: 'GET', headers: <String, dynamic>{}, extra: _extra, baseUrl: baseUrl), | |||||
| data: _data); | data: _data); | ||||
| var value = _result.data | |||||
| .map((dynamic i) => TbCropDTO.fromJson(i as Map<String, dynamic>)) | |||||
| .toList(); | |||||
| var value = _result.data.map((dynamic i) => TbCropDTO.fromJson(i as Map<String, dynamic>)).toList(); | |||||
| return value; | return value; | ||||
| } | } | ||||
| final newOptions = newRequestOptions(options); | final newOptions = newRequestOptions(options); | ||||
| newOptions.extra.addAll(_extra); | newOptions.extra.addAll(_extra); | ||||
| newOptions.headers.addAll(<String, dynamic>{}); | newOptions.headers.addAll(<String, dynamic>{}); | ||||
| final _result = await _dio.request<List<dynamic>>( | |||||
| '/api/listActivityTypesOther', | |||||
| queryParameters: queryParameters, | |||||
| options: newOptions.merge(method: 'GET', baseUrl: baseUrl), | |||||
| data: _data); | |||||
| var value = _result.data | |||||
| .map((dynamic i) => ActionType.fromJson(i as Map<String, dynamic>)) | |||||
| .toList(); | |||||
| final _result = await _dio.request<List<dynamic>>('/api/listActivityTypesOther', | |||||
| queryParameters: queryParameters, options: newOptions.merge(method: 'GET', baseUrl: baseUrl), data: _data); | |||||
| var value = _result.data.map((dynamic i) => ActionType.fromJson(i as Map<String, dynamic>)).toList(); | |||||
| return value; | return value; | ||||
| } | } | ||||
| newOptions.extra.addAll(_extra); | newOptions.extra.addAll(_extra); | ||||
| newOptions.headers.addAll(<String, dynamic>{}); | newOptions.headers.addAll(<String, dynamic>{}); | ||||
| final _result = await _dio.request<List<dynamic>>('/api/water-types', | final _result = await _dio.request<List<dynamic>>('/api/water-types', | ||||
| queryParameters: queryParameters, | |||||
| options: newOptions.merge(method: 'GET', baseUrl: baseUrl), | |||||
| data: _data); | |||||
| var value = _result.data | |||||
| .map((dynamic i) => WaterType.fromJson(i as Map<String, dynamic>)) | |||||
| .toList(); | |||||
| queryParameters: queryParameters, options: newOptions.merge(method: 'GET', baseUrl: baseUrl), data: _data); | |||||
| var value = _result.data.map((dynamic i) => WaterType.fromJson(i as Map<String, dynamic>)).toList(); | |||||
| return value; | return value; | ||||
| } | } | ||||
| newOptions.extra.addAll(_extra); | newOptions.extra.addAll(_extra); | ||||
| newOptions.headers.addAll(<String, dynamic>{}); | newOptions.headers.addAll(<String, dynamic>{}); | ||||
| final _result = await _dio.request<List<dynamic>>('/api/tb-harvests', | final _result = await _dio.request<List<dynamic>>('/api/tb-harvests', | ||||
| queryParameters: queryParameters, | |||||
| options: newOptions.merge(method: 'GET', baseUrl: baseUrl), | |||||
| data: _data); | |||||
| var value = _result.data | |||||
| .map((dynamic i) => Harvest.fromJson(i as Map<String, dynamic>)) | |||||
| .toList(); | |||||
| queryParameters: queryParameters, options: newOptions.merge(method: 'GET', baseUrl: baseUrl), data: _data); | |||||
| var value = _result.data.map((dynamic i) => Harvest.fromJson(i as Map<String, dynamic>)).toList(); | |||||
| return value; | return value; | ||||
| } | } | ||||
| final newOptions = newRequestOptions(options); | final newOptions = newRequestOptions(options); | ||||
| newOptions.extra.addAll(_extra); | newOptions.extra.addAll(_extra); | ||||
| newOptions.headers.addAll(<String, dynamic>{}); | newOptions.headers.addAll(<String, dynamic>{}); | ||||
| final _result = await _dio.request<List<dynamic>>( | |||||
| '/api/listDeviceForActivity', | |||||
| queryParameters: queryParameters, | |||||
| options: newOptions.merge(method: 'GET', baseUrl: baseUrl), | |||||
| data: _data); | |||||
| var value = _result.data | |||||
| .map((dynamic i) => Device.fromJson(i as Map<String, dynamic>)) | |||||
| .toList(); | |||||
| final _result = await _dio.request<List<dynamic>>('/api/listDeviceForActivity', | |||||
| queryParameters: queryParameters, options: newOptions.merge(method: 'GET', baseUrl: baseUrl), data: _data); | |||||
| var value = _result.data.map((dynamic i) => Device.fromJson(i as Map<String, dynamic>)).toList(); | |||||
| return value; | return value; | ||||
| } | } | ||||
| final _data = status; | final _data = status; | ||||
| await _dio.request<void>('/api/notifications/update-all', | await _dio.request<void>('/api/notifications/update-all', | ||||
| queryParameters: queryParameters, | queryParameters: queryParameters, | ||||
| options: RequestOptions( | |||||
| method: 'PUT', | |||||
| headers: <String, dynamic>{}, | |||||
| extra: _extra, | |||||
| baseUrl: baseUrl), | |||||
| options: RequestOptions(method: 'PUT', headers: <String, dynamic>{}, extra: _extra, baseUrl: baseUrl), | |||||
| data: _data); | data: _data); | ||||
| return null; | return null; | ||||
| } | } | ||||
| _data.addAll(updateNoti?.toJson() ?? <String, dynamic>{}); | _data.addAll(updateNoti?.toJson() ?? <String, dynamic>{}); | ||||
| await _dio.request<void>('/api/notifications/update', | await _dio.request<void>('/api/notifications/update', | ||||
| queryParameters: queryParameters, | queryParameters: queryParameters, | ||||
| options: RequestOptions( | |||||
| method: 'PUT', | |||||
| headers: <String, dynamic>{}, | |||||
| extra: _extra, | |||||
| baseUrl: baseUrl), | |||||
| options: RequestOptions(method: 'PUT', headers: <String, dynamic>{}, extra: _extra, baseUrl: baseUrl), | |||||
| data: _data); | data: _data); | ||||
| return null; | return null; | ||||
| } | } | ||||
| @override | @override | ||||
| Future<List<LocationUnit>> getCountries( | |||||
| {page = 0, size = 400, query = '', options}) async { | |||||
| Future<List<LocationUnit>> getCountries({page = 0, size = 400, query = '', options}) async { | |||||
| const _extra = <String, dynamic>{}; | const _extra = <String, dynamic>{}; | ||||
| final queryParameters = <String, dynamic>{}; | final queryParameters = <String, dynamic>{}; | ||||
| queryParameters.removeWhere((k, v) => v == null); | queryParameters.removeWhere((k, v) => v == null); | ||||
| final newOptions = newRequestOptions(options); | final newOptions = newRequestOptions(options); | ||||
| newOptions.extra.addAll(_extra); | newOptions.extra.addAll(_extra); | ||||
| newOptions.headers.addAll(<String, dynamic>{}); | newOptions.headers.addAll(<String, dynamic>{}); | ||||
| final _result = await _dio.request<List<dynamic>>( | |||||
| '/api/tb-countries?page=$page&size=$size&query=$query&&sort=name,ASC', | |||||
| queryParameters: queryParameters, | |||||
| options: newOptions.merge(method: 'GET', baseUrl: baseUrl), | |||||
| data: _data); | |||||
| var value = _result.data | |||||
| .map((dynamic i) => LocationUnit.fromJson(i as Map<String, dynamic>)) | |||||
| .toList(); | |||||
| final _result = await _dio.request<List<dynamic>>('/api/tb-countries?page=$page&size=$size&query=$query&&sort=name,ASC', | |||||
| queryParameters: queryParameters, options: newOptions.merge(method: 'GET', baseUrl: baseUrl), data: _data); | |||||
| var value = _result.data.map((dynamic i) => LocationUnit.fromJson(i as Map<String, dynamic>)).toList(); | |||||
| return value; | return value; | ||||
| } | } | ||||
| @override | @override | ||||
| Future<List<LocationUnit>> getProvinces(countryId, | |||||
| {page = 0, size = 20, query = '', options}) async { | |||||
| Future<List<LocationUnit>> getProvinces(countryId, {page = 0, size = 20, query = '', options}) async { | |||||
| ArgumentError.checkNotNull(countryId, 'countryId'); | ArgumentError.checkNotNull(countryId, 'countryId'); | ||||
| const _extra = <String, dynamic>{}; | const _extra = <String, dynamic>{}; | ||||
| final queryParameters = <String, dynamic>{}; | final queryParameters = <String, dynamic>{}; | ||||
| final newOptions = newRequestOptions(options); | final newOptions = newRequestOptions(options); | ||||
| newOptions.extra.addAll(_extra); | newOptions.extra.addAll(_extra); | ||||
| newOptions.headers.addAll(<String, dynamic>{}); | newOptions.headers.addAll(<String, dynamic>{}); | ||||
| final _result = await _dio.request<List<dynamic>>( | |||||
| '/api/tb-cities-by-country/$countryId?page=$page&size=$size&query=$query&&sort=name,ASC', | |||||
| queryParameters: queryParameters, | |||||
| options: newOptions.merge(method: 'GET', baseUrl: baseUrl), | |||||
| data: _data); | |||||
| var value = _result.data | |||||
| .map((dynamic i) => LocationUnit.fromJson(i as Map<String, dynamic>)) | |||||
| .toList(); | |||||
| final _result = await _dio.request<List<dynamic>>('/api/tb-cities-by-country/$countryId?page=$page&size=$size&query=$query&&sort=name,ASC', | |||||
| queryParameters: queryParameters, options: newOptions.merge(method: 'GET', baseUrl: baseUrl), data: _data); | |||||
| var value = _result.data.map((dynamic i) => LocationUnit.fromJson(i as Map<String, dynamic>)).toList(); | |||||
| return value; | return value; | ||||
| } | } | ||||
| @override | @override | ||||
| Future<List<LocationUnit>> getDistricts(provinceId, | |||||
| {page = 0, size = 20, query = '', options}) async { | |||||
| Future<List<LocationUnit>> getDistricts(provinceId, {page = 0, size = 20, query = '', options}) async { | |||||
| ArgumentError.checkNotNull(provinceId, 'provinceId'); | ArgumentError.checkNotNull(provinceId, 'provinceId'); | ||||
| const _extra = <String, dynamic>{}; | const _extra = <String, dynamic>{}; | ||||
| final queryParameters = <String, dynamic>{}; | final queryParameters = <String, dynamic>{}; | ||||
| final newOptions = newRequestOptions(options); | final newOptions = newRequestOptions(options); | ||||
| newOptions.extra.addAll(_extra); | newOptions.extra.addAll(_extra); | ||||
| newOptions.headers.addAll(<String, dynamic>{}); | newOptions.headers.addAll(<String, dynamic>{}); | ||||
| final _result = await _dio.request<List<dynamic>>( | |||||
| '/api/tb-districts-by-city/$provinceId?page=$page&size=$size&query=$query&&sort=name,ASC', | |||||
| queryParameters: queryParameters, | |||||
| options: newOptions.merge(method: 'GET', baseUrl: baseUrl), | |||||
| data: _data); | |||||
| var value = _result.data | |||||
| .map((dynamic i) => LocationUnit.fromJson(i as Map<String, dynamic>)) | |||||
| .toList(); | |||||
| final _result = await _dio.request<List<dynamic>>('/api/tb-districts-by-city/$provinceId?page=$page&size=$size&query=$query&&sort=name,ASC', | |||||
| queryParameters: queryParameters, options: newOptions.merge(method: 'GET', baseUrl: baseUrl), data: _data); | |||||
| var value = _result.data.map((dynamic i) => LocationUnit.fromJson(i as Map<String, dynamic>)).toList(); | |||||
| return value; | return value; | ||||
| } | } | ||||
| @override | @override | ||||
| Future<List<LocationUnit>> getWards(districtId, | |||||
| {page = 0, size = 20, query = '', options}) async { | |||||
| Future<List<LocationUnit>> getWards(districtId, {page = 0, size = 20, query = '', options}) async { | |||||
| ArgumentError.checkNotNull(districtId, 'districtId'); | ArgumentError.checkNotNull(districtId, 'districtId'); | ||||
| const _extra = <String, dynamic>{}; | const _extra = <String, dynamic>{}; | ||||
| final queryParameters = <String, dynamic>{}; | final queryParameters = <String, dynamic>{}; | ||||
| final newOptions = newRequestOptions(options); | final newOptions = newRequestOptions(options); | ||||
| newOptions.extra.addAll(_extra); | newOptions.extra.addAll(_extra); | ||||
| newOptions.headers.addAll(<String, dynamic>{}); | newOptions.headers.addAll(<String, dynamic>{}); | ||||
| final _result = await _dio.request<List<dynamic>>( | |||||
| '/api/tb-wards-by-district/$districtId?page=$page&size=$size&query=$query&&sort=name,ASC', | |||||
| queryParameters: queryParameters, | |||||
| options: newOptions.merge(method: 'GET', baseUrl: baseUrl), | |||||
| data: _data); | |||||
| var value = _result.data | |||||
| .map((dynamic i) => LocationUnit.fromJson(i as Map<String, dynamic>)) | |||||
| .toList(); | |||||
| final _result = await _dio.request<List<dynamic>>('/api/tb-wards-by-district/$districtId?page=$page&size=$size&query=$query&&sort=name,ASC', | |||||
| queryParameters: queryParameters, options: newOptions.merge(method: 'GET', baseUrl: baseUrl), data: _data); | |||||
| var value = _result.data.map((dynamic i) => LocationUnit.fromJson(i as Map<String, dynamic>)).toList(); | |||||
| return value; | return value; | ||||
| } | } | ||||
| final queryParameters = <String, dynamic>{}; | final queryParameters = <String, dynamic>{}; | ||||
| queryParameters.removeWhere((k, v) => v == null); | queryParameters.removeWhere((k, v) => v == null); | ||||
| final _data = <String, dynamic>{}; | final _data = <String, dynamic>{}; | ||||
| final _result = await _dio.request<Map<String, dynamic>>( | |||||
| '/api/tb-crops-detail-for-app/$cropId?page=$page&size=$size&sort=executeDate,DESC', | |||||
| final _result = await _dio.request<Map<String, dynamic>>('/api/tb-crops-detail-for-app/$cropId?page=$page&size=$size&sort=executeDate,DESC', | |||||
| queryParameters: queryParameters, | queryParameters: queryParameters, | ||||
| options: RequestOptions( | |||||
| method: 'GET', | |||||
| headers: <String, dynamic>{}, | |||||
| extra: _extra, | |||||
| baseUrl: baseUrl), | |||||
| options: RequestOptions(method: 'GET', headers: <String, dynamic>{}, extra: _extra, baseUrl: baseUrl), | |||||
| data: _data); | data: _data); | ||||
| final value = CropPlot.fromJson(_result.data); | final value = CropPlot.fromJson(_result.data); | ||||
| return value; | return value; | ||||
| final queryParameters = <String, dynamic>{}; | final queryParameters = <String, dynamic>{}; | ||||
| queryParameters.removeWhere((k, v) => v == null); | queryParameters.removeWhere((k, v) => v == null); | ||||
| final _data = <String, dynamic>{}; | final _data = <String, dynamic>{}; | ||||
| final _result = await _dio.request<Map<String, dynamic>>( | |||||
| '/api/tb-crops-scan-qrCode/$cropCode?page=$page&size=$size&sort=executeDate,DESC', | |||||
| final _result = await _dio.request<Map<String, dynamic>>('/api/tb-crops-scan-qrCode/$cropCode?page=$page&size=$size&sort=executeDate,DESC', | |||||
| queryParameters: queryParameters, | queryParameters: queryParameters, | ||||
| options: RequestOptions( | |||||
| method: 'GET', | |||||
| headers: <String, dynamic>{}, | |||||
| extra: _extra, | |||||
| baseUrl: baseUrl), | |||||
| options: RequestOptions(method: 'GET', headers: <String, dynamic>{}, extra: _extra, baseUrl: baseUrl), | |||||
| data: _data); | data: _data); | ||||
| final value = CropPlot.fromJson(_result.data); | final value = CropPlot.fromJson(_result.data); | ||||
| return value; | return value; | ||||
| _data.addAll(crop?.toJson() ?? <String, dynamic>{}); | _data.addAll(crop?.toJson() ?? <String, dynamic>{}); | ||||
| await _dio.request<void>('/api/tb-crops', | await _dio.request<void>('/api/tb-crops', | ||||
| queryParameters: queryParameters, | queryParameters: queryParameters, | ||||
| options: RequestOptions( | |||||
| method: 'PUT', | |||||
| headers: <String, dynamic>{}, | |||||
| extra: _extra, | |||||
| baseUrl: baseUrl), | |||||
| options: RequestOptions(method: 'PUT', headers: <String, dynamic>{}, extra: _extra, baseUrl: baseUrl), | |||||
| data: _data); | data: _data); | ||||
| return null; | return null; | ||||
| } | } | ||||
| final queryParameters = <String, dynamic>{}; | final queryParameters = <String, dynamic>{}; | ||||
| queryParameters.removeWhere((k, v) => v == null); | queryParameters.removeWhere((k, v) => v == null); | ||||
| final _data = <String, dynamic>{}; | final _data = <String, dynamic>{}; | ||||
| final _result = await _dio.request<List<dynamic>>( | |||||
| '/api/listDeviceOfUserCustomers?query=$query', | |||||
| final _result = await _dio.request<List<dynamic>>('/api/listDeviceOfUserCustomers?query=$query', | |||||
| queryParameters: queryParameters, | queryParameters: queryParameters, | ||||
| options: RequestOptions( | |||||
| method: 'GET', | |||||
| headers: <String, dynamic>{}, | |||||
| extra: _extra, | |||||
| baseUrl: baseUrl), | |||||
| options: RequestOptions(method: 'GET', headers: <String, dynamic>{}, extra: _extra, baseUrl: baseUrl), | |||||
| data: _data); | data: _data); | ||||
| var value = _result.data | |||||
| .map((dynamic i) => Device.fromJson(i as Map<String, dynamic>)) | |||||
| .toList(); | |||||
| var value = _result.data.map((dynamic i) => Device.fromJson(i as Map<String, dynamic>)).toList(); | |||||
| return value; | return value; | ||||
| } | } | ||||
| @override | @override | ||||
| Future<List<EnvironmentParameter>> getEnvironmentParameters(cropId, | |||||
| {page = 0, size = 20}) async { | |||||
| Future<List<EnvironmentParameter>> getEnvironmentParameters(cropId, {page = 0, size = 20}) async { | |||||
| ArgumentError.checkNotNull(cropId, 'cropId'); | ArgumentError.checkNotNull(cropId, 'cropId'); | ||||
| const _extra = <String, dynamic>{}; | const _extra = <String, dynamic>{}; | ||||
| final queryParameters = <String, dynamic>{}; | final queryParameters = <String, dynamic>{}; | ||||
| queryParameters.removeWhere((k, v) => v == null); | queryParameters.removeWhere((k, v) => v == null); | ||||
| final _data = <String, dynamic>{}; | final _data = <String, dynamic>{}; | ||||
| final _result = await _dio.request<List<dynamic>>( | |||||
| '/api/list-environment-updates-display/$cropId?page=$page&size=$size', | |||||
| final _result = await _dio.request<List<dynamic>>('/api/list-environment-updates-display/$cropId?page=$page&size=$size', | |||||
| queryParameters: queryParameters, | queryParameters: queryParameters, | ||||
| options: RequestOptions( | |||||
| method: 'GET', | |||||
| headers: <String, dynamic>{}, | |||||
| extra: _extra, | |||||
| baseUrl: baseUrl), | |||||
| options: RequestOptions(method: 'GET', headers: <String, dynamic>{}, extra: _extra, baseUrl: baseUrl), | |||||
| data: _data); | data: _data); | ||||
| var value = _result.data | |||||
| .map((dynamic i) => | |||||
| EnvironmentParameter.fromJson(i as Map<String, dynamic>)) | |||||
| .toList(); | |||||
| var value = _result.data.map((dynamic i) => EnvironmentParameter.fromJson(i as Map<String, dynamic>)).toList(); | |||||
| return value; | return value; | ||||
| } | } | ||||
| final newOptions = newRequestOptions(options); | final newOptions = newRequestOptions(options); | ||||
| newOptions.extra.addAll(_extra); | newOptions.extra.addAll(_extra); | ||||
| newOptions.headers.addAll(<String, dynamic>{}); | newOptions.headers.addAll(<String, dynamic>{}); | ||||
| final _result = await _dio.request<Map<String, dynamic>>( | |||||
| '/api/display-object-param-dynamic-form/$idAction', | |||||
| queryParameters: queryParameters, | |||||
| options: newOptions.merge(method: 'GET', baseUrl: baseUrl), | |||||
| data: _data); | |||||
| final _result = await _dio.request<Map<String, dynamic>>('/api/display-object-param-dynamic-form/$idAction', | |||||
| queryParameters: queryParameters, options: newOptions.merge(method: 'GET', baseUrl: baseUrl), data: _data); | |||||
| final value = ActionUIForm.fromJson(_result.data); | final value = ActionUIForm.fromJson(_result.data); | ||||
| return value; | return value; | ||||
| } | } | ||||
| @override | @override | ||||
| Future<RequestActivity> getDetailActivityCommon( | |||||
| {actionType, activityId}) async { | |||||
| Future<RequestActivity> getDetailActivityCommon({actionType, activityId}) async { | |||||
| ArgumentError.checkNotNull(actionType, 'actionType'); | ArgumentError.checkNotNull(actionType, 'actionType'); | ||||
| ArgumentError.checkNotNull(activityId, 'activityId'); | ArgumentError.checkNotNull(activityId, 'activityId'); | ||||
| const _extra = <String, dynamic>{}; | const _extra = <String, dynamic>{}; | ||||
| final queryParameters = <String, dynamic>{}; | final queryParameters = <String, dynamic>{}; | ||||
| queryParameters.removeWhere((k, v) => v == null); | queryParameters.removeWhere((k, v) => v == null); | ||||
| final _data = <String, dynamic>{}; | final _data = <String, dynamic>{}; | ||||
| final _result = await _dio.request<Map<String, dynamic>>( | |||||
| '/api/get-detail-common-activity/$actionType/$activityId', | |||||
| final _result = await _dio.request<Map<String, dynamic>>('/api/get-detail-common-activity/$actionType/$activityId', | |||||
| queryParameters: queryParameters, | queryParameters: queryParameters, | ||||
| options: RequestOptions( | |||||
| method: 'GET', | |||||
| headers: <String, dynamic>{}, | |||||
| extra: _extra, | |||||
| baseUrl: baseUrl), | |||||
| options: RequestOptions(method: 'GET', headers: <String, dynamic>{}, extra: _extra, baseUrl: baseUrl), | |||||
| data: _data); | data: _data); | ||||
| final value = RequestActivity.fromJson(_result.data); | final value = RequestActivity.fromJson(_result.data); | ||||
| return value; | return value; |
| import 'package:barcode_scan/barcode_scan.dart'; | |||||
| import 'package:camera/camera.dart'; | import 'package:camera/camera.dart'; | ||||
| import 'package:farm_tpf/presentation/screens/plot_detail/sc_plot_detail.dart'; | import 'package:farm_tpf/presentation/screens/plot_detail/sc_plot_detail.dart'; | ||||
| import 'package:flutter/material.dart'; | import 'package:flutter/material.dart'; | ||||
| // Or do other work. | // Or do other work. | ||||
| } | } | ||||
| Future scan(BuildContext context) async { | |||||
| var _aspectTolerance = 0.00; | |||||
| var _selectedCamera = -1; | |||||
| var _useAutoFocus = true; | |||||
| var _autoEnableFlash = false; | |||||
| var repository = Repository(); | |||||
| try { | |||||
| var options = ScanOptions( | |||||
| strings: { | |||||
| "cancel": "Huỷ", | |||||
| "flash_on": "Bật flash", | |||||
| "flash_off": "Tắt flash", | |||||
| }, | |||||
| useCamera: _selectedCamera, | |||||
| autoEnableFlash: _autoEnableFlash, | |||||
| android: AndroidOptions( | |||||
| aspectTolerance: _aspectTolerance, | |||||
| useAutoFocus: _useAutoFocus, | |||||
| ), | |||||
| ); | |||||
| var result = await BarcodeScanner.scan(options: options); | |||||
| print(result.toString()); | |||||
| if (result.type == ResultType.Cancelled) { | |||||
| print("canncel"); | |||||
| } else if (result.type == ResultType.Error) { | |||||
| print("error"); | |||||
| } else { | |||||
| print("show check crop"); | |||||
| _showAlertCheckCropCode(context, result.rawContent, repository); | |||||
| } | |||||
| } on PlatformException catch (e) { | |||||
| print("error: ${e.message}"); | |||||
| } | |||||
| } | |||||
| // Future scan(BuildContext context) async { | |||||
| // var _aspectTolerance = 0.00; | |||||
| // var _selectedCamera = -1; | |||||
| // var _useAutoFocus = true; | |||||
| // var _autoEnableFlash = false; | |||||
| // var repository = Repository(); | |||||
| // try { | |||||
| // var options = ScanOptions( | |||||
| // strings: { | |||||
| // "cancel": "Huỷ", | |||||
| // "flash_on": "Bật flash", | |||||
| // "flash_off": "Tắt flash", | |||||
| // }, | |||||
| // useCamera: _selectedCamera, | |||||
| // autoEnableFlash: _autoEnableFlash, | |||||
| // android: AndroidOptions( | |||||
| // aspectTolerance: _aspectTolerance, | |||||
| // useAutoFocus: _useAutoFocus, | |||||
| // ), | |||||
| // ); | |||||
| // var result = await BarcodeScanner.scan(options: options); | |||||
| // print(result.toString()); | |||||
| // if (result.type == ResultType.Cancelled) { | |||||
| // print("canncel"); | |||||
| // } else if (result.type == ResultType.Error) { | |||||
| // print("error"); | |||||
| // } else { | |||||
| // print("show check crop"); | |||||
| // _showAlertCheckCropCode(context, result.rawContent, repository); | |||||
| // } | |||||
| // } on PlatformException catch (e) { | |||||
| // print("error: ${e.message}"); | |||||
| // } | |||||
| // } | |||||
| _showAlertCheckCropCode( | |||||
| BuildContext context, String cropCode, Repository repository) async { | |||||
| Get.defaultDialog( | |||||
| title: "Kiểm tra thông tin lô ....", | |||||
| middleText: "", | |||||
| content: CircularProgressIndicator()); | |||||
| _showAlertCheckCropCode(BuildContext context, String cropCode, Repository repository) async { | |||||
| Get.defaultDialog(title: "Kiểm tra thông tin lô ....", middleText: "", content: CircularProgressIndicator()); | |||||
| try { | try { | ||||
| await repository | |||||
| .getPlotDetailByCode(cropCode, page: 1, size: 1) | |||||
| .then((value) { | |||||
| await repository.getPlotDetailByCode(cropCode, page: 1, size: 1).then((value) { | |||||
| print("ok"); | print("ok"); | ||||
| if (Get.isDialogOpen) Get.back(); | if (Get.isDialogOpen) Get.back(); | ||||
| Get.to(PlotDetailScreen( | |||||
| cropId: value.tbCropDTO.id, | |||||
| cropType: value.tbCropDTO.tbCropTypeId, | |||||
| initialIndex: 0)); | |||||
| Get.to(PlotDetailScreen(cropId: value.tbCropDTO.id, cropType: value.tbCropDTO.tbCropTypeId, initialIndex: 0)); | |||||
| }).catchError((onError) { | }).catchError((onError) { | ||||
| Utils.showDialog( | Utils.showDialog( | ||||
| title: "Không tìm thấy lô", | title: "Không tìm thấy lô", | ||||
| textCancel: "Huỷ", | textCancel: "Huỷ", | ||||
| onConfirm: () { | onConfirm: () { | ||||
| Get.back(); | Get.back(); | ||||
| scan(context); | |||||
| // scan(context); | |||||
| }); | }); | ||||
| }); | }); | ||||
| } catch (e) { | } catch (e) { | ||||
| textCancel: "Huỷ", | textCancel: "Huỷ", | ||||
| onConfirm: () { | onConfirm: () { | ||||
| Get.back(); | Get.back(); | ||||
| scan(context); | |||||
| // scan(context); | |||||
| }); | }); | ||||
| } | } | ||||
| } | } |
| import 'package:file_picker/file_picker.dart'; | import 'package:file_picker/file_picker.dart'; | ||||
| import 'package:flutter/material.dart'; | import 'package:flutter/material.dart'; | ||||
| import 'package:get/get.dart'; | import 'package:get/get.dart'; | ||||
| import 'package:video_player/video_player.dart'; | |||||
| import 'package:path_provider/path_provider.dart'; | import 'package:path_provider/path_provider.dart'; | ||||
| class CameraHelper extends StatefulWidget { | class CameraHelper extends StatefulWidget { | ||||
| throw ArgumentError('Unknown lens direction'); | throw ArgumentError('Unknown lens direction'); | ||||
| } | } | ||||
| void logError(String code, String message) => | |||||
| print('Error: $code\nError Message: $message'); | |||||
| void logError(String code, String message) => print('Error: $code\nError Message: $message'); | |||||
| class _CameraHelperState extends State<CameraHelper> | |||||
| with WidgetsBindingObserver { | |||||
| class _CameraHelperState extends State<CameraHelper> with WidgetsBindingObserver { | |||||
| CameraController controller; | CameraController controller; | ||||
| String imagePath; | String imagePath; | ||||
| String videoPath; | String videoPath; | ||||
| VideoPlayerController videoController; | |||||
| VoidCallback videoPlayerListener; | VoidCallback videoPlayerListener; | ||||
| bool enableAudio = true; | bool enableAudio = true; | ||||
| int indexCamera = 0; | int indexCamera = 0; | ||||
| @override | @override | ||||
| void initState() { | void initState() { | ||||
| super.initState(); | super.initState(); | ||||
| controller = | |||||
| CameraController(cameras[indexCamera], ResolutionPreset.medium); | |||||
| controller = CameraController(cameras[indexCamera], ResolutionPreset.medium); | |||||
| controller.initialize().then((_) { | controller.initialize().then((_) { | ||||
| if (!mounted) { | if (!mounted) { | ||||
| return; | return; | ||||
| decoration: BoxDecoration( | decoration: BoxDecoration( | ||||
| color: Colors.black, | color: Colors.black, | ||||
| border: Border.all( | border: Border.all( | ||||
| color: | |||||
| controller != null && controller.value.isRecordingVideo | |||||
| ? Colors.redAccent | |||||
| : Colors.grey, | |||||
| width: | |||||
| controller != null && controller.value.isRecordingVideo | |||||
| ? 1.0 | |||||
| : 0.0, | |||||
| color: controller != null && controller.value.isRecordingVideo ? Colors.redAccent : Colors.grey, | |||||
| width: controller != null && controller.value.isRecordingVideo ? 1.0 : 0.0, | |||||
| ), | ), | ||||
| ), | ), | ||||
| ), | ), | ||||
| size: 30, | size: 30, | ||||
| ), | ), | ||||
| color: Colors.blue, | color: Colors.blue, | ||||
| onPressed: controller != null && | |||||
| controller.value.isInitialized && | |||||
| !controller.value.isRecordingVideo | |||||
| ? onTakePictureButtonPressed | |||||
| : null, | |||||
| onPressed: controller != null && controller.value.isInitialized && !controller.value.isRecordingVideo ? onTakePictureButtonPressed : null, | |||||
| ), | ), | ||||
| IconButton( | IconButton( | ||||
| icon: const Icon(Icons.videocam, size: 35), | icon: const Icon(Icons.videocam, size: 35), | ||||
| color: Colors.blue, | color: Colors.blue, | ||||
| onPressed: controller != null && | |||||
| controller.value.isInitialized && | |||||
| !controller.value.isRecordingVideo | |||||
| ? onVideoRecordButtonPressed | |||||
| : null, | |||||
| onPressed: controller != null && controller.value.isInitialized && !controller.value.isRecordingVideo ? onVideoRecordButtonPressed : null, | |||||
| ), | ), | ||||
| IconButton( | IconButton( | ||||
| icon: controller != null && controller.value.isRecordingPaused | |||||
| ? Icon(Icons.play_arrow) | |||||
| : Icon(Icons.pause), | |||||
| icon: controller != null && controller.value.isRecordingPaused ? Icon(Icons.play_arrow) : Icon(Icons.pause), | |||||
| color: Colors.blue, | color: Colors.blue, | ||||
| onPressed: controller != null && | |||||
| controller.value.isInitialized && | |||||
| controller.value.isRecordingVideo | |||||
| ? (controller != null && controller.value.isRecordingPaused | |||||
| ? onResumeButtonPressed | |||||
| : onPauseButtonPressed) | |||||
| onPressed: controller != null && controller.value.isInitialized && controller.value.isRecordingVideo | |||||
| ? (controller != null && controller.value.isRecordingPaused ? onResumeButtonPressed : onPauseButtonPressed) | |||||
| : null, | : null, | ||||
| ), | ), | ||||
| IconButton( | IconButton( | ||||
| icon: const Icon(Icons.stop), | icon: const Icon(Icons.stop), | ||||
| color: Colors.red, | color: Colors.red, | ||||
| onPressed: controller != null && | |||||
| controller.value.isInitialized && | |||||
| controller.value.isRecordingVideo | |||||
| ? onStopButtonPressed | |||||
| : null, | |||||
| onPressed: controller != null && controller.value.isInitialized && controller.value.isRecordingVideo ? onStopButtonPressed : null, | |||||
| ) | ) | ||||
| ], | ], | ||||
| ); | ); | ||||
| if (cameras.isEmpty) { | if (cameras.isEmpty) { | ||||
| return const Text('Không có camera'); | return const Text('Không có camera'); | ||||
| } else { | } else { | ||||
| bool disableSwitch = | |||||
| controller != null && controller.value.isRecordingVideo; | |||||
| bool disableSwitch = controller != null && controller.value.isRecordingVideo; | |||||
| if (indexCamera == cameras.length - 1) { | if (indexCamera == cameras.length - 1) { | ||||
| indexCamera = 0; | indexCamera = 0; | ||||
| } else { | } else { | ||||
| if (mounted) { | if (mounted) { | ||||
| setState(() { | setState(() { | ||||
| imagePath = filePath; | imagePath = filePath; | ||||
| videoController?.dispose(); | |||||
| videoController = null; | |||||
| // videoController?.dispose(); | |||||
| // videoController = null; | |||||
| }); | }); | ||||
| if (filePath != null) { | if (filePath != null) { | ||||
| print('Picture saved to $filePath'); | print('Picture saved to $filePath'); |
| import 'dart:io'; | import 'dart:io'; | ||||
| import 'package:flutter/material.dart'; | import 'package:flutter/material.dart'; | ||||
| import 'package:video_player/video_player.dart'; | |||||
| class VideoWidget extends StatefulWidget { | class VideoWidget extends StatefulWidget { | ||||
| final bool play; | final bool play; | ||||
| final bool isServerFile; | final bool isServerFile; | ||||
| final String pathFile; | final String pathFile; | ||||
| const VideoWidget( | |||||
| {Key key, | |||||
| @required this.pathFile, | |||||
| @required this.play, | |||||
| @required this.isServerFile}) | |||||
| : super(key: key); | |||||
| const VideoWidget({Key key, @required this.pathFile, @required this.play, @required this.isServerFile}) : super(key: key); | |||||
| @override | @override | ||||
| _VideoWidgetState createState() => _VideoWidgetState(); | _VideoWidgetState createState() => _VideoWidgetState(); | ||||
| } | } | ||||
| class _VideoWidgetState extends State<VideoWidget> { | class _VideoWidgetState extends State<VideoWidget> { | ||||
| VideoPlayerController videoPlayerController; | |||||
| Future<void> _initializeVideoPlayerFuture; | |||||
| // VideoPlayerController videoPlayerController; | |||||
| // Future<void> _initializeVideoPlayerFuture; | |||||
| @override | @override | ||||
| void initState() { | void initState() { | ||||
| super.initState(); | super.initState(); | ||||
| if (widget.isServerFile) { | |||||
| videoPlayerController = VideoPlayerController.network(widget.pathFile); | |||||
| } else { | |||||
| videoPlayerController = VideoPlayerController.file(File(widget.pathFile)); | |||||
| } | |||||
| // if (widget.isServerFile) { | |||||
| // videoPlayerController = VideoPlayerController.network(widget.pathFile); | |||||
| // } else { | |||||
| // videoPlayerController = VideoPlayerController.file(File(widget.pathFile)); | |||||
| // } | |||||
| _initializeVideoPlayerFuture = videoPlayerController.initialize().then((_) { | |||||
| // Ensure the first frame is shown after the video is initialized, even before the play button has been pressed. | |||||
| videoPlayerController.play(); | |||||
| videoPlayerController.setVolume(0.0); | |||||
| Timer.periodic(Duration(seconds: 1), (_) { | |||||
| videoPlayerController.pause(); | |||||
| }); | |||||
| setState(() {}); | |||||
| }); | |||||
| // _initializeVideoPlayerFuture = videoPlayerController.initialize().then((_) { | |||||
| // // Ensure the first frame is shown after the video is initialized, even before the play button has been pressed. | |||||
| // videoPlayerController.play(); | |||||
| // videoPlayerController.setVolume(0.0); | |||||
| // Timer.periodic(Duration(seconds: 1), (_) { | |||||
| // videoPlayerController.pause(); | |||||
| // }); | |||||
| // setState(() {}); | |||||
| // }); | |||||
| } | } | ||||
| @override | @override | ||||
| void dispose() { | void dispose() { | ||||
| videoPlayerController.dispose(); | |||||
| // videoPlayerController.dispose(); | |||||
| print("dispose video item"); | print("dispose video item"); | ||||
| super.dispose(); | super.dispose(); | ||||
| } | } | ||||
| @override | @override | ||||
| Widget build(BuildContext context) { | Widget build(BuildContext context) { | ||||
| return FutureBuilder( | |||||
| future: _initializeVideoPlayerFuture, | |||||
| builder: (context, snapshot) { | |||||
| if (snapshot.connectionState == ConnectionState.done) { | |||||
| return new Container( | |||||
| child: Container( | |||||
| key: new PageStorageKey(widget.pathFile), | |||||
| child: Container( | |||||
| padding: EdgeInsets.all(1), | |||||
| width: 100, | |||||
| height: 100, | |||||
| decoration: BoxDecoration( | |||||
| color: Colors.white, | |||||
| border: Border.all(color: Colors.red), | |||||
| borderRadius: BorderRadius.all(Radius.circular(8.0))), | |||||
| child: VideoPlayer(videoPlayerController), | |||||
| ), | |||||
| ), | |||||
| ); | |||||
| } else { | |||||
| return Center( | |||||
| child: CircularProgressIndicator(), | |||||
| ); | |||||
| } | |||||
| }, | |||||
| return Container( | |||||
| child: Text('VideoWidget'), | |||||
| ); | ); | ||||
| // return FutureBuilder( | |||||
| // future: _initializeVideoPlayerFuture, | |||||
| // builder: (context, snapshot) { | |||||
| // if (snapshot.connectionState == ConnectionState.done) { | |||||
| // return new Container( | |||||
| // child: Container( | |||||
| // key: new PageStorageKey(widget.pathFile), | |||||
| // child: Container( | |||||
| // padding: EdgeInsets.all(1), | |||||
| // width: 100, | |||||
| // height: 100, | |||||
| // decoration: BoxDecoration( | |||||
| // color: Colors.white, | |||||
| // border: Border.all(color: Colors.red), | |||||
| // borderRadius: BorderRadius.all(Radius.circular(8.0))), | |||||
| // child: VideoPlayer(videoPlayerController), | |||||
| // ), | |||||
| // ), | |||||
| // ); | |||||
| // } else { | |||||
| // return Center( | |||||
| // child: CircularProgressIndicator(), | |||||
| // ); | |||||
| // } | |||||
| // }, | |||||
| // ); | |||||
| } | } | ||||
| } | } |
| var client; | var client; | ||||
| 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.icDevice, title: 'Thiết bị', index: TabBarIndex.device), | |||||
| 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.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.icPerson, title: 'Cá nhân', index: TabBarIndex.account) | |||||
| TabbarItem(icon: AppIcons.icNotification, title: 'Thông báo', index: TabBarIndex.notification), | |||||
| TabbarItem(icon: AppIcons.icPerson, title: 'Cá nhân', index: TabBarIndex.account) | |||||
| ]; | ]; | ||||
| Future<Null> getSharedPrefs() async { | Future<Null> getSharedPrefs() async { | ||||
| options.headers["Authorization"] = "Bearer $token"; | options.headers["Authorization"] = "Bearer $token"; | ||||
| client = Dio(options); | client = Dio(options); | ||||
| if (Platform.isIOS) { | if (Platform.isIOS) { | ||||
| _firebaseMessaging | |||||
| .requestNotificationPermissions(IosNotificationSettings()); | |||||
| _firebaseMessaging.requestNotificationPermissions(IosNotificationSettings()); | |||||
| } | } | ||||
| _firebaseMessaging.configure( | _firebaseMessaging.configure( | ||||
| onMessage: (Map<String, dynamic> message) async { | onMessage: (Map<String, dynamic> message) async { | ||||
| _notificationNavigateOnFCM(message); | _notificationNavigateOnFCM(message); | ||||
| }, | }, | ||||
| ); | ); | ||||
| _firebaseMessaging.requestNotificationPermissions( | |||||
| const IosNotificationSettings( | |||||
| sound: true, badge: true, alert: true, provisional: true)); | |||||
| _firebaseMessaging.onIosSettingsRegistered | |||||
| .listen((IosNotificationSettings settings) { | |||||
| _firebaseMessaging.requestNotificationPermissions(const IosNotificationSettings(sound: true, badge: true, alert: true, provisional: true)); | |||||
| _firebaseMessaging.onIosSettingsRegistered.listen((IosNotificationSettings settings) { | |||||
| print("Settings registered: $settings"); | print("Settings registered: $settings"); | ||||
| }); | }); | ||||
| if (pushkey?.isEmpty ?? true) { | if (pushkey?.isEmpty ?? true) { | ||||
| builder: (context, AsyncSnapshot<dynamic> snapshot) { | builder: (context, AsyncSnapshot<dynamic> snapshot) { | ||||
| if (snapshot.hasData) { | if (snapshot.hasData) { | ||||
| var noti = snapshot.data as NotificationObjectDTO; | var noti = snapshot.data as NotificationObjectDTO; | ||||
| var unreadNoti = | |||||
| noti.numberUnreadTotal > 99 ? '99+' : '${noti.numberUnreadTotal}'; | |||||
| var unreadNoti = noti.numberUnreadTotal > 99 ? '99+' : '${noti.numberUnreadTotal}'; | |||||
| return Text( | return Text( | ||||
| '$unreadNoti', | '$unreadNoti', | ||||
| softWrap: true, | softWrap: true, | ||||
| bottomNavigationBar: Container( | bottomNavigationBar: Container( | ||||
| padding: EdgeInsets.all(4), | padding: EdgeInsets.all(4), | ||||
| height: 70, | height: 70, | ||||
| decoration: BoxDecoration( | |||||
| color: Colors.white, | |||||
| border: Border( | |||||
| top: BorderSide(color: Colors.grey, width: 0.35))), | |||||
| decoration: BoxDecoration(color: Colors.white, border: Border(top: BorderSide(color: Colors.grey, width: 0.35))), | |||||
| child: GetBuilder<TabbarSelected>(builder: (tabbarSelected) { | child: GetBuilder<TabbarSelected>(builder: (tabbarSelected) { | ||||
| return Center( | return Center( | ||||
| child: ListView.builder( | child: ListView.builder( | ||||
| badgeContent: textCountNoti(), | badgeContent: textCountNoti(), | ||||
| shape: BadgeShape.circle, | shape: BadgeShape.circle, | ||||
| badgeColor: Colors.red, | badgeColor: Colors.red, | ||||
| position: BadgePosition( | |||||
| top: -15, start: 10), | |||||
| position: BadgePosition(top: -15, start: 10), | |||||
| child: SvgPicture.asset( | child: SvgPicture.asset( | ||||
| itemsTabbar[index].icon, | itemsTabbar[index].icon, | ||||
| width: 24, | width: 24, | ||||
| height: 24, | height: 24, | ||||
| color: (tabbarSelected.index == | |||||
| itemsTabbar[index] | |||||
| .index) | |||||
| ? AppColors.YELLOW | |||||
| : AppColors.GRAY1, | |||||
| color: (tabbarSelected.index == itemsTabbar[index].index) ? AppColors.YELLOW : AppColors.GRAY1, | |||||
| ), | ), | ||||
| ) | ) | ||||
| : SvgPicture.asset( | : SvgPicture.asset( | ||||
| itemsTabbar[index].icon, | itemsTabbar[index].icon, | ||||
| width: 24, | width: 24, | ||||
| height: 24, | height: 24, | ||||
| color: (tabbarSelected.index == | |||||
| itemsTabbar[index].index) | |||||
| ? AppColors.YELLOW | |||||
| : AppColors.GRAY1, | |||||
| color: (tabbarSelected.index == itemsTabbar[index].index) ? AppColors.YELLOW : AppColors.GRAY1, | |||||
| ), | ), | ||||
| Flexible( | Flexible( | ||||
| child: Text( | child: Text( | ||||
| itemsTabbar[index].title, | itemsTabbar[index].title, | ||||
| style: TextStyle( | style: TextStyle( | ||||
| color: (tabbarSelected.index == | |||||
| itemsTabbar[index].index) | |||||
| ? AppColors.DEFAULT | |||||
| : Colors.grey, | |||||
| color: (tabbarSelected.index == itemsTabbar[index].index) ? AppColors.DEFAULT : Colors.grey, | |||||
| fontSize: 9), | fontSize: 9), | ||||
| ), | ), | ||||
| ) | ) | ||||
| //Open scan qr code when tap icon in tabbar | //Open scan qr code when tap icon in tabbar | ||||
| if (index == 2) { | if (index == 2) { | ||||
| changeTabbar.changeIndex(changeTabbar.index); | changeTabbar.changeIndex(changeTabbar.index); | ||||
| scan(context); | |||||
| // scan(context); | |||||
| } else { | } else { | ||||
| changeTabbar | |||||
| .changeIndex(itemsTabbar[index].index); | |||||
| changeTabbar.changeIndex(itemsTabbar[index].index); | |||||
| } | } | ||||
| }, | }, | ||||
| ); | ); |
| static int kExpiredTime = 518400000; //6* 24 * 60 * 60 * 1000; 6days | static int kExpiredTime = 518400000; //6* 24 * 60 * 60 * 1000; 6days | ||||
| static int kFileSize = 1000000; //1M = 1000.000 bytes | static int kFileSize = 1000000; //1M = 1000.000 bytes | ||||
| static int kMaxAgeCache = 7; // 7days | static int kMaxAgeCache = 7; // 7days | ||||
| static const String baseUrl = "https://smartfarm.aztrace.vn"; | |||||
| static const String baseImageUrl = "https://smartfarm.aztrace.vn/upload/"; | |||||
| static const String baseUrl = "https://tpf.aztrace.vn"; | |||||
| static const String baseImageUrl = "https://tpf.aztrace.vn/upload/"; | |||||
| static RegExp regExpDecimal = RegExp("[0-9.]"); | static RegExp regExpDecimal = RegExp("[0-9.]"); | ||||
| static const String supplyTypeSeed = "GIONG"; | static const String supplyTypeSeed = "GIONG"; |
| name: async | name: async | ||||
| url: "https://pub.dartlang.org" | url: "https://pub.dartlang.org" | ||||
| source: hosted | source: hosted | ||||
| version: "2.5.0-nullsafety.1" | |||||
| version: "2.8.1" | |||||
| auto_size_text: | auto_size_text: | ||||
| dependency: "direct main" | dependency: "direct main" | ||||
| description: | description: | ||||
| url: "https://pub.dartlang.org" | url: "https://pub.dartlang.org" | ||||
| source: hosted | source: hosted | ||||
| version: "1.1.6" | version: "1.1.6" | ||||
| barcode_scan: | |||||
| dependency: "direct main" | |||||
| description: | |||||
| name: barcode_scan | |||||
| url: "https://pub.dartlang.org" | |||||
| source: hosted | |||||
| version: "3.0.1" | |||||
| bloc: | bloc: | ||||
| dependency: transitive | dependency: transitive | ||||
| description: | description: | ||||
| name: boolean_selector | name: boolean_selector | ||||
| url: "https://pub.dartlang.org" | url: "https://pub.dartlang.org" | ||||
| source: hosted | source: hosted | ||||
| version: "2.1.0-nullsafety.1" | |||||
| version: "2.1.0" | |||||
| build: | build: | ||||
| dependency: transitive | dependency: transitive | ||||
| description: | description: | ||||
| name: characters | name: characters | ||||
| url: "https://pub.dartlang.org" | url: "https://pub.dartlang.org" | ||||
| source: hosted | source: hosted | ||||
| version: "1.1.0-nullsafety.3" | |||||
| version: "1.1.0" | |||||
| charcode: | charcode: | ||||
| dependency: transitive | dependency: transitive | ||||
| description: | description: | ||||
| name: charcode | name: charcode | ||||
| url: "https://pub.dartlang.org" | url: "https://pub.dartlang.org" | ||||
| source: hosted | source: hosted | ||||
| version: "1.2.0-nullsafety.1" | |||||
| version: "1.3.1" | |||||
| checked_yaml: | checked_yaml: | ||||
| dependency: transitive | dependency: transitive | ||||
| description: | description: | ||||
| name: clock | name: clock | ||||
| url: "https://pub.dartlang.org" | url: "https://pub.dartlang.org" | ||||
| source: hosted | source: hosted | ||||
| version: "1.1.0-nullsafety.1" | |||||
| version: "1.1.0" | |||||
| code_builder: | code_builder: | ||||
| dependency: transitive | dependency: transitive | ||||
| description: | description: | ||||
| name: collection | name: collection | ||||
| url: "https://pub.dartlang.org" | url: "https://pub.dartlang.org" | ||||
| source: hosted | source: hosted | ||||
| version: "1.15.0-nullsafety.3" | |||||
| version: "1.15.0" | |||||
| convert: | convert: | ||||
| dependency: transitive | dependency: transitive | ||||
| description: | description: | ||||
| name: fake_async | name: fake_async | ||||
| url: "https://pub.dartlang.org" | url: "https://pub.dartlang.org" | ||||
| source: hosted | source: hosted | ||||
| version: "1.2.0-nullsafety.1" | |||||
| version: "1.2.0" | |||||
| ffi: | ffi: | ||||
| dependency: transitive | |||||
| dependency: "direct main" | |||||
| description: | description: | ||||
| name: ffi | name: ffi | ||||
| url: "https://pub.dartlang.org" | url: "https://pub.dartlang.org" | ||||
| source: hosted | source: hosted | ||||
| version: "0.1.3" | |||||
| version: "1.2.1" | |||||
| file: | file: | ||||
| dependency: transitive | dependency: transitive | ||||
| description: | description: | ||||
| name: flutter_svg | name: flutter_svg | ||||
| url: "https://pub.dartlang.org" | url: "https://pub.dartlang.org" | ||||
| source: hosted | source: hosted | ||||
| version: "0.19.1" | |||||
| version: "0.20.0-nullsafety.3" | |||||
| flutter_test: | flutter_test: | ||||
| dependency: "direct dev" | dependency: "direct dev" | ||||
| description: flutter | description: flutter | ||||
| name: js | name: js | ||||
| url: "https://pub.dartlang.org" | url: "https://pub.dartlang.org" | ||||
| source: hosted | source: hosted | ||||
| version: "0.6.2" | |||||
| version: "0.6.3" | |||||
| json_annotation: | json_annotation: | ||||
| dependency: transitive | dependency: transitive | ||||
| description: | description: | ||||
| name: matcher | name: matcher | ||||
| url: "https://pub.dartlang.org" | url: "https://pub.dartlang.org" | ||||
| source: hosted | source: hosted | ||||
| version: "0.12.10-nullsafety.1" | |||||
| version: "0.12.10" | |||||
| meta: | meta: | ||||
| dependency: "direct main" | dependency: "direct main" | ||||
| description: | description: | ||||
| name: meta | name: meta | ||||
| url: "https://pub.dartlang.org" | url: "https://pub.dartlang.org" | ||||
| source: hosted | source: hosted | ||||
| version: "1.3.0-nullsafety.3" | |||||
| version: "1.7.0" | |||||
| mime: | mime: | ||||
| dependency: "direct main" | dependency: "direct main" | ||||
| description: | description: | ||||
| name: path | name: path | ||||
| url: "https://pub.dartlang.org" | url: "https://pub.dartlang.org" | ||||
| source: hosted | source: hosted | ||||
| version: "1.8.0-nullsafety.1" | |||||
| version: "1.8.0" | |||||
| path_drawing: | path_drawing: | ||||
| dependency: transitive | dependency: transitive | ||||
| description: | description: | ||||
| name: path_drawing | name: path_drawing | ||||
| url: "https://pub.dartlang.org" | url: "https://pub.dartlang.org" | ||||
| source: hosted | source: hosted | ||||
| version: "0.4.1+1" | |||||
| version: "0.5.1+1" | |||||
| path_parsing: | path_parsing: | ||||
| dependency: transitive | dependency: transitive | ||||
| description: | description: | ||||
| name: path_parsing | name: path_parsing | ||||
| url: "https://pub.dartlang.org" | url: "https://pub.dartlang.org" | ||||
| source: hosted | source: hosted | ||||
| version: "0.1.4" | |||||
| version: "0.2.1" | |||||
| path_provider: | path_provider: | ||||
| dependency: "direct main" | dependency: "direct main" | ||||
| description: | description: | ||||
| name: path_provider_windows | name: path_provider_windows | ||||
| url: "https://pub.dartlang.org" | url: "https://pub.dartlang.org" | ||||
| source: hosted | source: hosted | ||||
| version: "0.0.4+3" | |||||
| version: "0.0.5" | |||||
| pattern_formatter: | pattern_formatter: | ||||
| dependency: "direct main" | dependency: "direct main" | ||||
| description: | description: | ||||
| name: petitparser | name: petitparser | ||||
| url: "https://pub.dartlang.org" | url: "https://pub.dartlang.org" | ||||
| source: hosted | source: hosted | ||||
| version: "3.1.0" | |||||
| version: "4.4.0" | |||||
| platform: | platform: | ||||
| dependency: transitive | dependency: transitive | ||||
| description: | description: | ||||
| url: "https://pub.dartlang.org" | url: "https://pub.dartlang.org" | ||||
| source: hosted | source: hosted | ||||
| version: "3.0.13" | version: "3.0.13" | ||||
| protobuf: | |||||
| dependency: transitive | |||||
| description: | |||||
| name: protobuf | |||||
| url: "https://pub.dartlang.org" | |||||
| source: hosted | |||||
| version: "1.1.0" | |||||
| provider: | provider: | ||||
| dependency: transitive | dependency: transitive | ||||
| description: | description: | ||||
| name: shared_preferences_windows | name: shared_preferences_windows | ||||
| url: "https://pub.dartlang.org" | url: "https://pub.dartlang.org" | ||||
| source: hosted | source: hosted | ||||
| version: "0.0.2+2" | |||||
| version: "0.0.2+3" | |||||
| shelf: | shelf: | ||||
| dependency: transitive | dependency: transitive | ||||
| description: | description: | ||||
| name: source_span | name: source_span | ||||
| url: "https://pub.dartlang.org" | url: "https://pub.dartlang.org" | ||||
| source: hosted | source: hosted | ||||
| version: "1.8.0-nullsafety.2" | |||||
| version: "1.8.1" | |||||
| sqflite: | sqflite: | ||||
| dependency: transitive | dependency: transitive | ||||
| description: | description: | ||||
| name: stack_trace | name: stack_trace | ||||
| url: "https://pub.dartlang.org" | url: "https://pub.dartlang.org" | ||||
| source: hosted | source: hosted | ||||
| version: "1.10.0-nullsafety.1" | |||||
| version: "1.10.0" | |||||
| stream_channel: | stream_channel: | ||||
| dependency: transitive | dependency: transitive | ||||
| description: | description: | ||||
| name: stream_channel | name: stream_channel | ||||
| url: "https://pub.dartlang.org" | url: "https://pub.dartlang.org" | ||||
| source: hosted | source: hosted | ||||
| version: "2.1.0-nullsafety.1" | |||||
| version: "2.1.0" | |||||
| stream_transform: | stream_transform: | ||||
| dependency: transitive | dependency: transitive | ||||
| description: | description: | ||||
| name: string_scanner | name: string_scanner | ||||
| url: "https://pub.dartlang.org" | url: "https://pub.dartlang.org" | ||||
| source: hosted | source: hosted | ||||
| version: "1.1.0-nullsafety.1" | |||||
| version: "1.1.0" | |||||
| synchronized: | synchronized: | ||||
| dependency: transitive | dependency: transitive | ||||
| description: | description: | ||||
| name: term_glyph | name: term_glyph | ||||
| url: "https://pub.dartlang.org" | url: "https://pub.dartlang.org" | ||||
| source: hosted | source: hosted | ||||
| version: "1.2.0-nullsafety.1" | |||||
| version: "1.2.0" | |||||
| test_api: | test_api: | ||||
| dependency: transitive | dependency: transitive | ||||
| description: | description: | ||||
| name: test_api | name: test_api | ||||
| url: "https://pub.dartlang.org" | url: "https://pub.dartlang.org" | ||||
| source: hosted | source: hosted | ||||
| version: "0.2.19-nullsafety.2" | |||||
| version: "0.4.2" | |||||
| timing: | timing: | ||||
| dependency: transitive | dependency: transitive | ||||
| description: | description: | ||||
| name: typed_data | name: typed_data | ||||
| url: "https://pub.dartlang.org" | url: "https://pub.dartlang.org" | ||||
| source: hosted | source: hosted | ||||
| version: "1.3.0-nullsafety.3" | |||||
| version: "1.3.0" | |||||
| uuid: | uuid: | ||||
| dependency: transitive | dependency: transitive | ||||
| description: | description: | ||||
| name: vector_math | name: vector_math | ||||
| url: "https://pub.dartlang.org" | url: "https://pub.dartlang.org" | ||||
| source: hosted | source: hosted | ||||
| version: "2.1.0-nullsafety.3" | |||||
| video_player: | |||||
| dependency: "direct main" | |||||
| description: | |||||
| name: video_player | |||||
| url: "https://pub.dartlang.org" | |||||
| source: hosted | |||||
| version: "0.10.12+5" | |||||
| video_player_platform_interface: | |||||
| dependency: transitive | |||||
| description: | |||||
| name: video_player_platform_interface | |||||
| url: "https://pub.dartlang.org" | |||||
| source: hosted | |||||
| version: "2.2.0" | |||||
| video_player_web: | |||||
| dependency: transitive | |||||
| description: | |||||
| name: video_player_web | |||||
| url: "https://pub.dartlang.org" | |||||
| source: hosted | |||||
| version: "0.1.4+1" | |||||
| version: "2.1.0" | |||||
| watcher: | watcher: | ||||
| dependency: transitive | dependency: transitive | ||||
| description: | description: | ||||
| name: win32 | name: win32 | ||||
| url: "https://pub.dartlang.org" | url: "https://pub.dartlang.org" | ||||
| source: hosted | source: hosted | ||||
| version: "1.7.4" | |||||
| version: "2.3.6" | |||||
| xdg_directories: | xdg_directories: | ||||
| dependency: transitive | dependency: transitive | ||||
| description: | description: | ||||
| name: xml | name: xml | ||||
| url: "https://pub.dartlang.org" | url: "https://pub.dartlang.org" | ||||
| source: hosted | source: hosted | ||||
| version: "4.5.1" | |||||
| version: "5.3.1" | |||||
| yaml: | yaml: | ||||
| dependency: transitive | dependency: transitive | ||||
| description: | description: | ||||
| source: hosted | source: hosted | ||||
| version: "2.2.1" | version: "2.2.1" | ||||
| sdks: | sdks: | ||||
| dart: ">=2.10.2 <2.11.0" | |||||
| flutter: ">=1.22.2 <2.0.0" | |||||
| dart: ">=2.14.0 <3.0.0" | |||||
| flutter: ">=1.24.0-7.0" |
| keyboard_dismisser: ^1.0.2 | keyboard_dismisser: ^1.0.2 | ||||
| pattern_formatter: ^1.0.2 | pattern_formatter: ^1.0.2 | ||||
| rxdart: ^0.23.0 | rxdart: ^0.23.0 | ||||
| barcode_scan: ^3.0.1 | |||||
| video_player: ^0.10.11+2 | |||||
| # barcode_scan: ^3.0.1 | |||||
| # video_player: ^0.10.11+2 | |||||
| shimmer: ^1.1.1 | shimmer: ^1.1.1 | ||||
| font_awesome_flutter: ^8.8.1 | font_awesome_flutter: ^8.8.1 | ||||
| package_info: ^0.4.3 | package_info: ^0.4.3 | ||||
| mime: ^0.9.7 | mime: ^0.9.7 | ||||
| flutter_image_compress: ^0.7.0 | flutter_image_compress: ^0.7.0 | ||||
| flutter_svg: ^0.19.1 | |||||
| flutter_svg: ^0.20.0-nullsafety.3 | |||||
| google_fonts: ^1.1.1 | google_fonts: ^1.1.1 | ||||
| ffi: ^1.0.0 | |||||
| # qr_code_scanner: ^1.0.1 | |||||
| dev_dependencies: | dev_dependencies: |