Browse Source

update new api link nhatky

bugfix/20250501
Đại Võ 1 year ago
parent
commit
273ffa7a7b
15 changed files with 87 additions and 95 deletions
  1. +6
    -6
      ios/Runner.xcodeproj/project.pbxproj
  2. +6
    -11
      lib/custom_model/NotificationObjectDTO.dart
  3. +31
    -46
      lib/custom_model/account.dart
  4. +3
    -3
      lib/data/api/rest_client.g.dart
  5. +2
    -2
      lib/data/repository/repository.dart
  6. +6
    -6
      lib/environment/app_config.dart
  7. +3
    -3
      lib/presentation/custom_widgets/button/button_2_icon.dart
  8. +6
    -1
      lib/presentation/custom_widgets/button/second_button.dart
  9. +1
    -1
      lib/presentation/custom_widgets/dropdown/multiple_select_bottom_sheet.dart
  10. +2
    -2
      lib/presentation/screens/login/login_page.dart
  11. +5
    -1
      lib/presentation/screens/notification/bloc/noti_bloc.dart
  12. +8
    -5
      lib/themes/styles_text.dart
  13. +2
    -2
      lib/utils/const_common.dart
  14. +5
    -5
      lib/utils/formatter.dart
  15. +1
    -1
      pubspec.yaml

+ 6
- 6
ios/Runner.xcodeproj/project.pbxproj View File

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 = 30;
CURRENT_PROJECT_VERSION = 32;
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.11;
MARKETING_VERSION = 1.1.12;
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 = "";
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 = 30;
CURRENT_PROJECT_VERSION = 32;
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.11;
MARKETING_VERSION = 1.1.12;
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 = "";
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 = 30;
CURRENT_PROJECT_VERSION = 32;
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.11;
MARKETING_VERSION = 1.1.12;
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 = "";

+ 6
- 11
lib/custom_model/NotificationObjectDTO.dart View File

import 'NotificationDTO.dart'; import 'NotificationDTO.dart';


