diff --git a/lib/classes/app_permissions.dart b/lib/classes/app_permissions.dart index 8c0a0ee..314cf89 100644 --- a/lib/classes/app_permissions.dart +++ b/lib/classes/app_permissions.dart @@ -1,6 +1,5 @@ import 'package:hmg_flutter_template/widgets/dialogs/confirm_dialog.dart'; -import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:permission_handler/permission_handler.dart'; @@ -38,9 +37,9 @@ class AppPermissions { static void checkAll(Function(bool) completion) { [Permission.location].request().then((value) { bool allGranted = false; - value.values.forEach((element) { + for (var element in value.values) { allGranted = allGranted && element == PermissionStatus.granted; - }); + } completion(allGranted); }); diff --git a/lib/classes/consts.dart b/lib/classes/consts.dart index 7854166..e3b9999 100644 --- a/lib/classes/consts.dart +++ b/lib/classes/consts.dart @@ -1,22 +1,22 @@ class ApiConsts { - static const MAX_SMALL_SCREEN = 660; + static const maxSmallScreen = 660; static String baseUrl = "http://10.200.204.20:2801/"; // Local server // static String baseUrl = 'https://hmgwebservices.com/'; // static String baseUrl = 'https://uat.hmgwebservices.com/'; - static String baseUrlServices = baseUrl + "Services/"; // server + static String baseUrlServices = "${baseUrl}Services/"; // server // static String baseUrlServices = "https://api.cssynapses.com/tangheem/"; // Live server - static String utilitiesRest = baseUrlServices + "Utilities.svc/REST/"; - static String erpRest = baseUrlServices + "ERP.svc/REST/"; - static String swpRest = baseUrlServices + "SWP.svc/REST/"; - static String user = baseUrlServices + "api_repo/User/"; - static String cocRest = baseUrlServices + "COCWS.svc/REST/"; + static String utilitiesRest = "${baseUrlServices}Utilities.svc/REST/"; + static String erpRest = "${baseUrlServices}ERP.svc/REST/"; + static String swpRest = "${baseUrlServices}SWP.svc/REST/"; + static String user = "${baseUrlServices}api_repo/User/"; + static String cocRest = "${baseUrlServices}COCWS.svc/REST/"; //Chat static String chatServerBaseUrl = "https://apiderichat.hmg.com"; static String chatServerBaseApiUrl = "https://apiderichat.hmg.com/api_repo/"; - static String chatHubConnectionUrl = chatServerBaseUrl + "/ConnectionChatHub"; + static String chatHubConnectionUrl = "$chatServerBaseUrl/ConnectionChatHub"; static String chatSearchMember = "user/getUserWithStatusAndFavAsync/"; static String chatRecentUrl = "UserChatHistory/getchathistorybyuserid"; //For a Mem static String chatSingleUserHistoryUrl = "UserChatHistory/GetUserChatHistory"; diff --git a/lib/classes/date-utils.dart b/lib/classes/date-utils.dart index c823435..27ff4e3 100644 --- a/lib/classes/date-utils.dart +++ b/lib/classes/date-utils.dart @@ -1,7 +1,6 @@ import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/cupertino.dart'; import 'package:hmg_flutter_template/generated/locale_keys.g.dart'; -import 'package:intl/intl.dart'; class AppDateUtils { static String convertDateToFormat(DateTime dateTime, String dateFormat) { @@ -18,10 +17,11 @@ class AppDateUtils { static String convertStringToDateFormat(String date, String dateFormat) { DateTime dateTime; - if (date.contains("/Date")) + if (date.contains("/Date")) { dateTime = getDateTimeFromServerFormat(date); - else + } else { dateTime = DateTime.parse(date); + } return convertDateToFormat(dateTime, dateFormat); } @@ -50,7 +50,7 @@ class AppDateUtils { final endIndex = str.indexOf(end, startIndex + start.length); - date = new DateTime.fromMillisecondsSinceEpoch(int.parse(str.substring(startIndex + start.length, endIndex))); + date = DateTime.fromMillisecondsSinceEpoch(int.parse(str.substring(startIndex + start.length, endIndex))); } else { date = DateTime.now(); } @@ -95,10 +95,7 @@ class AppDateUtils { double hoursInOneDay = difference.inHours / difference.inDays; - return (isShowDays ? (days > 0 ? "$days ${LocaleKeys.days.tr()}," : '') : "") + - (hours > 0 ? "$hours ${LocaleKeys.hr.tr()}," : "") + - " $minutes ${LocaleKeys.min.tr()}" + - (isShowSecond ? ", $second Sec" : ""); + return "${isShowDays ? (days > 0 ? "$days ${LocaleKeys.days.tr()}," : '') : ""}${hours > 0 ? "$hours ${LocaleKeys.hr.tr()}," : ""} $minutes ${LocaleKeys.min.tr()}${isShowSecond ? ", $second Sec" : ""}"; } static String differenceBetweenServerDateAndCurrent(String str, BuildContext context) { @@ -110,7 +107,7 @@ class AppDateUtils { final endIndex = str.indexOf(end, startIndex + start.length); - var date = new DateTime.fromMillisecondsSinceEpoch(int.parse(str.substring(startIndex + start.length, endIndex))); + var date = DateTime.fromMillisecondsSinceEpoch(int.parse(str.substring(startIndex + start.length, endIndex))); return differenceBetweenDateAndCurrent(date, context); } diff --git a/lib/classes/size_config.dart b/lib/classes/size_config.dart index c0f7ddd..8a6c664 100644 --- a/lib/classes/size_config.dart +++ b/lib/classes/size_config.dart @@ -25,7 +25,7 @@ class SizeConfig { void init(BoxConstraints constraints, Orientation orientation) { realScreenHeight = constraints.maxHeight; realScreenWidth = constraints.maxWidth; - if (constraints.maxWidth <= ApiConsts.MAX_SMALL_SCREEN) { + if (constraints.maxWidth <= ApiConsts.maxSmallScreen) { isMobile = true; } if (constraints.maxHeight < 600) { diff --git a/lib/classes/utils.dart b/lib/classes/utils.dart index 717f214..04b8bdb 100644 --- a/lib/classes/utils.dart +++ b/lib/classes/utils.dart @@ -75,12 +75,8 @@ class Utils { ).then((value) { _isLoadingVisible = false; }).catchError((e) { - print("--------------catchError---------------"); - print(e); }).onError( (error, stackTrace) { - print("--------------onError---------------"); - print(error); }, ); } @@ -93,7 +89,6 @@ class Utils { } _isLoadingVisible = false; } catch (e) { - print("exp_while_hide_dialog: " + e.toString()); } } diff --git a/lib/theme/app_theme.dart b/lib/theme/app_theme.dart index 5e52cc2..2a76b6f 100644 --- a/lib/theme/app_theme.dart +++ b/lib/theme/app_theme.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; import 'package:hmg_flutter_template/classes/colors.dart'; import 'package:hmg_flutter_template/theme/colors.dart'; @@ -26,7 +27,6 @@ class AppTheme { splashColor: Colors.transparent, primaryColor: primaryColor, primaryColorDark: primaryColor, - buttonColor: Colors.black, toggleableActiveColor: secondaryColor, indicatorColor: secondaryColor, bottomSheetTheme: const BottomSheetThemeData( @@ -44,11 +44,10 @@ class AppTheme { floatingActionButtonTheme: const FloatingActionButtonThemeData(highlightElevation: 2, disabledElevation: 0, elevation: 2), appBarTheme: AppBarTheme( color: const Color(0xff515A5D), - brightness: Brightness.light, elevation: 0.0, actionsIconTheme: IconThemeData( color: Colors.grey[800], - ), + ), systemOverlayStyle: SystemUiOverlayStyle.dark, ), ); } diff --git a/lib/widgets/bottom_sheet.dart b/lib/widgets/bottom_sheet.dart index d13fc56..29c21cd 100644 --- a/lib/widgets/bottom_sheet.dart +++ b/lib/widgets/bottom_sheet.dart @@ -75,7 +75,7 @@ class BottomSheetItem extends StatelessWidget { ), if (icon != null) SizedBox(width: 24.0), Text( - title ?? "", + title, style: TextStyle(color: color), ), ],