Browse Source

update new api link nhatky

phase2_apinhatky
Đại Võ 1 year ago
parent
commit
4d5d26c678
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

@@ -370,7 +370,7 @@
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 30;
CURRENT_PROJECT_VERSION = 32;
DEVELOPMENT_TEAM = C3DTD2JH94;
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
@@ -386,7 +386,7 @@
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
MARKETING_VERSION = 1.1.11;
MARKETING_VERSION = 1.1.12;
PRODUCT_BUNDLE_IDENTIFIER = vn.azteam.farmdemo;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
@@ -512,7 +512,7 @@
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 30;
CURRENT_PROJECT_VERSION = 32;
DEVELOPMENT_TEAM = C3DTD2JH94;
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
@@ -528,7 +528,7 @@
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
MARKETING_VERSION = 1.1.11;
MARKETING_VERSION = 1.1.12;
PRODUCT_BUNDLE_IDENTIFIER = vn.azteam.farmdemo;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
@@ -548,7 +548,7 @@
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 30;
CURRENT_PROJECT_VERSION = 32;
DEVELOPMENT_TEAM = C3DTD2JH94;
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
@@ -564,7 +564,7 @@
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
MARKETING_VERSION = 1.1.11;
MARKETING_VERSION = 1.1.12;
PRODUCT_BUNDLE_IDENTIFIER = vn.azteam.farmdemo;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";

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

@@ -1,28 +1,22 @@
import 'NotificationDTO.dart';

class NotificationObjectDTO {
List<NotificationDTO>? notificationDTO;
int? numberUnreadPage;
int? numberReadPage;
int? numberUnreadTotal;
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) {
numberUnreadPage = json['numberUnreadPage'];
numberReadPage = json['numberReadPage'];
numberUnreadTotal = json['numberUnreadTotal'];
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));
});
}
@@ -30,6 +24,7 @@ class NotificationObjectDTO {

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

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

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

@@ -1,13 +1,11 @@
class Account {
int? id;
String? login;
String? firstName;
String? lastName;
String? password;
String? fullName;
String? phone;
String? birthDay;
String? gender;
String? userId;
int? gender;
int? roleId;
String? roleName;
int? customerId;
@@ -26,50 +24,43 @@ class Account {
String? email;
String? imageUrl;
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) {
id = json['id'];
login = json['login'];
firstName = json['firstName'];
lastName = json['lastName'];
password = json['password'];
fullName = json['fullName'];
phone = json['phone'];
birthDay = json['birthDay'];
gender = json['gender'];
userId = json['userId'];
roleId = json['roleId'];
roleName = json['roleName'];
customerId = json['customerId'];
@@ -88,21 +79,17 @@ class Account {
email = json['email'];
imageUrl = json['imageUrl'];
activated = json['activated'];
langKey = json['langKey'];
authorities = json['authorities'].cast<String>();
}

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

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

@@ -9,7 +9,7 @@ part of 'rest_client.dart';
class _RestClient implements RestClient {
_RestClient(this._dio, {this.baseUrl}) {
ArgumentError.checkNotNull(_dio, '_dio');
baseUrl ??= 'https://tpf.aztrace.vn/';
baseUrl ??= 'https://nhatky.aztrace.vn/';
}

final Dio _dio;
@@ -336,12 +336,12 @@ class _RestClient implements RestClient {
final queryParameters = <String, dynamic>{};
queryParameters.removeWhere((k, v) => v == null);
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',
queryParameters: queryParameters,
data: _data,
);
final value = CropPlot.fromJson(_result.data ?? Map<String, dynamic>());
final value = CropPlot.fromJson(_result.data);
return value;
}


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

@@ -548,7 +548,7 @@ class Repository {

Future<List<SupplyFilter>> getSuppliesFilter() async {
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(
url,
);
@@ -581,7 +581,7 @@ class Repository {
var url = '${ConstCommon.baseUrl}/api/tb-crops/list?page=$page&size=$size&sort=createdDate,desc';
var res = await dio.post(url, data: {
'tbSuppliesIds': filter.supplyIds,
'netHouseIds': filter.netHouseIds,
'areaIds': filter.netHouseIds,
'code': filter.code,
});


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

@@ -37,8 +37,8 @@ void setFlavorDevelopment() {
AppEnvironment.DEV,
FlavorValues(
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',
),
);
@@ -49,8 +49,8 @@ void setFlavorTest() {
AppEnvironment.TEST,
FlavorValues(
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',
),
);
@@ -61,8 +61,8 @@ void setFlavorProduction() {
AppEnvironment.PROD,
FlavorValues(
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',
),
);

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

@@ -43,19 +43,19 @@ class Button2Icon extends StatelessWidget {
color: Colors.grey.shade500,
),
const SizedBox(
width: 4,
width: 2,
),
Text(
title,
style: StylesText.caption2,
),
const SizedBox(
width: 4,
width: 2,
),
rightIcon != null
? Icon(
rightIcon,
size: 16,
size: 12,
color: Colors.grey.shade500,
)
: const SizedBox.shrink(),

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

@@ -58,7 +58,12 @@ class SecondButton extends StatelessWidget {
),
Text(
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

@@ -77,7 +77,7 @@ class _MultipleSelectBottomSheetState extends State<MultipleSelectBottomSheet> {
child: Center(
child: Text(
'${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

@@ -35,8 +35,8 @@ class _LoginPageState extends State<LoginPage> {
void initState() {
super.initState();
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

@@ -28,7 +28,11 @@ class NotiBloc extends Bloc<NotiEvent, NotiState> {
yield NotiLoadding();
final response = await repository.getNotifications(page: 0, size: pageSize);
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(
unread: response.numberUnreadTotal ?? 0,
read: response.numberReadTotal ?? 0,

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

@@ -9,11 +9,7 @@ class AppFont {

class StylesText {
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(
fontSize: 24.sp,
@@ -96,6 +92,13 @@ class StylesText {
color: AppColors.neutral1,
);

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

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

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

@@ -2,8 +2,8 @@ class ConstCommon {
static int kExpiredTime = 518400000; //6* 24 * 60 * 60 * 1000; 6days
static int kFileSize = 1000000; //1M = 1000.000 bytes
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 const String supplyTypeSeed = "GIONG";

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

@@ -5,7 +5,7 @@ import 'package:intl/intl.dart';
extension formatDateTime on DateTime {
String convertLocalDateTimeToStringUtcDateTime() {
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;
} catch (_) {
return "";
@@ -27,7 +27,7 @@ extension ddMM_HHmm on String {
String format_DDMM_HHmm() {
try {
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);
} catch (_) {
return "";
@@ -38,7 +38,7 @@ extension ddMM_HHmm on String {
String format_DDMMYY_HHmm() {
try {
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);
} catch (_) {
return "";
@@ -48,7 +48,7 @@ extension ddMM_HHmm on String {
String format_DDMMYY() {
try {
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);
} catch (_) {
return "";
@@ -57,7 +57,7 @@ extension ddMM_HHmm on String {

DateTime convertStringServerDateTimeToLocalDateTime() {
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 (_) {
return DateTime.now();
}

+ 1
- 1
pubspec.yaml View File

@@ -2,7 +2,7 @@ name: farm_tpf
description: A new Flutter project.

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

environment:
sdk: ">=3.0.0 <4.0.0"

Loading…
Cancel
Save