class NotificationObjectDTO { class NotificationObjectDTO {
List<NotificationDTO>? notificationDTO;
int? numberUnreadPage; int? numberUnreadPage;
int? numberReadPage; int? numberReadPage;
int? numberUnreadTotal; int? numberUnreadTotal;
int? numberReadTotal; int? numberReadTotal;
List<NotificationDTO>? notificationDTO;


NotificationObjectDTO({
this.numberUnreadPage,
this.numberReadPage,
this.numberUnreadTotal,
this.numberReadTotal,
this.notificationDTO,
});
NotificationObjectDTO({this.notificationDTO, this.numberUnreadPage, this.numberReadPage, this.numberUnreadTotal, this.numberReadTotal});


NotificationObjectDTO.fromJson(Map<String, dynamic> json) { NotificationObjectDTO.fromJson(Map<String, dynamic> json) {
numberUnreadPage = json['numberUnreadPage']; numberUnreadPage = json['numberUnreadPage'];
numberReadPage = json['numberReadPage']; numberReadPage = json['numberReadPage'];
numberUnreadTotal = json['numberUnreadTotal']; numberUnreadTotal = json['numberUnreadTotal'];
numberReadTotal = json['numberReadTotal']; numberReadTotal = json['numberReadTotal'];
if (json['tbnotificationDTOs'] != null) {
notificationDTO = <NotificationDTO>[];
json['tbnotificationDTOs'].forEach((v) {
if (json['tbNotificationDTOS'] != null) {
notificationDTO = [];
json['tbNotificationDTOS'].forEach((v) {
notificationDTO?.add(new NotificationDTO.fromJson(v)); notificationDTO?.add(new NotificationDTO.fromJson(v));
}); });
} }


Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>(); final Map<String, dynamic> data = new Map<String, dynamic>();

data['numberUnreadPage'] = this.numberUnreadPage; data['numberUnreadPage'] = this.numberUnreadPage;
data['numberReadPage'] = this.numberReadPage; data['numberReadPage'] = this.numberReadPage;
data['numberUnreadTotal'] = this.numberUnreadTotal; data['numberUnreadTotal'] = this.numberUnreadTotal;

+ 31
- 46
lib/custom_model/account.dart View File

class Account { class Account {
int? id; int? id;
String? login; String? login;
String? firstName;
String? lastName;
String? password;
String? fullName; String? fullName;
String? phone; String? phone;
String? birthDay; String? birthDay;
String? gender;
String? userId;
int? gender;
int? roleId; int? roleId;
String? roleName; String? roleName;
int? customerId; int? customerId;
String? email; String? email;
String? imageUrl; String? imageUrl;
bool? activated; bool? activated;
String? langKey;
List<String>? authorities;


Account(
{this.id,
this.login,
this.firstName,
this.lastName,
this.fullName,
this.phone,
this.birthDay,
this.gender,
this.userId,
this.roleId,
this.roleName,
this.customerId,
this.customerName,
this.addressId,
this.address,
this.countryId,
this.countryName,
this.cityId,
this.cityName,
this.districtId,
this.districtName,
this.wardId,
this.wardName,
this.fcmToken,
this.email,
this.imageUrl,
this.activated,
this.langKey,
this.authorities});
Account({
this.id,
this.login,
this.password,
this.fullName,
this.phone,
this.birthDay,
this.gender,
this.roleId,
this.roleName,
this.customerId,
this.customerName,
this.addressId,
this.address,
this.countryId,
this.countryName,
this.cityId,
this.cityName,
this.districtId,
this.districtName,
this.wardId,
this.wardName,
this.fcmToken,
this.email,
this.imageUrl,
this.activated,
});


Account.fromJson(Map<String, dynamic> json) { Account.fromJson(Map<String, dynamic> json) {
id = json['id']; id = json['id'];
login = json['login']; login = json['login'];
firstName = json['firstName'];
lastName = json['lastName'];
password = json['password'];
fullName = json['fullName']; fullName = json['fullName'];
phone = json['phone']; phone = json['phone'];
birthDay = json['birthDay']; birthDay = json['birthDay'];
gender = json['gender']; gender = json['gender'];
userId = json['userId'];
roleId = json['roleId']; roleId = json['roleId'];
roleName = json['roleName']; roleName = json['roleName'];
customerId = json['customerId']; customerId = json['customerId'];
email = json['email']; email = json['email'];
imageUrl = json['imageUrl']; imageUrl = json['imageUrl'];
activated = json['activated']; activated = json['activated'];
langKey = json['langKey'];
authorities = json['authorities'].cast<String>();
} }


Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>(); final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id; data['id'] = this.id;
data['login'] = this.login; data['login'] = this.login;
data['firstName'] = this.firstName;
data['lastName'] = this.lastName;
data['password'] = this.password;
data['fullName'] = this.fullName; data['fullName'] = this.fullName;
data['phone'] = this.phone; data['phone'] = this.phone;
data['birthDay'] = this.birthDay; data['birthDay'] = this.birthDay;
data['gender'] = this.gender; data['gender'] = this.gender;
data['userId'] = this.userId;
data['roleId'] = this.roleId; data['roleId'] = this.roleId;
data['roleName'] = this.roleName; data['roleName'] = this.roleName;
data['customerId'] = this.customerId; data['customerId'] = this.customerId;
data['email'] = this.email; data['email'] = this.email;
data['imageUrl'] = this.imageUrl; data['imageUrl'] = this.imageUrl;
data['activated'] = this.activated; data['activated'] = this.activated;
data['langKey'] = this.langKey;
data['authorities'] = this.authorities;
return data; return data;
} }
} }

+ 3
- 3
lib/data/api/rest_client.g.dart View File

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://tpf.aztrace.vn/';
baseUrl ??= 'https://nhatky.aztrace.vn/';
} }


final Dio _dio; final Dio _dio;
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 Response<Map<String, dynamic>> _result = await _dio.request(
var _result = await _dio.request(
'/api/tb-crops-detail-for-app/$cropId?page=$page&size=$size&sort=executeDate,DESC', '/api/tb-crops-detail-for-app/$cropId?page=$page&size=$size&sort=executeDate,DESC',
queryParameters: queryParameters, queryParameters: queryParameters,
data: _data, data: _data,
); );
final value = CropPlot.fromJson(_result.data ?? Map<String, dynamic>());
final value = CropPlot.fromJson(_result.data);
return value; return value;
} }



+ 2
- 2
lib/data/repository/repository.dart View File



Future<List<SupplyFilter>> getSuppliesFilter() async { Future<List<SupplyFilter>> getSuppliesFilter() async {
try { try {
var url = '${ConstCommon.baseUrl}/api/tb-supplies/by-login-info/';
var url = '${ConstCommon.baseUrl}/api/tb-supplies/by-login-info';
var res = await dio.get( var res = await dio.get(
url, url,
); );
var url = '${ConstCommon.baseUrl}/api/tb-crops/list?page=$page&size=$size&sort=createdDate,desc'; var url = '${ConstCommon.baseUrl}/api/tb-crops/list?page=$page&size=$size&sort=createdDate,desc';
var res = await dio.post(url, data: { var res = await dio.post(url, data: {
'tbSuppliesIds': filter.supplyIds, 'tbSuppliesIds': filter.supplyIds,
'netHouseIds': filter.netHouseIds,
'areaIds': filter.netHouseIds,
'code': filter.code, 'code': filter.code,
}); });



+ 6
- 6
lib/environment/app_config.dart View File

AppEnvironment.DEV, AppEnvironment.DEV,
FlavorValues( FlavorValues(
appName: '[DEV] Thaco Agri', appName: '[DEV] Thaco Agri',
server: 'https://tpf.aztrace.vn',
baseUrl: 'https://tpf.aztrace.vn',
server: 'https://nhatky.aztrace.vn',
baseUrl: 'https://nhatky.aztrace.vn',
LocalDBName: 'AppLocalStorage-DEV', LocalDBName: 'AppLocalStorage-DEV',
), ),
); );
AppEnvironment.TEST, AppEnvironment.TEST,
FlavorValues( FlavorValues(
appName: 'Thaco Agri', appName: 'Thaco Agri',
server: 'https://tpf.aztrace.vn',
baseUrl: 'https://tpf.aztrace.vn',
server: 'https://nhatky.aztrace.vn',
baseUrl: 'https://nhatky.aztrace.vn',
LocalDBName: 'AppLocalStorage-TEST', LocalDBName: 'AppLocalStorage-TEST',
), ),
); );
AppEnvironment.PROD, AppEnvironment.PROD,
FlavorValues( FlavorValues(
appName: 'Trang Trai Bo', appName: 'Trang Trai Bo',
server: 'https://tpf.aztrace.vn',
baseUrl: 'https://tpf.aztrace.vn',
server: 'https://nhatky.aztrace.vn',
baseUrl: 'https://nhatky.aztrace.vn',
LocalDBName: 'AppLocalStorage', LocalDBName: 'AppLocalStorage',
), ),
); );

+ 3
- 3
lib/presentation/custom_widgets/button/button_2_icon.dart View File

color: Colors.grey.shade500, color: Colors.grey.shade500,
), ),
const SizedBox( const SizedBox(
width: 4,
width: 2,
), ),
Text( Text(
title, title,
style: StylesText.caption2, style: StylesText.caption2,
), ),
const SizedBox( const SizedBox(
width: 4,
width: 2,
), ),
rightIcon != null rightIcon != null
? Icon( ? Icon(
rightIcon, rightIcon,
size: 16,
size: 12,
color: Colors.grey.shade500, color: Colors.grey.shade500,
) )
: const SizedBox.shrink(), : const SizedBox.shrink(),

+ 6
- 1
lib/presentation/custom_widgets/button/second_button.dart View File

), ),
Text( Text(
title, title,
style: StylesText.body5.copyWith(color: textColor ?? Colors.white),
// style: StylesText.body5.copyWith(color: textColor ?? Colors.white),
style: TextStyle(
color: textColor ?? Colors.white,
fontSize: 14,
fontWeight: FontWeight.w500,
),
), ),
], ],
), ),

+ 1
- 1
lib/presentation/custom_widgets/dropdown/multiple_select_bottom_sheet.dart View File

child: Center( child: Center(
child: Text( child: Text(
'${selecteds.length}', '${selecteds.length}',
style: StylesText.caption6.copyWith(color: Colors.white),
style: TextStyle(fontSize: 10, color: Colors.white),
), ),
), ),
), ),

+ 2
- 2
lib/presentation/screens/login/login_page.dart View File

void initState() { void initState() {
super.initState(); super.initState();
if (kDebugMode) { if (kDebugMode) {
loginBloc.usernameCtl.text = 'gd_doannong';
loginBloc.passwordCtl.text = 'abcd1234';
loginBloc.usernameCtl.text = 'admin';
loginBloc.passwordCtl.text = 'khongcopass';
} }
} }



+ 5
- 1
lib/presentation/screens/notification/bloc/noti_bloc.dart View File

yield NotiLoadding(); yield NotiLoadding();
final response = await repository.getNotifications(page: 0, size: pageSize); final response = await repository.getNotifications(page: 0, size: pageSize);
List<NotificationDTO> items = <NotificationDTO>[]; List<NotificationDTO> items = <NotificationDTO>[];
response.notificationDTO!.forEach((e) => items.add(NotificationDTO.clone(e)));
print(response.notificationDTO);
response.notificationDTO?.forEach((e) {
print(e);
items.add(NotificationDTO.clone(e));
});
yield NotiSuccess( yield NotiSuccess(
unread: response.numberUnreadTotal ?? 0, unread: response.numberUnreadTotal ?? 0,
read: response.numberReadTotal ?? 0, read: response.numberReadTotal ?? 0,

+ 8
- 5
lib/themes/styles_text.dart View File



class StylesText { class StylesText {
static final disabled = TextStyle( static final disabled = TextStyle(
fontSize: 14.sp,
fontFamily: AppFont.appFont,
fontWeight: FontWeight.w400,
color: AppColors.neutral1,
backgroundColor: AppColors.neutral3);
fontSize: 14.sp, fontFamily: AppFont.appFont, fontWeight: FontWeight.w400, color: AppColors.neutral1, backgroundColor: AppColors.neutral3);


static final header1 = TextStyle( static final header1 = TextStyle(
fontSize: 24.sp, fontSize: 24.sp,
color: AppColors.neutral1, color: AppColors.neutral1,
); );


static final caption7 = TextStyle(
fontSize: 8.sp,
fontFamily: AppFont.appFont,
fontWeight: FontWeight.w400,
color: AppColors.neutral1,
);

static final appbarTitle = TextStyle( static final appbarTitle = TextStyle(
fontSize: 20.sp, fontSize: 20.sp,
fontFamily: AppFont.appFont, fontFamily: AppFont.appFont,

+ 2
- 2
lib/utils/const_common.dart View File

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://tpf.aztrace.vn";
static const String baseImageUrl = "https://tpf.aztrace.vn/upload/";
static const String baseUrl = "https://nhatky.aztrace.vn";
static const String baseImageUrl = "https://nhatky.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";

+ 5
- 5
lib/utils/formatter.dart View File

extension formatDateTime on DateTime { extension formatDateTime on DateTime {
String convertLocalDateTimeToStringUtcDateTime() { String convertLocalDateTimeToStringUtcDateTime() {
try { try {
String utcDateString = DateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'").format(this.toUtc());
String utcDateString = DateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSSSS'Z'").format(this.toUtc());
return utcDateString; return utcDateString;
} catch (_) { } catch (_) {
return ""; return "";
String format_DDMM_HHmm() { String format_DDMM_HHmm() {
try { try {
final str = this.toString(); final str = this.toString();
var dateFromString = DateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'").parse(str, true).toLocal();
var dateFromString = DateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSSSS'Z'").parse(str, true).toLocal();
return DateFormat("dd/MM HH:mm").format(dateFromString); return DateFormat("dd/MM HH:mm").format(dateFromString);
} catch (_) { } catch (_) {
return ""; return "";
String format_DDMMYY_HHmm() { String format_DDMMYY_HHmm() {
try { try {
final str = this.toString(); final str = this.toString();
var dateFromString = DateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'").parse(str, true).toLocal();
var dateFromString = DateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSSSS'Z'").parse(str, true).toLocal();
return DateFormat("dd/MM/yyyy HH:mm").format(dateFromString); return DateFormat("dd/MM/yyyy HH:mm").format(dateFromString);
} catch (_) { } catch (_) {
return ""; return "";
String format_DDMMYY() { String format_DDMMYY() {
try { try {
final str = this.toString(); final str = this.toString();
var dateFromString = DateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'").parse(str, true).toLocal();
var dateFromString = DateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSSSS'Z'").parse(str, true).toLocal();
return DateFormat("dd/MM/yyyy").format(dateFromString); return DateFormat("dd/MM/yyyy").format(dateFromString);
} catch (_) { } catch (_) {
return ""; return "";


DateTime convertStringServerDateTimeToLocalDateTime() { DateTime convertStringServerDateTimeToLocalDateTime() {
try { try {
return DateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'").parse(this, true).toLocal();
return DateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSSSS'Z'").parse(this, true).toLocal();
} catch (_) { } catch (_) {
return DateTime.now(); return DateTime.now();
} }

+ 1
- 1
pubspec.yaml View File

description: A new Flutter project. description: A new Flutter project.


publish_to: 'none' publish_to: 'none'
version: 1.1.11+30
version: 1.1.13+32


environment: environment:
sdk: ">=3.0.0 <4.0.0" sdk: ">=3.0.0 <4.0.0"

Loading…
Cancel
Save