diff --git a/neowallet_mobile/android/build.gradle b/neowallet_mobile/android/build.gradle index 713d7f6e..3a752340 100644 --- a/neowallet_mobile/android/build.gradle +++ b/neowallet_mobile/android/build.gradle @@ -6,7 +6,7 @@ buildscript { } dependencies { - classpath 'com.android.tools.build:gradle:7.2.0' + classpath 'com.android.tools.build:gradle:7.3.0' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" } } @@ -28,4 +28,4 @@ subprojects { tasks.register("clean", Delete) { delete rootProject.buildDir -} +} \ No newline at end of file diff --git a/neowallet_mobile/android/gradle/wrapper/gradle-wrapper.properties b/neowallet_mobile/android/gradle/wrapper/gradle-wrapper.properties index 3c472b99..f6ef2442 100644 --- a/neowallet_mobile/android/gradle/wrapper/gradle-wrapper.properties +++ b/neowallet_mobile/android/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,6 @@ +#Thu Nov 21 13:48:17 ICT 2024 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip diff --git a/neowallet_mobile/assets/translations/en.json b/neowallet_mobile/assets/translations/en.json index 6478b69d..ddfeac73 100644 --- a/neowallet_mobile/assets/translations/en.json +++ b/neowallet_mobile/assets/translations/en.json @@ -1,6 +1,6 @@ { "Welcome":"Welcome", - "to CATHAY PAY":"to CATHAY PAY", + "to CATHAY PAY":"to NEO PAY", "Log In":"Log In", "Register":"Register", "Username":"Username", @@ -116,6 +116,21 @@ "Email ไม่ถูกต้อง":"Email is invalid", "หน้าหลัก":"Home", "สแกน":"Scan", - "ทั้งหมด":"All" + "ทั้งหมด":"All", + "สแกน QR Code NEO PAY":"Scan QR Code NEO PAY", + "สแกน Thai QR Code":"Scan Thai QR Code", + "แอปพลิเคชันทั้งหมด":"All Application", + "สมาชิก NEO PAY":"Neo Wallet", + "บัญชีธนาคาร":"Bank Account", + "โอนเงินให้สมาชิก NEO PAY":"Transfer to NEO WALLET", + "เบอร์โทรศัพท์ผู้รับ":"Mobile Phone Number/ Wallet ID", + "ชื่อ":"Receiver Name", + "เบอร์โทรศัพท์":"Phone Number", + "จำนวนเงินที่โอน / จ่าย":"Amount", + "ใช้แต้ม NEO PAY แทนเงินสด":"Pay by Point", + "คะแนนของคุณ":"Your Point", + "แต้ม":"Point", + "ยอดเงินทั้งหมด":"Total Amount", + "1 แต้ม = 10 สตางค์":"1 Point = 10 Satang" } \ No newline at end of file diff --git a/neowallet_mobile/assets/translations/th.json b/neowallet_mobile/assets/translations/th.json index 494d0c10..ef80b84b 100644 --- a/neowallet_mobile/assets/translations/th.json +++ b/neowallet_mobile/assets/translations/th.json @@ -1,6 +1,6 @@ { "Welcome":"ยินดีต้อนรับ", - "to CATHAY PAY":"สู่ CATHAY PAY", + "to CATHAY PAY":"สู่ NEO PAY", "Log In":"เข้าสู่ระบบ", "Register":"สมัครสมาชิก", "Username":"ผู้ใช้งาน", @@ -116,8 +116,22 @@ "Email ไม่ถูกต้อง":"Email ไม่ถูกต้อง", "หน้าหลัก":"หน้าหลัก", "สแกน":"สแกน", - "ทั้งหมด":"ทั้งหมด" - + "ทั้งหมด":"ทั้งหมด", + "สแกน QR Code NEO PAY":"สแกน QR Code NEO PAY", + "สแกน Thai QR Code":"สแกน Thai QR Code", + "แอปพลิเคชันทั้งหมด":"แอปพลิเคชันทั้งหมด", + "สมาชิก NEO PAY":"สมาชิก NEO PAY", + "บัญชีธนาคาร":"บัญชีธนาคาร", + "โอนเงินให้สมาชิก NEO PAY":"โอนเงินให้สมาชิก NEO PAY", + "เบอร์โทรศัพท์ผู้รับ":"เบอร์โทรศัพท์ผู้รับ", + "ชื่อ":"ชื่อ", + "เบอร์โทรศัพท์":"เบอร์โทรศัพท์", + "จำนวนเงินที่โอน / จ่าย":"จำนวนเงินที่โอน / จ่าย", + "ใช้แต้ม NEO PAY แทนเงินสด":"ใช้แต้ม NEO PAY แทนเงินสด", + "คะแนนของคุณ":"คะแนนของคุณ", + "แต้ม":"แต้ม", + "ยอดเงินทั้งหมด":"ยอดเงินทั้งหมด", + "1 แต้ม = 10 สตางค์":"1 แต้ม = 10 สตางค์" } \ No newline at end of file diff --git a/neowallet_mobile/images/home/15.png b/neowallet_mobile/images/home/15.png new file mode 100644 index 00000000..8fa4bba7 Binary files /dev/null and b/neowallet_mobile/images/home/15.png differ diff --git a/neowallet_mobile/images/home/17.png b/neowallet_mobile/images/home/17.png new file mode 100644 index 00000000..aeb1157f Binary files /dev/null and b/neowallet_mobile/images/home/17.png differ diff --git a/neowallet_mobile/images/home/19.png b/neowallet_mobile/images/home/19.png new file mode 100644 index 00000000..f2ceef29 Binary files /dev/null and b/neowallet_mobile/images/home/19.png differ diff --git a/neowallet_mobile/images/menu/22.png b/neowallet_mobile/images/menu/22.png new file mode 100644 index 00000000..a32fcaa0 Binary files /dev/null and b/neowallet_mobile/images/menu/22.png differ diff --git a/neowallet_mobile/images/menu/23.png b/neowallet_mobile/images/menu/23.png new file mode 100644 index 00000000..4ed73f23 Binary files /dev/null and b/neowallet_mobile/images/menu/23.png differ diff --git a/neowallet_mobile/images/menu/24.png b/neowallet_mobile/images/menu/24.png new file mode 100644 index 00000000..1eb6aabf Binary files /dev/null and b/neowallet_mobile/images/menu/24.png differ diff --git a/neowallet_mobile/images/menu/25.png b/neowallet_mobile/images/menu/25.png new file mode 100644 index 00000000..8dc73e84 Binary files /dev/null and b/neowallet_mobile/images/menu/25.png differ diff --git a/neowallet_mobile/images/menu/26.png b/neowallet_mobile/images/menu/26.png new file mode 100644 index 00000000..15f1ba2a Binary files /dev/null and b/neowallet_mobile/images/menu/26.png differ diff --git a/neowallet_mobile/images/menu/27.png b/neowallet_mobile/images/menu/27.png new file mode 100644 index 00000000..b4769333 Binary files /dev/null and b/neowallet_mobile/images/menu/27.png differ diff --git a/neowallet_mobile/images/menu/31.png b/neowallet_mobile/images/menu/31.png new file mode 100644 index 00000000..15b75129 Binary files /dev/null and b/neowallet_mobile/images/menu/31.png differ diff --git a/neowallet_mobile/images/menu/32.png b/neowallet_mobile/images/menu/32.png new file mode 100644 index 00000000..c3185642 Binary files /dev/null and b/neowallet_mobile/images/menu/32.png differ diff --git a/neowallet_mobile/images/register/passport_en.png b/neowallet_mobile/images/register/passport_en.png new file mode 100644 index 00000000..3e5a2fd4 Binary files /dev/null and b/neowallet_mobile/images/register/passport_en.png differ diff --git a/neowallet_mobile/images/register/passport_th.png b/neowallet_mobile/images/register/passport_th.png new file mode 100644 index 00000000..212c1392 Binary files /dev/null and b/neowallet_mobile/images/register/passport_th.png differ diff --git a/neowallet_mobile/images/register/thaicard_en.png b/neowallet_mobile/images/register/thaicard_en.png new file mode 100644 index 00000000..177ef034 Binary files /dev/null and b/neowallet_mobile/images/register/thaicard_en.png differ diff --git a/neowallet_mobile/images/register/thaicard_th.png b/neowallet_mobile/images/register/thaicard_th.png new file mode 100644 index 00000000..513ab212 Binary files /dev/null and b/neowallet_mobile/images/register/thaicard_th.png differ diff --git a/neowallet_mobile/ios/Podfile.lock b/neowallet_mobile/ios/Podfile.lock index 84d11063..1d8c41d9 100644 --- a/neowallet_mobile/ios/Podfile.lock +++ b/neowallet_mobile/ios/Podfile.lock @@ -4,8 +4,6 @@ PODS: - device_info_plus (0.0.1): - Flutter - Flutter (1.0.0) - - image_gallery_saver (2.0.2): - - Flutter - image_picker_ios (0.0.1): - Flutter - MTBBarcodeScanner (5.0.11) @@ -14,9 +12,13 @@ PODS: - path_provider_foundation (0.0.1): - Flutter - FlutterMacOS + - permission_handler_apple (9.3.0): + - Flutter - qr_code_scanner (0.2.0): - Flutter - MTBBarcodeScanner + - saver_gallery (0.0.1): + - Flutter - shared_preferences_foundation (0.0.1): - Flutter - FlutterMacOS @@ -29,11 +31,12 @@ DEPENDENCIES: - camera_avfoundation (from `.symlinks/plugins/camera_avfoundation/ios`) - device_info_plus (from `.symlinks/plugins/device_info_plus/ios`) - Flutter (from `Flutter`) - - image_gallery_saver (from `.symlinks/plugins/image_gallery_saver/ios`) - image_picker_ios (from `.symlinks/plugins/image_picker_ios/ios`) - package_info_plus (from `.symlinks/plugins/package_info_plus/ios`) - path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`) + - permission_handler_apple (from `.symlinks/plugins/permission_handler_apple/ios`) - qr_code_scanner (from `.symlinks/plugins/qr_code_scanner/ios`) + - saver_gallery (from `.symlinks/plugins/saver_gallery/ios`) - shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/darwin`) - url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`) - webview_flutter_wkwebview (from `.symlinks/plugins/webview_flutter_wkwebview/ios`) @@ -49,16 +52,18 @@ EXTERNAL SOURCES: :path: ".symlinks/plugins/device_info_plus/ios" Flutter: :path: Flutter - image_gallery_saver: - :path: ".symlinks/plugins/image_gallery_saver/ios" image_picker_ios: :path: ".symlinks/plugins/image_picker_ios/ios" package_info_plus: :path: ".symlinks/plugins/package_info_plus/ios" path_provider_foundation: :path: ".symlinks/plugins/path_provider_foundation/darwin" + permission_handler_apple: + :path: ".symlinks/plugins/permission_handler_apple/ios" qr_code_scanner: :path: ".symlinks/plugins/qr_code_scanner/ios" + saver_gallery: + :path: ".symlinks/plugins/saver_gallery/ios" shared_preferences_foundation: :path: ".symlinks/plugins/shared_preferences_foundation/darwin" url_launcher_ios: @@ -70,16 +75,17 @@ SPEC CHECKSUMS: camera_avfoundation: dd002b0330f4981e1bbcb46ae9b62829237459a4 device_info_plus: c6fb39579d0f423935b0c9ce7ee2f44b71b9fce6 Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7 - image_gallery_saver: cb43cc43141711190510e92c460eb1655cd343cb image_picker_ios: c560581cceedb403a6ff17f2f816d7fea1421fc1 MTBBarcodeScanner: f453b33c4b7dfe545d8c6484ed744d55671788cb package_info_plus: 58f0028419748fad15bf008b270aaa8e54380b1c path_provider_foundation: 2b6b4c569c0fb62ec74538f866245ac84301af46 + permission_handler_apple: 9878588469a2b0d0fc1e048d9f43605f92e6cec2 qr_code_scanner: bb67d64904c3b9658ada8c402e8b4d406d5d796e + saver_gallery: 76172dc4bf6b40e66d694948ada9ff402304dd87 shared_preferences_foundation: fcdcbc04712aee1108ac7fda236f363274528f78 url_launcher_ios: 5334b05cef931de560670eeae103fd3e431ac3fe webview_flutter_wkwebview: 2a23822e9039b7b1bc52e5add778e5d89ad488d1 PODFILE CHECKSUM: 57c8aed26fba39d3ec9424816221f294a07c58eb -COCOAPODS: 1.15.2 +COCOAPODS: 1.16.2 diff --git a/neowallet_mobile/ios/Runner.xcodeproj/project.pbxproj b/neowallet_mobile/ios/Runner.xcodeproj/project.pbxproj index deec3ac6..23203f26 100644 --- a/neowallet_mobile/ios/Runner.xcodeproj/project.pbxproj +++ b/neowallet_mobile/ios/Runner.xcodeproj/project.pbxproj @@ -141,6 +141,7 @@ 9705A1C41CF9048500538489 /* Embed Frameworks */, 3B06AD1E1E4923F5004D2608 /* Thin Binary */, 1A038E6A347A908126F4CAA5 /* [CP] Embed Pods Frameworks */, + AE4B7B02856EC8235D5750DA /* [CP] Copy Pods Resources */, ); buildRules = ( ); @@ -269,6 +270,23 @@ shellPath = /bin/sh; shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; }; + AE4B7B02856EC8235D5750DA /* [CP] Copy Pods Resources */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources-${CONFIGURATION}-input-files.xcfilelist", + ); + name = "[CP] Copy Pods Resources"; + outputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources-${CONFIGURATION}-output-files.xcfilelist", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources.sh\"\n"; + showEnvVarsInLog = 0; + }; /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ diff --git a/neowallet_mobile/ios/Runner/AppDelegate.swift b/neowallet_mobile/ios/Runner/AppDelegate.swift index 70693e4a..b6363034 100644 --- a/neowallet_mobile/ios/Runner/AppDelegate.swift +++ b/neowallet_mobile/ios/Runner/AppDelegate.swift @@ -1,7 +1,7 @@ import UIKit import Flutter -@UIApplicationMain +@main @objc class AppDelegate: FlutterAppDelegate { override func application( _ application: UIApplication, diff --git a/neowallet_mobile/ios/Runner/Info.plist b/neowallet_mobile/ios/Runner/Info.plist index 983e62d3..25115b76 100644 --- a/neowallet_mobile/ios/Runner/Info.plist +++ b/neowallet_mobile/ios/Runner/Info.plist @@ -19,11 +19,11 @@ CFBundlePackageType APPL CFBundleShortVersionString - 1.0.0 + 1.0.1 CFBundleSignature ???? CFBundleVersion - 2 + 3 LSApplicationCategoryType LSRequiresIPhoneOS diff --git a/neowallet_mobile/lib/GetPaid/GetPaid.dart b/neowallet_mobile/lib/GetPaid/GetPaid.dart index 97b24afc..85a34e58 100644 --- a/neowallet_mobile/lib/GetPaid/GetPaid.dart +++ b/neowallet_mobile/lib/GetPaid/GetPaid.dart @@ -8,11 +8,13 @@ import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:google_fonts/google_fonts.dart'; -import 'package:image_gallery_saver/image_gallery_saver.dart'; import 'package:qr_flutter/qr_flutter.dart'; +import 'package:saver_gallery/saver_gallery.dart'; import '../Home/HomePage.dart'; +import '../Home/home_bottom_menu_widget.dart'; import '../api/api.dart'; +import '../utils/color_custom.dart'; import '../utils/utils.dart'; class GetPaidPage extends StatefulWidget { @@ -47,7 +49,9 @@ class _GetPaidPageState extends State { } saveQrCode() { - ImageGallerySaver.saveImage(base64Decode(myQrCode?.qrCodeImage ?? "")); + // ImageGallerySaver.saveImage(base64Decode(myQrCode?.qrCodeImage ?? "")); + String fileName = "neopay_${DateTime.now().millisecondsSinceEpoch}.jpg"; + SaverGallery.saveImage(base64Decode(myQrCode?.qrCodeImage ?? ""), fileName: fileName, skipIfExists: false); Utils.showAlertDialog(context, "บันทึกสำเร็จ"); } @@ -255,27 +259,23 @@ class _GetPaidPageState extends State { onTap: () { saveQrCode(); }, - child: Container( + child: SizedBox( width: 147, - height: 44, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(100), - boxShadow: [ - BoxShadow( - color: Color(0x19000000), - blurRadius: 2, - offset: Offset(0.75, 1), - ), - ], - color: Color(0xff9d001b), - ), - child: Center( - child: Text( - "Save QR".tr(), - textAlign: TextAlign.center, - style: TextStyle( - color: Colors.white, - fontSize: 20, + child: Card( + color: Colors.white, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(40), + ), + child: Container( + padding: EdgeInsets.all(10), + child: Text( + "Save QR".tr(), + textAlign: TextAlign.center, + style: GoogleFonts.kanit( + color: ColorCustom.greyBorder, + fontSize: 20, + fontWeight: FontWeight.w500, + ), ), ), ), @@ -285,6 +285,8 @@ class _GetPaidPageState extends State { ) ], ), + Expanded(child: Container()), + HomeBottomMenuWidget() ], ), ), diff --git a/neowallet_mobile/lib/GetPaid/GetPaidShop.dart b/neowallet_mobile/lib/GetPaid/GetPaidShop.dart index ae599444..75082968 100644 --- a/neowallet_mobile/lib/GetPaid/GetPaidShop.dart +++ b/neowallet_mobile/lib/GetPaid/GetPaidShop.dart @@ -3,14 +3,16 @@ import 'dart:convert'; import 'package:cathaypay_mobile/GetPaid/GetPaidByAmount.dart'; import 'package:cathaypay_mobile/TopUp/TopUpMenuPage.dart'; import 'package:cathaypay_mobile/model/qrcode.dart'; +import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:google_fonts/google_fonts.dart'; -import 'package:image_gallery_saver/image_gallery_saver.dart'; import 'package:qr_flutter/qr_flutter.dart'; +import 'package:saver_gallery/saver_gallery.dart'; import '../Home/HomePage.dart'; import '../api/api.dart'; +import '../utils/color_custom.dart'; import '../utils/utils.dart'; import 'GetPaidShopByAmount.dart'; @@ -55,7 +57,8 @@ class _GetPaidPageState extends State { } saveQrCode() { - ImageGallerySaver.saveImage(base64Decode(myQrCode?.qrCodeImage ?? "")); + String fileName = "neopay_${DateTime.now().millisecondsSinceEpoch}.jpg"; + SaverGallery.saveImage(base64Decode(myQrCode?.qrCodeImage ?? ""), fileName: fileName, skipIfExists: false); Utils.showAlertDialog(context, "บันทึกสำเร็จ"); } @@ -263,27 +266,23 @@ class _GetPaidPageState extends State { onTap: () { saveQrCode(); }, - child: Container( + child: SizedBox( width: 147, - height: 44, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(100), - boxShadow: [ - BoxShadow( - color: Color(0x19000000), - blurRadius: 2, - offset: Offset(0.75, 1), - ), - ], - color: Color(0xff9d001b), - ), - child: Center( - child: Text( - "บันทึก QR", - textAlign: TextAlign.center, - style: TextStyle( - color: Colors.white, - fontSize: 20, + child: Card( + color: Colors.white, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(40), + ), + child: Container( + padding: EdgeInsets.all(10), + child: Text( + "Save QR".tr(), + textAlign: TextAlign.center, + style: GoogleFonts.kanit( + color: ColorCustom.greyBorder, + fontSize: 20, + fontWeight: FontWeight.w500, + ), ), ), ), diff --git a/neowallet_mobile/lib/Home/HomePage.dart b/neowallet_mobile/lib/Home/HomePage.dart index 405ff220..5268ece0 100644 --- a/neowallet_mobile/lib/Home/HomePage.dart +++ b/neowallet_mobile/lib/Home/HomePage.dart @@ -1,4 +1,5 @@ import 'dart:convert'; +import 'dart:io'; import 'package:carousel_slider/carousel_slider.dart'; import 'package:cathaypay_mobile/GetPaid/GetPaid.dart'; @@ -9,9 +10,11 @@ import 'package:cathaypay_mobile/TopUp/TopUpMenuPage.dart'; import 'package:cathaypay_mobile/TransferMoney/TransferMoneyMenu.dart'; import 'package:cathaypay_mobile/model/banner_model.dart'; import 'package:cathaypay_mobile/model/profile_model.dart'; +import 'package:device_info_plus/device_info_plus.dart'; import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:google_fonts/google_fonts.dart'; +import 'package:permission_handler/permission_handler.dart'; import 'package:pull_to_refresh_flutter3/pull_to_refresh_flutter3.dart'; import 'package:shared_preferences/shared_preferences.dart'; import 'package:url_launcher/url_launcher.dart'; @@ -19,6 +22,7 @@ import 'package:url_launcher/url_launcher.dart'; import '../api/api.dart'; import '../model/promotion_model.dart'; import '../model/token_model.dart'; +import '../utils/color_custom.dart'; import '../utils/utils.dart'; Profile? profile; @@ -40,9 +44,38 @@ class _HomePageState extends State { getTokenAdmin(); getBanner(); getPromotion(); + checkAndRequestPermissions(skipIfExists: true); super.initState(); } + Future checkAndRequestPermissions({required bool skipIfExists}) async { + if (!Platform.isAndroid && !Platform.isIOS) { + return false; // Only Android and iOS platforms are supported + } + + if (Platform.isAndroid) { + final deviceInfo = await DeviceInfoPlugin().androidInfo; + final sdkInt = deviceInfo.version.sdkInt; + + if (skipIfExists) { + // Read permission is required to check if the file already exists + return sdkInt >= 33 + ? await Permission.photos.request().isGranted + : await Permission.storage.request().isGranted; + } else { + // No read permission required for Android SDK 29 and above + return sdkInt >= 29 ? true : await Permission.storage.request().isGranted; + } + } else if (Platform.isIOS) { + // iOS permission for saving images to the gallery + return skipIfExists + ? await Permission.photos.request().isGranted + : await Permission.photosAddOnly.request().isGranted; + } + + return false; // Unsupported platforms + } + Future getProfile() async { Api.get(context, Api.profile).then((value) => { if (value != null) {initProfile(value)} else {clearProfile()} @@ -206,13 +239,13 @@ class _HomePageState extends State { children: [ context.locale.toString() == "th" ? Image.asset( - "images/home/lang_20.png", - width: 20, - ) + "images/home/lang_20.png", + width: 20, + ) : Image.asset( - "images/home/lang_21.png", - width: 20, - ), + "images/home/lang_21.png", + width: 20, + ), SizedBox( width: 5, ), @@ -391,7 +424,7 @@ class _HomePageState extends State { ], ), ), - /* Container( + /* Container( child: Column( crossAxisAlignment: CrossAxisAlignment.center, mainAxisSize: MainAxisSize.max, @@ -485,7 +518,7 @@ class _HomePageState extends State { ], ), )*/ - HomeBottomMenuWidget() + HomeBottomMenuWidget() ], ), ), @@ -609,44 +642,39 @@ class _CardHomePageState extends State { return SafeArea(child: TopUpMenuPage()); }); }, - child: Container( + child: SizedBox( width: 160, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(100), - boxShadow: [ - BoxShadow( - color: Color(0x19000000), - blurRadius: 4, - offset: Offset(1, 1), - ), - ], - color: Color(0xffd0315a), - ), - padding: const EdgeInsets.symmetric( - horizontal: 12, - vertical: 15, - ), - child: Row( - mainAxisSize: MainAxisSize.min, - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - SizedBox( - height: 30, - child: Text( - "Wallet Topup".tr(), - style: GoogleFonts.kanit( - color: Colors.white, - fontSize: 18, + child: Card( + color: Colors.white, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(40), + ), + child: Container( + padding: EdgeInsets.all(10), + child: Row( + mainAxisSize: MainAxisSize.min, + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + SizedBox( + height: 30, + child: Text( + "Wallet Topup".tr(), + style: GoogleFonts.kanit( + color: ColorCustom.red, + fontSize: 18, + ), + ), ), - ), + Spacer(), + Image( + image: AssetImage('images/home/icon_plus.png'), + fit: BoxFit.cover, + color: ColorCustom.red, + ) + ], ), - Spacer(), - Image( - image: AssetImage('images/home/icon_plus.png'), - fit: BoxFit.cover, - ) - ], + ), ), ), ), @@ -749,48 +777,43 @@ class _CardHomePageState extends State { return SafeArea(child: PayPage()); }); }, - child: Container( + child: SizedBox( width: 160, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(100), - boxShadow: [ - BoxShadow( - color: Color(0x19000000), - blurRadius: 4, - offset: Offset(1, 1), - ), - ], - color: Color(0xfff2f2f2), - ), - padding: const EdgeInsets.symmetric( - horizontal: 12, - vertical: 15, - ), - child: Row( - mainAxisSize: MainAxisSize.min, - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - SizedBox( - height: 30, - child: Text( - "Pay".tr(), - style: GoogleFonts.kanit( - color: Color(0xffd0315a), - fontSize: 18, + child: Card( + color: Colors.white, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(40), + ), + child: Container( + padding: EdgeInsets.all(10), + child: Row( + mainAxisSize: MainAxisSize.min, + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + SizedBox( + height: 30, + child: Text( + "Pay".tr(), + style: GoogleFonts.kanit( + color: ColorCustom.red, + fontSize: 18, + ), + ), ), - ), + Spacer(), + Container( + width: 21, + height: 21, + child: Image( + image: AssetImage('images/home/icon_qr.png'), + fit: BoxFit.cover, + color: ColorCustom.red, + ), + ) + ], ), - Spacer(), - Container( - width: 21, - height: 21, - child: Image( - image: AssetImage('images/home/icon_qr.png'), - fit: BoxFit.cover, - ), - ) - ], + ), ), ), ), @@ -819,43 +842,25 @@ class _MenuHomePageState extends State { Row( crossAxisAlignment: CrossAxisAlignment.center, children: [ - Expanded(child: InkWell( - onTap: () { - showModalBottomSheet( - context: context, - isScrollControlled: true, - useSafeArea: true, - builder: (BuildContext context) { - return GetPaidPage(); - }); - }, - child: Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(10), - color: Colors.white, - ), - child: Column( - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Image( - width: 50, - height: 50, - image: AssetImage('images/home/1.png'), - fit: BoxFit.cover, - ), - Text( - "Receive Money".tr(), - textAlign: TextAlign.center, - style: GoogleFonts.kanit( - color: Color(0xff65676b), - fontSize: 13, - ), - ), - ], + Expanded( + child: InkWell( + onTap: () { + showModalBottomSheet( + context: context, + isScrollControlled: true, + useSafeArea: true, + builder: (BuildContext context) { + return GetPaidPage(); + }); + }, + child: Image( + width: 80, + height: 80, + image: context.locale.toString() == "th" ? AssetImage('images/menu/27.png') : AssetImage('images/menu/22.png'), + fit: BoxFit.fitHeight, + ), ), ), - ),), /* InkWell( onTap: () { showModalBottomSheet( @@ -898,83 +903,47 @@ class _MenuHomePageState extends State { SizedBox( width: 10, ), - Expanded(child: InkWell( - onTap: () { - showModalBottomSheet( - context: context, - isScrollControlled: true, - useSafeArea: true, - builder: (BuildContext context) { - return TransferMoneyMenuPage(); - }); - }, - child: Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(10), - color: Colors.white, - ), - child: Column( - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Image( - width: 50, - height: 50, - image: AssetImage('images/home/2.png'), - fit: BoxFit.cover, - ), - Text( - "Transfer Money".tr(), - textAlign: TextAlign.center, - style: GoogleFonts.kanit( - color: Color(0xff65676b), - fontSize: 13, - ), - ), - ], - ), - ), - ),), + Expanded( + child: InkWell( + onTap: () { + showModalBottomSheet( + context: context, + isScrollControlled: true, + useSafeArea: true, + builder: (BuildContext context) { + return TransferMoneyMenuPage(); + }); + }, + child: Image( + width: 80, + height: 80, + image: context.locale.toString() == "th" ? AssetImage('images/menu/26.png') : AssetImage('images/menu/23.png'), + fit: BoxFit.fitHeight, + ), + ), + ), SizedBox( width: 10, ), - Expanded(child: InkWell( - onTap: () { - showModalBottomSheet( - context: context, - isScrollControlled: true, - useSafeArea: true, - builder: (BuildContext context) { - return PayPage(); - }); - }, - child: Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(10), - color: Colors.white, - ), - child: Column( - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Image( - width: 50, - height: 50, - image: AssetImage('images/home/5.png'), - fit: BoxFit.cover, - ), - Text( - "Pay".tr(), - textAlign: TextAlign.center, - style: GoogleFonts.kanit( - color: Color(0xff65676b), - fontSize: 13, - ), - ), - ], - ), - ), - ),), + Expanded( + child: InkWell( + onTap: () { + showModalBottomSheet( + context: context, + isScrollControlled: true, + useSafeArea: true, + builder: (BuildContext context) { + return PayPage(); + }); + }, + child: Image( + width: 80, + height: 80, + image: context.locale.toString() == "th" ? AssetImage('images/menu/25.png') : AssetImage('images/menu/24.png'), + fit: BoxFit.fitHeight, + ), + ), + ), /* InkWell( onTap: () { showModalBottomSheet( diff --git a/neowallet_mobile/lib/Home/all_menu.dart b/neowallet_mobile/lib/Home/all_menu.dart new file mode 100644 index 00000000..5f7c1d38 --- /dev/null +++ b/neowallet_mobile/lib/Home/all_menu.dart @@ -0,0 +1,169 @@ +import 'package:cathaypay_mobile/Home/HomePage.dart'; +import 'package:cathaypay_mobile/Home/home_bottom_menu_widget.dart'; +import 'package:cathaypay_mobile/model/menu_icon_model.dart'; +import 'package:easy_localization/easy_localization.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:google_fonts/google_fonts.dart'; +import 'package:url_launcher/url_launcher.dart'; + +import '../GetPaid/GetPaid.dart'; +import '../Pay/PayPage.dart'; +import '../TopUp/TopUpMenuPage.dart'; +import '../TransferMoney/TransferMoneyMenu.dart'; +import '../api/api.dart'; + +class AllMenuPage extends StatefulWidget { + const AllMenuPage({Key? key}) : super(key: key); + + @override + State createState() => _PolicyPageState(); +} + +class _PolicyPageState extends State { + var controller; + + @override + void initState() { + WidgetsBinding.instance.addPostFrameCallback((_) async { + if (context.locale.toString() == "th") { + listMenu.add(MenuIconModel(fileUrl: "images/menu/27.png", localID: 0)); + listMenu.add(MenuIconModel(fileUrl: "images/menu/26.png", localID: 1)); + listMenu.add(MenuIconModel(fileUrl: "images/menu/25.png", localID: 2)); + listMenu.add(MenuIconModel(fileUrl: "images/menu/31.png", localID: 3)); + } else { + listMenu.add(MenuIconModel(fileUrl: "images/menu/22.png", localID: 0)); + listMenu.add(MenuIconModel(fileUrl: "images/menu/23.png", localID: 1)); + listMenu.add(MenuIconModel(fileUrl: "images/menu/24.png", localID: 2)); + listMenu.add(MenuIconModel(fileUrl: "images/menu/32.png", localID: 3)); + } + + getMenu(); + }); + + super.initState(); + } + + List listMenu = []; + + getMenu() { + Api.get(context, Api.menuIcons).then((value) => { + if (value != null) + { + setState(() { + value.forEach((v) { + listMenu.add(MenuIconModel.fromJson(v)); + }); + }) + } + else + {} + }); + } + + Future _launchUrl(String url) async { + if (!await launchUrl(Uri.parse(url))) { + throw Exception('Could not launch $url'); + } + } + + @override + Widget build(BuildContext context) { + return Scaffold( + // extendBodyBehindAppBar: true, + + appBar: AppBar( + backgroundColor: Colors.transparent, + leading: CupertinoButton( + onPressed: () { + Navigator.pop(context); + }, + child: const Icon( + Icons.arrow_back, + color: Colors.black54, + ), + ), + elevation: 0, + centerTitle: true, + title: Text( + "แอปพลิเคชันทั้งหมด".tr(), + textAlign: TextAlign.center, + style: GoogleFonts.kanit( + color: Colors.black, + fontSize: 20, + ), + ), + ), + body: SafeArea( + child: Column( + children: [ + Expanded( + child: Padding( + padding: const EdgeInsets.all(20.0), + child: GridView.count( + physics: const NeverScrollableScrollPhysics(), + shrinkWrap: true, + crossAxisCount: 4, + childAspectRatio: 1 / 1, + mainAxisSpacing: 5.0, + crossAxisSpacing: 5.0, + children: listMenu.map((MenuIconModel promo) { + return InkWell( + onTap: () { + switch (promo.localID) { + case 0: + showModalBottomSheet( + context: context, + isScrollControlled: true, + useSafeArea: true, + builder: (BuildContext context) { + return GetPaidPage(); + }); + break; + case 1: + showModalBottomSheet( + context: context, + isScrollControlled: true, + useSafeArea: true, + builder: (BuildContext context) { + return TransferMoneyMenuPage(); + }); + break; + case 2: + showModalBottomSheet( + context: context, + isScrollControlled: true, + useSafeArea: true, + builder: (BuildContext context) { + return PayPage(); + }); + break; + case 3: + showModalBottomSheet( + context: context, + isScrollControlled: true, + useSafeArea: true, + builder: (BuildContext context) { + return SafeArea(child: TopUpMenuPage()); + }); + break; + } + String url = "${promo.link}?token=${promo.token}&id=${profile?.id}&mobile=${profile?.phoneNumber}&email=${profile?.email}"; + print(url); + _launchUrl( url); + }, + child: promo.fileUrl != null + ? promo.fileUrl!.startsWith("http") + ? Image.network(promo.fileUrl ?? "") + : Image.asset(promo.fileUrl ?? "") + : Container(), + ); + }).toList()), + ), + ), + HomeBottomMenuWidget() + ], + )), + ); + } +} diff --git a/neowallet_mobile/lib/Home/home_bottom_menu_widget.dart b/neowallet_mobile/lib/Home/home_bottom_menu_widget.dart index 3fccd69f..27b9ed75 100644 --- a/neowallet_mobile/lib/Home/home_bottom_menu_widget.dart +++ b/neowallet_mobile/lib/Home/home_bottom_menu_widget.dart @@ -1,3 +1,4 @@ +import 'package:cathaypay_mobile/Home/all_menu.dart'; import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; @@ -27,7 +28,7 @@ class _HomePageState extends State { children: [ Container( width: MediaQuery.of(context).size.width, - padding: EdgeInsets.all(20), + padding: EdgeInsets.all(10), decoration: BoxDecoration( boxShadow: [BoxShadow(color: Color.fromRGBO(0, 0, 0, 0.07999999821186066), offset: Offset(0, -4), blurRadius: 4)], color: Color.fromRGBO(255, 255, 255, 1), @@ -42,10 +43,10 @@ class _HomePageState extends State { mainAxisAlignment: MainAxisAlignment.center, children: [ Container( - height: 35, - width: 35, + height: 45, + width: 45, child: Image( - image: AssetImage('images/home/1.home.png'), + image: AssetImage('images/home/15.png'), fit: BoxFit.cover, ), ), @@ -70,10 +71,10 @@ class _HomePageState extends State { mainAxisAlignment: MainAxisAlignment.center, children: [ Container( - height: 35, - width: 35, + height: 45, + width: 45, child: Image( - image: AssetImage('images/home/2.scan.png'), + image: AssetImage('images/home/17.png'), fit: BoxFit.cover, ), ), @@ -101,17 +102,24 @@ class _HomePageState extends State { ), InkWell( onTap: () { - // clearProfile(); + Navigator.popUntil(context, ModalRoute.withName('/')); + Navigator.pushNamed(context, '/HomePage'); + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => AllMenuPage(), + ), + ); }, child: Column( crossAxisAlignment: CrossAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center, children: [ Container( - height: 35, - width: 35, + height: 45, + width: 45, child: Image( - image: AssetImage('images/home/3.all.png'), + image: AssetImage('images/home/19.png'), fit: BoxFit.cover, ), ), diff --git a/neowallet_mobile/lib/Login/Login.dart b/neowallet_mobile/lib/Login/Login.dart index b01c1eb9..38bbcf1c 100644 --- a/neowallet_mobile/lib/Login/Login.dart +++ b/neowallet_mobile/lib/Login/Login.dart @@ -8,7 +8,6 @@ import 'package:package_info_plus/package_info_plus.dart'; import 'package:shared_preferences/shared_preferences.dart'; import '../PinCodeVadidate.dart'; -import '../Register/register_data.dart'; import '../api/api.dart'; import '../model/token_model.dart'; import '../utils/color_custom.dart'; @@ -41,13 +40,9 @@ class _LoginPageState extends State { } Future getProfile() async { - Api.get(context, Api.profile).then((value) => - { - if (value != null) { - initProfile() - } else - {clearProfile()} - }); + Api.get(context, Api.profile).then((value) => { + if (value != null) {initProfile()} else {clearProfile()} + }); } initProfile() async { @@ -69,9 +64,7 @@ class _LoginPageState extends State { } refresh() { - setState(() { - - }); + setState(() {}); } String version = ""; @@ -90,15 +83,11 @@ class _LoginPageState extends State { return Scaffold( body: Stack(children: [ Container( - width: MediaQuery - .of(context) - .size - .width, - height: MediaQuery - .of(context) - .size - .height, - child: Container(color: Colors.white,), + width: MediaQuery.of(context).size.width, + height: MediaQuery.of(context).size.height, + child: Container( + color: Colors.white, + ), ), Column( children: [ @@ -124,10 +113,7 @@ class _LoginPageState extends State { child: Column( children: [ Container( - width: MediaQuery - .of(context) - .size - .width, + width: MediaQuery.of(context).size.width, child: Row( children: [ Expanded( @@ -168,8 +154,15 @@ class _LoginPageState extends State { } refresh(); }, - child: context.locale.toString() == "th"?Image.asset("images/home/lang_1.png",width: 80,):Image.asset("images/home/lang_2.png",width: 80,) - ) + child: context.locale.toString() == "th" + ? Image.asset( + "images/home/lang_1.png", + width: 80, + ) + : Image.asset( + "images/home/lang_2.png", + width: 80, + )) ], )), Spacer(), @@ -177,41 +170,29 @@ class _LoginPageState extends State { onTap: () { Navigator.pushNamed(context, '/LoginValidate'); }, - child: Container( - width: MediaQuery - .of(context) - .size - .width, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(40), - border: Border.all( - color: Color(0xff9d001b), - width: 1, + child: SizedBox( + width: double.infinity, + child: Card( + color: Colors.white, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(40), + side: BorderSide(color: ColorCustom.red, width: 1) ), - ), - padding: const EdgeInsets.symmetric( - horizontal: 10, - vertical: 12, - ), - child: Row( - mainAxisSize: MainAxisSize.min, - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - SizedBox( - child: Text( - "Log In".tr(), - textAlign: TextAlign.center, - style: GoogleFonts.kanit( - color: Color(0xff9d001b), - fontSize: 20, - fontWeight: FontWeight.w300, - ), + child: Container( + padding: EdgeInsets.all(10), + child: Text( + "Log In".tr(), + textAlign: TextAlign.center, + style: GoogleFonts.kanit( + color: ColorCustom.red, + fontSize: 20, + fontWeight: FontWeight.w500, ), ), - ], + ), ), ), + ), SizedBox(height: 10), InkWell( @@ -229,36 +210,25 @@ class _LoginPageState extends State { ), ); }, - child: Container( - width: MediaQuery - .of(context) - .size - .width, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(40), - color: Color(0xffd0315a), - ), - padding: const EdgeInsets.symmetric( - horizontal: 10, - vertical: 12, - ), - child: Row( - mainAxisSize: MainAxisSize.min, - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - SizedBox( - child: Text( - "Register".tr(), - textAlign: TextAlign.center, - style: GoogleFonts.kanit( - color: Colors.white, - fontSize: 20, - fontWeight: FontWeight.w500, - ), + child: SizedBox( + width: double.infinity, + child: Card( + color: Colors.white, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(40), + ), + child: Container( + padding: EdgeInsets.all(10), + child: Text( + "Register".tr(), + textAlign: TextAlign.center, + style: GoogleFonts.kanit( + color: ColorCustom.red, + fontSize: 20, + fontWeight: FontWeight.w500, ), ), - ], + ), ), ), ), diff --git a/neowallet_mobile/lib/Login/LoginValidate.dart b/neowallet_mobile/lib/Login/LoginValidate.dart index 43157533..6415bed0 100644 --- a/neowallet_mobile/lib/Login/LoginValidate.dart +++ b/neowallet_mobile/lib/Login/LoginValidate.dart @@ -14,6 +14,7 @@ import 'package:package_info_plus/package_info_plus.dart'; import 'package:shared_preferences/shared_preferences.dart'; import '../api/api.dart'; +import '../utils/color_custom.dart'; TokenModel? tokenModel; @@ -106,7 +107,7 @@ class _LoginValidateState extends State { // TextEditingController username = TextEditingController(text: "admin"); // TextEditingController password = TextEditingController(text: "P@ssword1"); - // TextEditingController username = TextEditingController(text: "toontest"); + // TextEditingController username = TextEditingController(text: "nataphonpan"); // TextEditingController password = TextEditingController(text: "123456Aa"); TextEditingController username = TextEditingController(); TextEditingController password = TextEditingController(); @@ -229,28 +230,25 @@ class _LoginValidateState extends State { } authen(context); }, - child: Container( - width: 374, - height: 48, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(100), - color: Color(0xff9d001b), - ), - child: Row( - mainAxisSize: MainAxisSize.min, - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Text( + child: SizedBox( + width: double.infinity, + child: Card( + color: Colors.white, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(40), + ), + child: Container( + padding: EdgeInsets.all(10), + child: Text( "Next".tr(), textAlign: TextAlign.center, style: GoogleFonts.kanit( - color: Colors.white, + color: ColorCustom.greyBorder, fontSize: 20, fontWeight: FontWeight.w500, ), ), - ], + ), ), ), ), diff --git a/neowallet_mobile/lib/Pay/PayPage.dart b/neowallet_mobile/lib/Pay/PayPage.dart index 6e087ed4..c7cd5841 100644 --- a/neowallet_mobile/lib/Pay/PayPage.dart +++ b/neowallet_mobile/lib/Pay/PayPage.dart @@ -299,7 +299,7 @@ class _PayPageState extends State { ), Expanded( child: Text( - "สแกน QR Code CATHAY PAY".tr(), + "สแกน QR Code NEO PAY".tr(), maxLines: 1, overflow: TextOverflow.ellipsis, style: TextStyle( diff --git a/neowallet_mobile/lib/Pay/PayPromptPay.dart b/neowallet_mobile/lib/Pay/PayPromptPay.dart index 013e1e9e..474c4b45 100644 --- a/neowallet_mobile/lib/Pay/PayPromptPay.dart +++ b/neowallet_mobile/lib/Pay/PayPromptPay.dart @@ -13,6 +13,7 @@ import 'package:mask_text_input_formatter/mask_text_input_formatter.dart'; import '../TransferMoney/TransferPromtptPayDialog.dart'; import '../api/api.dart'; +import '../utils/color_custom.dart'; class PayPromptPay extends StatefulWidget { const PayPromptPay({Key? key}) : super(key: key); @@ -97,36 +98,24 @@ class _TransferPromptPayState extends State { }); }, child: Container( - margin: EdgeInsets.only(left: 20, right: 20), - width: MediaQuery.of(context).size.width, - height: 51, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(40), - color: Color(0xff9d001b), - ), - padding: const EdgeInsets.symmetric( - horizontal: 10, - vertical: 12, - ), - child: Row( - mainAxisSize: MainAxisSize.min, - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - SizedBox( - width: 106, - height: 32, - child: Text( - "Next".tr(), - textAlign: TextAlign.center, - style: GoogleFonts.kanit( - color: Colors.white, - fontSize: 20, - fontWeight: FontWeight.w500, - ), + width: double.infinity, + margin: const EdgeInsets.symmetric(horizontal: 15), + child: Card( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(40), + ), + child: Container( + padding: EdgeInsets.all(10), + child: Text( + "Next".tr(), + textAlign: TextAlign.center, + style: GoogleFonts.kanit( + color: ColorCustom.greyBorder, + fontSize: 20, + fontWeight: FontWeight.w500, ), ), - ], + ), ), ), ), @@ -425,36 +414,24 @@ class _TransferPromptPayDetailState extends State { Utils.showAlertDialog(context, "Price must more than 10 Baht"); } }, - child: Container( - width: MediaQuery.of(context).size.width, - height: 51, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(40), - color: Color(0xff9d001b), - ), - padding: const EdgeInsets.symmetric( - horizontal: 10, - vertical: 12, - ), - child: Row( - mainAxisSize: MainAxisSize.min, - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - SizedBox( - width: 106, - height: 32, - child: Text( - "Confirm".tr(), - textAlign: TextAlign.center, - style: GoogleFonts.kanit( - color: Colors.white, - fontSize: 20, - fontWeight: FontWeight.w500, - ), + child: SizedBox( + width: double.infinity, + child: Card( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(40), + ), + child: Container( + padding: EdgeInsets.all(10), + child: Text( + "Confirm".tr(), + textAlign: TextAlign.center, + style: GoogleFonts.kanit( + color: ColorCustom.greyBorder, + fontSize: 20, + fontWeight: FontWeight.w500, ), ), - ], + ), ), ), ), diff --git a/neowallet_mobile/lib/Pay/PayQr.dart b/neowallet_mobile/lib/Pay/PayQr.dart index 228005fb..372e8d64 100644 --- a/neowallet_mobile/lib/Pay/PayQr.dart +++ b/neowallet_mobile/lib/Pay/PayQr.dart @@ -4,14 +4,15 @@ import 'package:cathaypay_mobile/Home/HomePage.dart'; import 'package:cathaypay_mobile/Pay/PayQrDialog.dart'; import 'package:cathaypay_mobile/PinCodeVadidate.dart'; import 'package:cathaypay_mobile/utils/utils.dart'; +import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:google_fonts/google_fonts.dart'; -import 'package:intl/intl.dart'; import 'package:qr_code_scanner/qr_code_scanner.dart'; import '../api/api.dart'; +import '../utils/color_custom.dart'; class PayQrPage extends StatefulWidget { const PayQrPage({Key? key, required this.code}) : super(key: key); @@ -184,7 +185,7 @@ class _PayQrPageState extends State { ], elevation: 0, title: Text( - "จ่ายเงิน", + "Pay".tr(), textAlign: TextAlign.center, style: GoogleFonts.kanit( color: Colors.black, @@ -201,7 +202,7 @@ class _PayQrPageState extends State { mainAxisAlignment: MainAxisAlignment.start, children: [ Text( - "ชื่อ", + "ชื่อ".tr(), style: TextStyle( color: Color(0xff65676b), fontSize: 16, @@ -240,7 +241,7 @@ class _PayQrPageState extends State { Row( children: [ Text( - "เบอร์โทรศัพท์", + "เบอร์โทรศัพท์".tr(), style: TextStyle( color: Color(0xff65676b), fontSize: 14, @@ -262,7 +263,7 @@ class _PayQrPageState extends State { height: 10, ), Text( - "จำนวนเงินที่โอน / จ่าย", + "จำนวนเงินที่โอน / จ่าย".tr(), style: TextStyle( color: Color(0xff65676b), fontSize: 16, @@ -318,7 +319,7 @@ class _PayQrPageState extends State { controller: price, style: TextStyle(fontSize: 24), decoration: InputDecoration( - hintText: 'จำนวนเงินที่โอน', + hintText: "จำนวนเงินที่โอน / จ่าย".tr(), border: InputBorder.none, contentPadding: EdgeInsets.symmetric(horizontal: 16), ), @@ -328,7 +329,7 @@ class _PayQrPageState extends State { height: 10, ), Text( - "ใช้แต้ม Cathay Pay แทนเงินสด", + "ใช้แต้ม NEO PAY แทนเงินสด".tr(), style: TextStyle( color: Color(0xff65676b), fontSize: 16, @@ -336,7 +337,7 @@ class _PayQrPageState extends State { ), ), Text( - "คะแนนของคุณ : 12,000 แต้ม", + "${"คะแนนของคุณ".tr()} : 12,000 ${"แต้ม".tr()}", style: TextStyle( color: Color(0xff9d001b), fontSize: 14, @@ -361,7 +362,7 @@ class _PayQrPageState extends State { crossAxisAlignment: CrossAxisAlignment.center, children: [ Text( - "0 แต้ม", + "10 ${"แต้ม".tr()}", textAlign: TextAlign.right, style: TextStyle( color: Color(0xff65676b), @@ -395,7 +396,7 @@ class _PayQrPageState extends State { crossAxisAlignment: CrossAxisAlignment.center, children: [ Text( - "0 บาท", + "100 ${"Baht".tr()}", textAlign: TextAlign.right, style: TextStyle( color: Colors.white, @@ -408,7 +409,7 @@ class _PayQrPageState extends State { ), Center( child: Text( - "1 แต้ม = 10 สตางค์", + "1 แต้ม = 10 สตางค์".tr(), textAlign: TextAlign.center, style: TextStyle( color: Color(0xff65676b), @@ -418,6 +419,8 @@ class _PayQrPageState extends State { ), ), Container( + height: 136, + color: Colors.transparent, child: Column( children: [ SizedBox( @@ -426,7 +429,7 @@ class _PayQrPageState extends State { Row( children: [ Text( - "ยอดเงินทั้งหมด", + "ยอดเงินทั้งหมด".tr(), style: TextStyle( color: Color(0xff65676b), fontSize: 16, @@ -443,7 +446,7 @@ class _PayQrPageState extends State { ), ), Text( - " บาท", + " ${"Baht".tr()}", textAlign: TextAlign.right, style: TextStyle( color: Color(0xff65676b), @@ -465,36 +468,24 @@ class _PayQrPageState extends State { checkTypePay(); } }, - child: Container( - width: MediaQuery.of(context).size.width, - height: 51, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(40), - color: Color(0xff9d001b), - ), - padding: const EdgeInsets.symmetric( - horizontal: 10, - vertical: 12, - ), - child: Row( - mainAxisSize: MainAxisSize.min, - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - SizedBox( - width: 106, - height: 32, - child: Text( - "ยืนยัน", - textAlign: TextAlign.center, - style: GoogleFonts.kanit( - color: Colors.white, - fontSize: 20, - fontWeight: FontWeight.w500, - ), + child: SizedBox( + width: double.infinity, + child: Card( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(40), + ), + child: Container( + padding: EdgeInsets.all(10), + child: Text( + "Confirm".tr(), + textAlign: TextAlign.center, + style: GoogleFonts.kanit( + color: ColorCustom.greyBorder, + fontSize: 20, + fontWeight: FontWeight.w500, ), ), - ], + ), ), ), ), @@ -503,8 +494,6 @@ class _PayQrPageState extends State { ), ], ), - height: 136, - color: Colors.transparent, ), SizedBox( height: 10, diff --git a/neowallet_mobile/lib/Pay/PayThaiQr.dart b/neowallet_mobile/lib/Pay/PayThaiQr.dart index 395cb42d..1e2fd9f9 100644 --- a/neowallet_mobile/lib/Pay/PayThaiQr.dart +++ b/neowallet_mobile/lib/Pay/PayThaiQr.dart @@ -1,10 +1,12 @@ import 'dart:convert'; +import 'package:cathaypay_mobile/GetPaid/GetPaid.dart'; import 'package:cathaypay_mobile/Home/HomePage.dart'; import 'package:cathaypay_mobile/Pay/PayQrDialog.dart'; import 'package:cathaypay_mobile/PinCodeVadidate.dart'; import 'package:cathaypay_mobile/main.dart'; import 'package:cathaypay_mobile/utils/utils.dart'; +import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; @@ -13,6 +15,7 @@ import 'package:intl/intl.dart'; import 'package:qr_code_scanner/qr_code_scanner.dart'; import '../api/api.dart'; +import '../utils/color_custom.dart'; class PayThaiQr extends StatefulWidget { const PayThaiQr({Key? key, required this.code}) : super(key: key); @@ -95,7 +98,7 @@ class _PayQrPageState extends State { ], elevation: 0, title: Text( - "จ่ายเงิน", + "Pay".tr(), textAlign: TextAlign.center, style: GoogleFonts.kanit( color: Colors.black, @@ -112,7 +115,7 @@ class _PayQrPageState extends State { mainAxisAlignment: MainAxisAlignment.start, children: [ Text( - "จำนวนเงินที่โอน / จ่าย", + "จำนวนเงินที่โอน / จ่าย".tr(), style: TextStyle( color: Color(0xff65676b), fontSize: 16, @@ -168,7 +171,7 @@ class _PayQrPageState extends State { controller: price, style: TextStyle(fontSize: 24), decoration: InputDecoration( - hintText: 'จำนวนเงินที่โอน', + hintText: "จำนวนเงินที่โอน / จ่าย".tr(), border: InputBorder.none, contentPadding: EdgeInsets.symmetric(horizontal: 16), ), @@ -178,7 +181,7 @@ class _PayQrPageState extends State { height: 10, ), Text( - "ใช้แต้ม Cathay Pay แทนเงินสด", + "ใช้แต้ม NEO PAY แทนเงินสด".tr(), style: TextStyle( color: Color(0xff65676b), fontSize: 16, @@ -186,7 +189,7 @@ class _PayQrPageState extends State { ), ), Text( - "คะแนนของคุณ : 12,000 แต้ม", + "${"คะแนนของคุณ".tr()} : 12,000 ${"แต้ม".tr()}", style: TextStyle( color: Color(0xff9d001b), fontSize: 14, @@ -211,7 +214,7 @@ class _PayQrPageState extends State { crossAxisAlignment: CrossAxisAlignment.center, children: [ Text( - "0 แต้ม", + "10 ${"แต้ม".tr()}", textAlign: TextAlign.right, style: TextStyle( color: Color(0xff65676b), @@ -245,7 +248,7 @@ class _PayQrPageState extends State { crossAxisAlignment: CrossAxisAlignment.center, children: [ Text( - "0 บาท", + "100 ${"Baht".tr()}", textAlign: TextAlign.right, style: TextStyle( color: Colors.white, @@ -258,7 +261,7 @@ class _PayQrPageState extends State { ), Center( child: Text( - "1 แต้ม = 10 สตางค์", + "1 แต้ม = 10 สตางค์".tr(), textAlign: TextAlign.center, style: TextStyle( color: Color(0xff65676b), @@ -278,7 +281,7 @@ class _PayQrPageState extends State { Row( children: [ Text( - "ยอดเงินทั้งหมด", + "ยอดเงินทั้งหมด".tr(), style: TextStyle( color: Color(0xff65676b), fontSize: 16, @@ -295,7 +298,7 @@ class _PayQrPageState extends State { ), ), Text( - " บาท", + " ${"Baht".tr()}", textAlign: TextAlign.right, style: TextStyle( color: Color(0xff65676b), @@ -318,36 +321,25 @@ class _PayQrPageState extends State { initC2B(); } }, - child: Container( + child: SizedBox( width: MediaQuery.of(context).size.width, - height: 51, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(40), - color: Color(0xff9d001b), - ), - padding: const EdgeInsets.symmetric( - horizontal: 10, - vertical: 12, - ), - child: Row( - mainAxisSize: MainAxisSize.min, - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - SizedBox( - width: 106, - height: 32, - child: Text( - "ยืนยัน", - textAlign: TextAlign.center, - style: GoogleFonts.kanit( - color: Colors.white, - fontSize: 20, - fontWeight: FontWeight.w500, - ), + child: Card( + color: Colors.white, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(40), + ), + child: Container( + padding: EdgeInsets.all(10), + child: Text( + "Confirm".tr(), + textAlign: TextAlign.center, + style: GoogleFonts.kanit( + color: ColorCustom.greyBorder, + fontSize: 20, + fontWeight: FontWeight.w500, ), ), - ], + ), ), ), ), diff --git a/neowallet_mobile/lib/Register/camera_card_id.dart b/neowallet_mobile/lib/Register/camera_card_id.dart index 97720220..a348db9b 100644 --- a/neowallet_mobile/lib/Register/camera_card_id.dart +++ b/neowallet_mobile/lib/Register/camera_card_id.dart @@ -8,6 +8,7 @@ import 'package:flutter/material.dart'; import 'package:google_fonts/google_fonts.dart'; import '../api/api.dart'; +import '../utils/color_custom.dart'; import 'id_card_model.dart'; List CameraApp = []; @@ -177,20 +178,23 @@ class TakePictureScreenState extends State { } }); }, - child: Container( + child: SizedBox( width: 150, - padding: EdgeInsets.all(5), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(100), - color: Color(0xff9d001b), - ), - child: Text( - "Confirm".tr(), - textAlign: TextAlign.center, - style: GoogleFonts.kanit( - color: Colors.white, - fontSize: 20, - fontWeight: FontWeight.w500, + child: Card( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(40), + ), + child: Container( + padding: EdgeInsets.all(10), + child: Text( + "Confirm".tr(), + textAlign: TextAlign.center, + style: GoogleFonts.kanit( + color: ColorCustom.greyBorder, + fontSize: 20, + fontWeight: FontWeight.w500, + ), + ), ), ), ), diff --git a/neowallet_mobile/lib/Register/camera_passport.dart b/neowallet_mobile/lib/Register/camera_passport.dart index 8fa149cc..b534a25b 100644 --- a/neowallet_mobile/lib/Register/camera_passport.dart +++ b/neowallet_mobile/lib/Register/camera_passport.dart @@ -8,6 +8,7 @@ import 'package:flutter/material.dart'; import 'package:google_fonts/google_fonts.dart'; import '../api/api.dart'; +import '../utils/color_custom.dart'; import 'camera_card_id.dart'; import 'id_card_model.dart'; @@ -154,20 +155,23 @@ class TakePictureScreenState extends State { postImagePath(File(imageFront)); }); }, - child: Container( + child: SizedBox( width: 150, - padding: EdgeInsets.all(5), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(100), - color: Color(0xff9d001b), - ), - child: Text( - "Confirm".tr(), - textAlign: TextAlign.center, - style: GoogleFonts.kanit( - color: Colors.white, - fontSize: 20, - fontWeight: FontWeight.w500, + child: Card( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(40), + ), + child: Container( + padding: EdgeInsets.all(10), + child: Text( + "Confirm".tr(), + textAlign: TextAlign.center, + style: GoogleFonts.kanit( + color: ColorCustom.greyBorder, + fontSize: 20, + fontWeight: FontWeight.w500, + ), + ), ), ), ), diff --git a/neowallet_mobile/lib/Register/otp.dart b/neowallet_mobile/lib/Register/otp.dart index 16c9cb92..05cf5515 100644 --- a/neowallet_mobile/lib/Register/otp.dart +++ b/neowallet_mobile/lib/Register/otp.dart @@ -10,6 +10,7 @@ import 'package:google_fonts/google_fonts.dart'; import 'package:pin_code_fields/pin_code_fields.dart'; import '../api/api.dart'; +import '../utils/color_custom.dart'; TextEditingController _textEditingController = TextEditingController(); @@ -85,24 +86,29 @@ class _OtpPageState extends State { // String otp = ""; String refno = ""; String token = ""; + String otpConfirm = ""; getOtp() async { var param = jsonEncode({"key": Api.API_KEY, "secret": Api.API_SECRET, "msisdn": widget.phone}); - Api.postGetMessage(context, Api.otp, param).then((value) => { + Api.getRaw(context, Api.otpEmail + widget.email).then((value) => { print(value), setState(() { - token = value["token"]; - refno = value["refno"]; + otpConfirm = value.toString(); }) }); } verify(String otp) { - var param = jsonEncode({"key": Api.API_KEY, "secret": Api.API_SECRET, "token": token, "pin": otp}); - Api.postStatus(context, Api.verify, param).then((value) => { - print(value), - if (value != null) {Navigator.pushNamed(context, '/PolicyPage')} else {Utils.showAlertDialog(context, "รหัส OTP ไม่ถูกต้อง")} - }); + if (otp == otpConfirm) { + Navigator.pushNamed(context, '/PolicyPage'); + } else { + Utils.showAlertDialog(context, "รหัส OTP ไม่ถูกต้อง"); + } + // var param = jsonEncode({"key": Api.API_KEY, "secret": Api.API_SECRET, "token": token, "pin": otp}); + // Api.postStatus(context, Api.verify, param).then((value) => { + // print(value), + // if (value != null) {Navigator.pushNamed(context, '/PolicyPage')} else {Utils.showAlertDialog(context, "รหัส OTP ไม่ถูกต้อง")} + // }); } Widget build(BuildContext context) { @@ -142,7 +148,7 @@ class _OtpPageState extends State { padding: EdgeInsets.all(10), child: Column(mainAxisSize: MainAxisSize.max, mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.center, children: [ Text( - "${"Please enter the OTP code.".tr()}\n${"The code will be sent to".tr()}${widget.phone}\nRef:$refno", + "${"Please enter the OTP code.".tr()}\n${"The code will be sent to".tr()}${widget.email}\nRef:$refno", textAlign: TextAlign.center, style: GoogleFonts.kanit( color: Color(0xff65676b), @@ -287,28 +293,24 @@ class _OtpPageState extends State { onTap: () { verify(_textEditingController.text); }, - child: Container( + child: SizedBox( width: 374, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(100), - color: Color(0xff9d001b), - ), - padding: EdgeInsets.all(10), - child: Row( - mainAxisSize: MainAxisSize.min, - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Text( + child: Card( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(40), + ), + child: Container( + padding: EdgeInsets.all(10), + child: Text( "Confirm".tr(), textAlign: TextAlign.center, style: GoogleFonts.kanit( - color: Colors.white, + color: ColorCustom.greyBorder, fontSize: 20, fontWeight: FontWeight.w500, ), ), - ], + ), ), ), ) diff --git a/neowallet_mobile/lib/Register/policy.dart b/neowallet_mobile/lib/Register/policy.dart index f054553d..13ed01e9 100644 --- a/neowallet_mobile/lib/Register/policy.dart +++ b/neowallet_mobile/lib/Register/policy.dart @@ -27,7 +27,7 @@ class _PolicyPageState extends State { controller = WebViewController() ..setJavaScriptMode(JavaScriptMode.unrestricted) ..setBackgroundColor(const Color(0x00000000)) - ..loadRequest(Uri.parse('https://www.cathayinter.com/neo-travel-privacy-policy')); + ..loadRequest(Uri.parse('https://neotravel.app/privacy-policy-neo-travel')); } bool ok = false; diff --git a/neowallet_mobile/lib/Register/pre_register.dart b/neowallet_mobile/lib/Register/pre_register.dart index 36daabaf..24cbb129 100644 --- a/neowallet_mobile/lib/Register/pre_register.dart +++ b/neowallet_mobile/lib/Register/pre_register.dart @@ -5,6 +5,10 @@ import 'package:google_fonts/google_fonts.dart'; import 'camera_passport.dart'; + +var isPassport = false; + + class PreRegisterPage extends StatefulWidget { const PreRegisterPage({Key? key}) : super(key: key); @@ -67,6 +71,7 @@ class _LoginPageState extends State { ), InkWell( onTap: () { + isPassport = false; Navigator.push( context, MaterialPageRoute( @@ -77,22 +82,11 @@ class _LoginPageState extends State { child: Container( width: double.infinity, margin: EdgeInsets.symmetric(horizontal: 30,vertical: 10), - child: Card( - color: Colors.green.shade200, - child: Container( - alignment: Alignment.center, - padding: EdgeInsets.all(30), - child: Text( - "บัตรประชาชน".tr(), - style: GoogleFonts.kanit( - color: Colors.black, - fontSize: 22, - ), - ), - )), + child: context.locale.toString()=="th"?Image.asset("images/register/thaicard_th.png"):Image.asset("images/register/thaicard_en.png") )), InkWell( onTap: () { + isPassport = true; Navigator.push( context, MaterialPageRoute( @@ -103,19 +97,7 @@ class _LoginPageState extends State { child: Container( width: double.infinity, margin: EdgeInsets.symmetric(horizontal: 30,vertical: 10), - child: Card( - color: Colors.red.shade200, - child: Container( - alignment: Alignment.center, - padding: EdgeInsets.all(30), - child: Text( - "พาสปอร์ต".tr(), - style: GoogleFonts.kanit( - color: Colors.black, - fontSize: 22, - ), - ), - )), + child: context.locale.toString()=="th"?Image.asset("images/register/passport_th.png"):Image.asset("images/register/passport_en.png") )), SizedBox(height: 40,) ], diff --git a/neowallet_mobile/lib/Register/register_data.dart b/neowallet_mobile/lib/Register/register_data.dart index a1918a00..c8b5f13c 100644 --- a/neowallet_mobile/lib/Register/register_data.dart +++ b/neowallet_mobile/lib/Register/register_data.dart @@ -1,5 +1,6 @@ import 'package:cathaypay_mobile/Register/camera_card_id.dart'; import 'package:cathaypay_mobile/Register/otp.dart'; +import 'package:cathaypay_mobile/Register/pre_register.dart'; import 'package:cathaypay_mobile/Register/register.dart'; import 'package:cathaypay_mobile/Register/register_occupation.dart'; import 'package:cathaypay_mobile/utils/utils.dart'; @@ -10,6 +11,7 @@ import 'package:google_fonts/google_fonts.dart'; import 'package:mask_text_input_formatter/mask_text_input_formatter.dart'; import '../utils/calendar_picker.dart'; +import '../utils/color_custom.dart'; TextEditingController name = TextEditingController(text: idCardFront?.nameThai ?? ""); TextEditingController email = TextEditingController(); @@ -155,48 +157,50 @@ class _RegisterDataState extends State { ),*/ ], ), - Padding( - padding: const EdgeInsets.fromLTRB(0, 10, 0, 10), - child: Container( - width: MediaQuery.of(context).size.width, - height: 1, - color: Color(0xfff3f3f3), - ), - ), - Row( - mainAxisSize: MainAxisSize.min, - children: [ - Text( - "Back of card number".tr(), - style: GoogleFonts.kanit( - color: Color(0xff565656), - fontSize: 15, - ), - ), - Expanded( - child: TextField( - style: GoogleFonts.kanit( - color: Color(0xff565656), - fontSize: 15, - ), - inputFormatters: [maskFormatter], - maxLength: 15, - keyboardType: TextInputType.text, - textAlign: TextAlign.right, - controller: idCardBackEditText, - decoration: InputDecoration( - counterText: "", - hintText: '', - suffixIcon: Icon( - Icons.arrow_forward_ios_rounded, - size: 15, - color: Colors.grey, - ), - border: InputBorder.none, - ), - ), - ), - /*Expanded( + isPassport?Container():Column( + children: [ + Padding( + padding: const EdgeInsets.fromLTRB(0, 10, 0, 10), + child: Container( + width: MediaQuery.of(context).size.width, + height: 1, + color: Color(0xfff3f3f3), + ), + ), + Row( + mainAxisSize: MainAxisSize.min, + children: [ + Text( + "Back of card number".tr(), + style: GoogleFonts.kanit( + color: Color(0xff565656), + fontSize: 15, + ), + ), + Expanded( + child: TextField( + style: GoogleFonts.kanit( + color: Color(0xff565656), + fontSize: 15, + ), + inputFormatters: [maskFormatter], + maxLength: 15, + keyboardType: TextInputType.text, + textAlign: TextAlign.right, + controller: idCardBackEditText, + decoration: InputDecoration( + counterText: "", + hintText: '', + suffixIcon: Icon( + Icons.arrow_forward_ios_rounded, + size: 15, + color: Colors.grey, + ), + border: InputBorder.none, + ), + ), + ), + /*Expanded( child: Text( idCardBack?.nameThai ?? "", textAlign: TextAlign.right, @@ -207,8 +211,10 @@ class _RegisterDataState extends State { ), ), ),*/ - ], - ), + ], + ), + ], + ), /*Padding( padding: const EdgeInsets.fromLTRB(0, 10, 0, 10), child: Container( @@ -1201,21 +1207,22 @@ class _RegisterDataState extends State { ), ); }, - child: Container( + child: SizedBox( width: 374, - height: 56, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(100), - color: Color(0xff9d001b), - ), - child: Center( - child: Text( - "Next".tr(), - textAlign: TextAlign.center, - style: GoogleFonts.kanit( - color: Colors.white, - fontSize: 20, - fontWeight: FontWeight.w500, + child: Card( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(40), + ), + child: Container( + padding: EdgeInsets.all(10), + child: Text( + "Next".tr(), + textAlign: TextAlign.center, + style: GoogleFonts.kanit( + color: ColorCustom.greyBorder, + fontSize: 20, + fontWeight: FontWeight.w500, + ), ), ), ), diff --git a/neowallet_mobile/lib/Register/register_picture.dart b/neowallet_mobile/lib/Register/register_picture.dart index 07a5cd42..2ddfa722 100644 --- a/neowallet_mobile/lib/Register/register_picture.dart +++ b/neowallet_mobile/lib/Register/register_picture.dart @@ -7,6 +7,7 @@ import 'package:google_fonts/google_fonts.dart'; import 'package:image_picker/image_picker.dart'; import '../api/api.dart'; +import '../utils/color_custom.dart'; String imageEkycPath = ""; @@ -165,19 +166,23 @@ class _RegisterPicturePageState extends State { onTap: () { _imageFile != null ? Navigator.pushNamed(context, '/RegisterSignaturePage') : Navigator.pushNamed(context, '/RegisterSignaturePage'); }, - child: Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(100), - color: Color(0xff9d001b), - ), - padding: EdgeInsets.all(10), - child: Text( - "Next".tr(), - textAlign: TextAlign.center, - style: GoogleFonts.kanit( - color: Colors.white, - fontSize: 20, - fontWeight: FontWeight.w500, + child: SizedBox( + width: double.infinity, + child: Card( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(40), + ), + child: Container( + padding: EdgeInsets.all(10), + child: Text( + "Next".tr(), + textAlign: TextAlign.center, + style: GoogleFonts.kanit( + color: ColorCustom.greyBorder, + fontSize: 20, + fontWeight: FontWeight.w500, + ), + ), ), ), ), diff --git a/neowallet_mobile/lib/Register/register_signature.dart b/neowallet_mobile/lib/Register/register_signature.dart index 27e851b1..fc51db35 100644 --- a/neowallet_mobile/lib/Register/register_signature.dart +++ b/neowallet_mobile/lib/Register/register_signature.dart @@ -14,6 +14,7 @@ import 'package:path_provider/path_provider.dart'; import 'package:signature/signature.dart'; import '../api/api.dart'; +import '../utils/color_custom.dart'; class RegisterSignaturePage extends StatefulWidget { const RegisterSignaturePage({Key? key}) : super(key: key); @@ -62,7 +63,7 @@ class _RegisterSignaturePageState extends State { "Password": password.text, "ConfirmPassword": passwordConfirm.text, "MobileDeviceId": deviceId, - "PersonalCardId": idCardFront?.idCard, + "PersonalCardId": idCardEditText.text, "MaxCardID": phone.text, "UserType": "P", "CustomerTypeId": "P01", @@ -229,21 +230,23 @@ class _RegisterSignaturePageState extends State { onTap: () async { signatureCapture(); }, - child: Container( + child: SizedBox( width: double.infinity, - margin: EdgeInsets.only(left: 20, right: 20, bottom: 20, top: 20), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(100), - color: Color(0xff9d001b), - ), - padding: EdgeInsets.all(10), - child: Text( - "Next".tr(), - textAlign: TextAlign.center, - style: GoogleFonts.kanit( - color: Colors.white, - fontSize: 20, - fontWeight: FontWeight.w500, + child: Card( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(40), + ), + child: Container( + padding: EdgeInsets.all(10), + child: Text( + "Next".tr(), + textAlign: TextAlign.center, + style: GoogleFonts.kanit( + color: ColorCustom.greyBorder, + fontSize: 20, + fontWeight: FontWeight.w500, + ), + ), ), ), ), diff --git a/neowallet_mobile/lib/TopUp/TopUpMenuPage.dart b/neowallet_mobile/lib/TopUp/TopUpMenuPage.dart index 2dfa7caf..f2316ee6 100644 --- a/neowallet_mobile/lib/TopUp/TopUpMenuPage.dart +++ b/neowallet_mobile/lib/TopUp/TopUpMenuPage.dart @@ -444,7 +444,7 @@ class _TopUpHistoryState extends State { "invoiceId": "", "referencE1": "", "referencE2": "", - "topupStatus": "WALLETADDED", + "paymentStatus": "WALLETADDED", "paymentChannel": "", "createDatefrom": end, "createDateto": start, diff --git a/neowallet_mobile/lib/TopUp/topup_amout.dart b/neowallet_mobile/lib/TopUp/topup_amout.dart index 077a40e0..6d3a5c03 100644 --- a/neowallet_mobile/lib/TopUp/topup_amout.dart +++ b/neowallet_mobile/lib/TopUp/topup_amout.dart @@ -6,7 +6,7 @@ import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:google_fonts/google_fonts.dart'; -import 'package:image_gallery_saver/image_gallery_saver.dart'; +import 'package:saver_gallery/saver_gallery.dart'; import 'package:screenshot/screenshot.dart'; import '../Home/HomePage.dart'; @@ -65,7 +65,9 @@ class _TransferPromptPayDetailState extends State { } saveQrCode() { - ImageGallerySaver.saveImage(base64Decode(myQrCode ?? "")); + // ImageGallerySaver.saveImage(base64Decode(myQrCode ?? "")); + String fileName = "neopay_${DateTime.now().millisecondsSinceEpoch}.jpg"; + SaverGallery.saveImage(base64Decode(myQrCode ?? ""), fileName: fileName, skipIfExists: false); Utils.showAlertDialogCallback( context, "บันทึกสำเร็จ", @@ -80,7 +82,9 @@ class _TransferPromptPayDetailState extends State { captureQrCode() { screenshotController.capture().then((Uint8List? image) { if (image != null) { - ImageGallerySaver.saveImage(image); + // ImageGallerySaver.saveImage(image); + String fileName = "neopay_${DateTime.now().millisecondsSinceEpoch}.jpg"; + SaverGallery.saveImage(image, fileName: fileName, skipIfExists: false); Utils.showAlertDialogCallback( context, "บันทึกสำเร็จ", @@ -253,75 +257,86 @@ class _TransferPromptPayDetailState extends State { mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ InkWell( - onTap: () { - Navigator.of(context).pop(); - }, - child: Container( - margin: EdgeInsets.only(bottom: 15), - width: MediaQuery.of(context).size.width / 3.5, - height: 46, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(100), - color: Color(0xff2d2d2d), + onTap: () { + Navigator.of(context).pop(); + }, + child: SizedBox( + width: MediaQuery.of(context).size.width / 3, + child: Card( + color: Color(0xff2d2d2d), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(40), ), - child: Center( - child: Text( - "ยกเลิก", - textAlign: TextAlign.center, - style: TextStyle( - color: Colors.white, - fontSize: 16, - fontWeight: FontWeight.w300, + child: Container( + padding: EdgeInsets.all(10), + child: Text( + "ยกเลิก".tr(), + maxLines: 1, + textAlign: TextAlign.center, + style: GoogleFonts.kanit( + color: ColorCustom.white, + fontSize: 14, + fontWeight: FontWeight.w500, + ), ), - )), - )), + ), + ), + ), + ), InkWell( - onTap: () { - Navigator.pushNamed(context, '/HomePage'); - }, - child: Container( - margin: EdgeInsets.only(bottom: 15), - width: MediaQuery.of(context).size.width / 3.5, - height: 46, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(100), - color: Color(0xffad022c), + onTap: () { + Navigator.pushNamed(context, '/HomePage'); + }, + child: SizedBox( + width: MediaQuery.of(context).size.width / 3, + child: Card( + color: Colors.white, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(40), ), - child: Center( - child: Text( - "กลับสู่หน้าหลัก", - textAlign: TextAlign.center, - style: TextStyle( - color: Colors.white, - fontSize: 16, - fontWeight: FontWeight.w300, + child: Container( + padding: EdgeInsets.all(10), + child: Text( + "กลับสู่หน้าหลัก".tr(), + maxLines: 1, + textAlign: TextAlign.center, + style: GoogleFonts.kanit( + color: ColorCustom.greyBorder, + fontSize: 14, + fontWeight: FontWeight.w500, + ), ), - )), - )), + ), + ), + ), + ), InkWell( - onTap: () { - // saveQrCode(); - captureQrCode(); - }, - child: Container( - margin: EdgeInsets.only(bottom: 15), - width: MediaQuery.of(context).size.width / 3.5, - height: 46, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(100), - color: Color(0xffad022c), + onTap: () { + // saveQrCode(); + captureQrCode(); + }, + child: SizedBox( + width: MediaQuery.of(context).size.width / 3, + child: Card( + color: Colors.white, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(40), ), - child: Center( - child: Text( - "บันทึก QR", - textAlign: TextAlign.center, - style: TextStyle( - color: Colors.white, - fontSize: 16, - fontWeight: FontWeight.w300, + child: Container( + padding: EdgeInsets.all(10), + child: Text( + "Save QR".tr(), + textAlign: TextAlign.center, + style: GoogleFonts.kanit( + color: ColorCustom.greyBorder, + fontSize: 14, + fontWeight: FontWeight.w500, + ), ), - )), - )), + ), + ), + ), + ), ], ), SizedBox( @@ -486,36 +501,25 @@ class _TransferPromptPayDetailState extends State { onTap: () async { initTopUp(); }, - child: Container( - width: MediaQuery.of(context).size.width, - height: 51, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(40), - color: Color(0xff9d001b), - ), - padding: const EdgeInsets.symmetric( - horizontal: 10, - vertical: 12, - ), - child: Row( - mainAxisSize: MainAxisSize.min, - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - SizedBox( - width: 106, - height: 32, - child: Text( - "Create QR code".tr(), - textAlign: TextAlign.center, - style: GoogleFonts.kanit( - color: Colors.white, - fontSize: 20, - fontWeight: FontWeight.w500, - ), + child: SizedBox( + width: double.infinity, + child: Card( + color: Colors.white, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(40), + ), + child: Container( + padding: EdgeInsets.all(10), + child: Text( + "Create QR code".tr(), + textAlign: TextAlign.center, + style: GoogleFonts.kanit( + color: ColorCustom.greyBorder, + fontSize: 20, + fontWeight: FontWeight.w500, ), ), - ], + ), ), ), ), diff --git a/neowallet_mobile/lib/TopUp/topup_my_qr.dart b/neowallet_mobile/lib/TopUp/topup_my_qr.dart index 24ab341e..56dea9af 100644 --- a/neowallet_mobile/lib/TopUp/topup_my_qr.dart +++ b/neowallet_mobile/lib/TopUp/topup_my_qr.dart @@ -6,12 +6,11 @@ import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:google_fonts/google_fonts.dart'; -import 'package:image_gallery_saver/image_gallery_saver.dart'; import 'package:qr_flutter/qr_flutter.dart'; +import 'package:saver_gallery/saver_gallery.dart'; import 'package:screenshot/screenshot.dart'; import '../Home/HomePage.dart'; -import '../Numpad.dart'; import '../api/api.dart'; import '../model/qrcode.dart'; @@ -25,28 +24,30 @@ class TopUpMyQrPage extends StatefulWidget { } class _TransferPromptPayDetailState extends State { - - @override void initState() { initMyQr(); super.initState(); } - bool loading = false; QrCodeModel? myQrCode; initMyQr() { - var param = jsonEncode({"MobileDeviceNo": profile?.phoneNumber ?? "", "Note": "myQr",}); - Api.post(context, Api.myQrCode, param).then((value) => { - if (value != null) {initQrCode(value)} else {} + var param = jsonEncode({ + "MobileDeviceNo": profile?.phoneNumber ?? "", + "Note": "myQr", }); + Api.post(context, Api.myQrCode, param).then((value) => { + if (value != null) {initQrCode(value)} else {} + }); } saveQrCode() { - ImageGallerySaver.saveImage(base64Decode(myQrCode?.qrCodeData ?? "")); + // ImageGallerySaver.saveImage(base64Decode(myQrCode?.qrCodeData ?? "")); + String fileName = "neopay_${DateTime.now().millisecondsSinceEpoch}.jpg"; + SaverGallery.saveImage(base64Decode(myQrCode?.qrCodeData ?? ""), fileName: fileName, skipIfExists: false); Utils.showAlertDialogCallback( context, "บันทึกสำเร็จ", @@ -56,13 +57,14 @@ class _TransferPromptPayDetailState extends State { ); } - ScreenshotController screenshotController = ScreenshotController(); captureQrCode() { screenshotController.capture().then((Uint8List? image) { if (image != null) { - ImageGallerySaver.saveImage(image); + // ImageGallerySaver.saveImage(image); + String fileName = "neopay_${DateTime.now().millisecondsSinceEpoch}.jpg"; + SaverGallery.saveImage(image, fileName: fileName, skipIfExists: false); Utils.showAlertDialogCallback( context, "บันทึกสำเร็จ", @@ -366,10 +368,7 @@ class _TransferPromptPayDetailState extends State { child: Screenshot( controller: screenshotController, child: Container( - decoration: BoxDecoration( - border: Border.all(width: 1.0, color: Colors.grey), - color: Colors.white - ), + decoration: BoxDecoration(border: Border.all(width: 1.0, color: Colors.grey), color: Colors.white), padding: EdgeInsets.all(20), margin: EdgeInsets.all(20), child: Column( @@ -459,83 +458,97 @@ class _TransferPromptPayDetailState extends State { ), ))), SizedBox( - height: 20, + height: 10, ), Row( mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ InkWell( - onTap: () { - Navigator.of(context).pop(); - }, - child: Container( - margin: EdgeInsets.only(bottom: 15), - width: MediaQuery.of(context).size.width / 3.5, - height: 46, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(100), - color: Color(0xff2d2d2d), + onTap: () { + Navigator.pushNamed(context, '/HomePage'); + }, + child: SizedBox( + width: MediaQuery.of(context).size.width / 3, + child: Card( + color: Colors.white, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(40), ), - child: Center( - child: Text( - "ยกเลิก", - textAlign: TextAlign.center, - style: TextStyle( - color: Colors.white, - fontSize: 16, - fontWeight: FontWeight.w300, - ), - )), - )), + child: Container( + padding: EdgeInsets.all(10), + child: Text( + "กลับสู่หน้าหลัก".tr(), + maxLines: 1, + textAlign: TextAlign.center, + style: GoogleFonts.kanit( + color: ColorCustom.greyBorder, + fontSize: 14, + fontWeight: FontWeight.w500, + ), + ), + ), + ), + ), + ), InkWell( - onTap: () { - Navigator.pushNamed(context, '/HomePage'); - }, - child: Container( - margin: EdgeInsets.only(bottom: 15), - width: MediaQuery.of(context).size.width / 3.5, - height: 46, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(100), - color: Color(0xffad022c), + onTap: () { + // saveQrCode(); + captureQrCode(); + }, + child: SizedBox( + width: MediaQuery.of(context).size.width / 3, + child: Card( + color: Colors.white, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(40), ), - child: Center( - child: Text( - "กลับสู่หน้าหลัก", - textAlign: TextAlign.center, - style: TextStyle( - color: Colors.white, - fontSize: 16, - fontWeight: FontWeight.w300, - ), - )), - )), - InkWell( - onTap: () { - // saveQrCode(); - captureQrCode(); - }, - child: Container( - margin: EdgeInsets.only(bottom: 15), - width: MediaQuery.of(context).size.width / 3.5, - height: 46, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(100), - color: Color(0xffad022c), + child: Container( + padding: EdgeInsets.all(10), + child: Text( + "Save QR".tr(), + textAlign: TextAlign.center, + style: GoogleFonts.kanit( + color: ColorCustom.greyBorder, + fontSize: 14, + fontWeight: FontWeight.w500, + ), + ), ), - child: Center( - child: Text( - "บันทึก QR", - textAlign: TextAlign.center, - style: TextStyle( - color: Colors.white, - fontSize: 16, - fontWeight: FontWeight.w300, - ), - )), - )), + ), + ), + ), ], ), + SizedBox( + height: 10, + ), + InkWell( + onTap: () { + Navigator.of(context).pop(); + }, + child: SizedBox( + width: MediaQuery.of(context).size.width / 2, + child: Card( + color: Color(0xff2d2d2d), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(40), + ), + child: Container( + padding: EdgeInsets.all(10), + child: Text( + "ยกเลิก".tr(), + maxLines: 1, + textAlign: TextAlign.center, + style: GoogleFonts.kanit( + color: ColorCustom.white, + fontSize: 14, + fontWeight: FontWeight.w500, + ), + ), + ), + ), + ), + ), SizedBox( height: 20, ), diff --git a/neowallet_mobile/lib/TransferMoney/TransferCathayPay.dart b/neowallet_mobile/lib/TransferMoney/TransferCathayPay.dart index 2af387f4..8cdda8ad 100644 --- a/neowallet_mobile/lib/TransferMoney/TransferCathayPay.dart +++ b/neowallet_mobile/lib/TransferMoney/TransferCathayPay.dart @@ -1,9 +1,11 @@ +import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:google_fonts/google_fonts.dart'; import '../PinCodeVadidate.dart'; +import '../utils/color_custom.dart'; import 'TransferCathayPayDialog.dart'; class TransferCathayPay extends StatefulWidget { @@ -18,7 +20,7 @@ class _TransferCathayPayState extends State { @override Widget build(BuildContext context) { - return Container( + return Scaffold(body: SingleChildScrollView( child: Column( children: [ Row( @@ -32,7 +34,7 @@ class _TransferCathayPayState extends State { color: Colors.black, )), Text( - "โอนเงินให้สมาชิก NEO PAY", + "โอนเงินให้สมาชิก NEO PAY".tr(), style: TextStyle( color: Color(0xff050505), fontSize: 20, @@ -40,7 +42,7 @@ class _TransferCathayPayState extends State { ) ], ), - Spacer(), + SizedBox(height: 20,), Container( child: TextField( keyboardType: TextInputType.number, @@ -49,7 +51,7 @@ class _TransferCathayPayState extends State { ], controller: _phone, decoration: InputDecoration( - hintText: 'เบอร์โทรศัพท์ผู้รับ', + hintText: 'เบอร์โทรศัพท์ผู้รับ'.tr(), border: InputBorder.none, contentPadding: EdgeInsets.symmetric(horizontal: 16), ), @@ -61,7 +63,7 @@ class _TransferCathayPayState extends State { color: Color(0xfff2f2f2), ), ), - Spacer(), + SizedBox(height: 20,), InkWell( onTap: () async { showModalBottomSheet( @@ -78,36 +80,24 @@ class _TransferCathayPayState extends State { }); }, child: Container( - margin: EdgeInsets.only(left: 20, right: 20), - width: MediaQuery.of(context).size.width, - height: 51, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(40), - color: Color(0xff9d001b), - ), - padding: const EdgeInsets.symmetric( - horizontal: 10, - vertical: 12, - ), - child: Row( - mainAxisSize: MainAxisSize.min, - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - SizedBox( - width: 106, - height: 32, - child: Text( - "ต่อไป", - textAlign: TextAlign.center, - style: GoogleFonts.kanit( - color: Colors.white, - fontSize: 20, - fontWeight: FontWeight.w500, - ), + width: double.infinity, + margin: const EdgeInsets.symmetric(horizontal: 15), + child: Card( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(40), + ), + child: Container( + padding: EdgeInsets.all(10), + child: Text( + "Next".tr(), + textAlign: TextAlign.center, + style: GoogleFonts.kanit( + color: ColorCustom.greyBorder, + fontSize: 20, + fontWeight: FontWeight.w500, ), ), - ], + ), ), ), ), @@ -116,7 +106,7 @@ class _TransferCathayPayState extends State { ) ], ), - ); + ),); } } @@ -151,7 +141,7 @@ class _TransferCathayPayDetailState extends State { ], elevation: 0, title: Text( - "โอนเงิน", + "Transfer Money".tr(), textAlign: TextAlign.center, style: GoogleFonts.kanit( color: Colors.black, @@ -168,7 +158,7 @@ class _TransferCathayPayDetailState extends State { mainAxisAlignment: MainAxisAlignment.start, children: [ Text( - "ชื่อ", + "ชื่อ".tr(), style: TextStyle( color: Color(0xff65676b), fontSize: 16, @@ -188,7 +178,7 @@ class _TransferCathayPayDetailState extends State { children: [ Spacer(), Text( - "กมลรวี กอสัมพันธ์", + "", textAlign: TextAlign.right, style: TextStyle( color: Color(0xff65676b), @@ -207,7 +197,7 @@ class _TransferCathayPayDetailState extends State { Row( children: [ Text( - "เบอร์โทรศัพท์", + "เบอร์โทรศัพท์".tr(), style: TextStyle( color: Color(0xff65676b), fontSize: 14, @@ -216,7 +206,7 @@ class _TransferCathayPayDetailState extends State { ), Spacer(), Text( - "089 - 108 - 0891", + "", textAlign: TextAlign.right, style: TextStyle( color: Color(0xff65676b), @@ -229,7 +219,7 @@ class _TransferCathayPayDetailState extends State { height: 10, ), Text( - "จำนวนเงินที่โอน / จ่าย", + "จำนวนเงินที่โอน / จ่าย".tr(), style: TextStyle( color: Color(0xff65676b), fontSize: 16, @@ -249,7 +239,7 @@ class _TransferCathayPayDetailState extends State { children: [ Spacer(), Text( - "5,000.00", + "", textAlign: TextAlign.right, style: TextStyle( color: Color(0xff65676b), @@ -266,7 +256,7 @@ class _TransferCathayPayDetailState extends State { height: 10, ), Text( - "ใช้แต้ม NEO PAY แทนเงินสด", + "ใช้แต้ม NEO PAY แทนเงินสด".tr(), style: TextStyle( color: Color(0xff65676b), fontSize: 16, @@ -274,7 +264,7 @@ class _TransferCathayPayDetailState extends State { ), ), Text( - "คะแนนของคุณ : 12,000 แต้ม", + "${"คะแนนของคุณ".tr()} : 12,000 ${"แต้ม".tr()}", style: TextStyle( color: Color(0xff9d001b), fontSize: 14, @@ -284,7 +274,6 @@ class _TransferCathayPayDetailState extends State { mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ Container( - width: 161, decoration: BoxDecoration( borderRadius: BorderRadius.circular(100), color: Color(0xfff2f2f2), @@ -299,7 +288,7 @@ class _TransferCathayPayDetailState extends State { crossAxisAlignment: CrossAxisAlignment.center, children: [ Text( - "10 แต้ม", + "10 ${"แต้ม".tr()}", textAlign: TextAlign.right, style: TextStyle( color: Color(0xff65676b), @@ -332,7 +321,7 @@ class _TransferCathayPayDetailState extends State { crossAxisAlignment: CrossAxisAlignment.center, children: [ Text( - "100 บาท", + "100 ${"Baht".tr()}", textAlign: TextAlign.right, style: TextStyle( color: Colors.white, @@ -345,7 +334,7 @@ class _TransferCathayPayDetailState extends State { ), Center( child: Text( - "1 แต้ม = 10 สตางค์", + "1 แต้ม = 10 สตางค์".tr(), textAlign: TextAlign.center, style: TextStyle( color: Color(0xff65676b), @@ -355,6 +344,8 @@ class _TransferCathayPayDetailState extends State { ), ), Container( + height: 136, + color: Colors.transparent, child: Column( children: [ SizedBox( @@ -363,7 +354,7 @@ class _TransferCathayPayDetailState extends State { Row( children: [ Text( - "ยอดเงินทั้งหมด", + "ยอดเงินทั้งหมด".tr(), style: TextStyle( color: Color(0xff65676b), fontSize: 16, @@ -371,7 +362,7 @@ class _TransferCathayPayDetailState extends State { ), Spacer(), Text( - "4.990.00", + "", textAlign: TextAlign.right, style: TextStyle( color: Color(0xff9d001b), @@ -380,7 +371,7 @@ class _TransferCathayPayDetailState extends State { ), ), Text( - " บาท", + " ${"Baht".tr()}", textAlign: TextAlign.right, style: TextStyle( color: Color(0xff65676b), @@ -406,36 +397,24 @@ class _TransferCathayPayDetailState extends State { }); } }, - child: Container( - width: MediaQuery.of(context).size.width, - height: 51, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(40), - color: Color(0xff9d001b), - ), - padding: const EdgeInsets.symmetric( - horizontal: 10, - vertical: 12, - ), - child: Row( - mainAxisSize: MainAxisSize.min, - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - SizedBox( - width: 106, - height: 32, - child: Text( - "ยืนยัน", - textAlign: TextAlign.center, - style: GoogleFonts.kanit( - color: Colors.white, - fontSize: 20, - fontWeight: FontWeight.w500, - ), + child: SizedBox( + width: double.infinity, + child: Card( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(40), + ), + child: Container( + padding: EdgeInsets.all(10), + child: Text( + "Confirm".tr(), + textAlign: TextAlign.center, + style: GoogleFonts.kanit( + color: ColorCustom.greyBorder, + fontSize: 20, + fontWeight: FontWeight.w500, ), ), - ], + ), ), ), ), @@ -444,8 +423,6 @@ class _TransferCathayPayDetailState extends State { ), ], ), - height: 136, - color: Colors.transparent, ), SizedBox( height: 10, diff --git a/neowallet_mobile/lib/TransferMoney/TransferMoneyMenu.dart b/neowallet_mobile/lib/TransferMoney/TransferMoneyMenu.dart index 4cf3cea3..b744e034 100644 --- a/neowallet_mobile/lib/TransferMoney/TransferMoneyMenu.dart +++ b/neowallet_mobile/lib/TransferMoney/TransferMoneyMenu.dart @@ -147,6 +147,7 @@ class _TransferMoneyMenuPageState extends State { InkWell( onTap: () { showModalBottomSheet( + useSafeArea: true, context: context, shape: RoundedRectangleBorder( borderRadius: BorderRadius.vertical( @@ -158,31 +159,6 @@ class _TransferMoneyMenuPageState extends State { }); }, child: Container( - child: Row( - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - SizedBox( - width: 20, - ), - Text( - "สมาชิก NEO PAY", - style: TextStyle( - color: Colors.white, - fontSize: 20, - fontWeight: FontWeight.w500, - ), - ), - Spacer(), - Icon( - Icons.wallet, - color: Colors.white, - ), - SizedBox( - width: 20, - ), - ], - ), height: 48, decoration: BoxDecoration( borderRadius: BorderRadius.circular(100), @@ -193,7 +169,32 @@ class _TransferMoneyMenuPageState extends State { offset: Offset(0.75, 1.50), ), ], - color: Color(0xffd0315a), + color: Color(0xfffbfbfb), + ), + child: Row( + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + SizedBox( + width: 20, + ), + Text( + "สมาชิก NEO PAY".tr(), + style: TextStyle( + color: Color(0xff65676b), + fontSize: 20, + fontWeight: FontWeight.w500, + ), + ), + Spacer(), + Icon( + Icons.wallet, + color: Colors.black, + ), + SizedBox( + width: 20, + ), + ], ), ), ), @@ -216,6 +217,18 @@ class _TransferMoneyMenuPageState extends State { // }); }, child: Container( + height: 48, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(100), + boxShadow: [ + BoxShadow( + color: Color(0x26000000), + blurRadius: 2, + offset: Offset(0.75, 1.50), + ), + ], + color: Colors.grey, + ), child: Row( crossAxisAlignment: CrossAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center, @@ -224,7 +237,7 @@ class _TransferMoneyMenuPageState extends State { width: 20, ), Text( - "บัญชีธนาคาร", + "บัญชีธนาคาร".tr(), style: TextStyle( color: Color(0xff65676b), fontSize: 20, @@ -241,18 +254,6 @@ class _TransferMoneyMenuPageState extends State { ), ], ), - height: 48, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(100), - boxShadow: [ - BoxShadow( - color: Color(0x26000000), - blurRadius: 2, - offset: Offset(0.75, 1.50), - ), - ], - color: Colors.grey, - ), ), ), SizedBox( @@ -588,7 +589,7 @@ class _TransferMoneyMenuPageState extends State { ), Expanded( child: Text( - "สแกน QR Code CATHAY PAY".tr(), + "สแกน QR Code NEO PAY".tr(), maxLines: 1, overflow: TextOverflow.ellipsis, style: TextStyle( diff --git a/neowallet_mobile/lib/TransferMoney/TransferPromptPay.dart b/neowallet_mobile/lib/TransferMoney/TransferPromptPay.dart index 1b78dc3e..41825b1f 100644 --- a/neowallet_mobile/lib/TransferMoney/TransferPromptPay.dart +++ b/neowallet_mobile/lib/TransferMoney/TransferPromptPay.dart @@ -11,6 +11,7 @@ import 'package:google_fonts/google_fonts.dart'; import 'package:mask_text_input_formatter/mask_text_input_formatter.dart'; import '../api/api.dart'; +import '../utils/color_custom.dart'; import 'TransferPromtptPayDialog.dart'; class TransferPromptPay extends StatefulWidget { @@ -96,36 +97,24 @@ class _TransferPromptPayState extends State { }); }, child: Container( - margin: EdgeInsets.only(left: 20, right: 20), - width: MediaQuery.of(context).size.width, - height: 51, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(40), - color: Color(0xff9d001b), - ), - padding: const EdgeInsets.symmetric( - horizontal: 10, - vertical: 12, - ), - child: Row( - mainAxisSize: MainAxisSize.min, - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - SizedBox( - width: 106, - height: 32, - child: Text( - "Next".tr(), - textAlign: TextAlign.center, - style: GoogleFonts.kanit( - color: Colors.white, - fontSize: 20, - fontWeight: FontWeight.w500, - ), + width: double.infinity, + margin: const EdgeInsets.symmetric(horizontal: 15), + child: Card( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(40), + ), + child: Container( + padding: EdgeInsets.all(10), + child: Text( + "Next".tr(), + textAlign: TextAlign.center, + style: GoogleFonts.kanit( + color: ColorCustom.greyBorder, + fontSize: 20, + fontWeight: FontWeight.w500, ), ), - ], + ), ), ), ), @@ -418,36 +407,24 @@ class _TransferPromptPayDetailState extends State { onTap: () async { initPromptPay(context); }, - child: Container( - width: MediaQuery.of(context).size.width, - height: 51, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(40), - color: Color(0xff9d001b), - ), - padding: const EdgeInsets.symmetric( - horizontal: 10, - vertical: 12, - ), - child: Row( - mainAxisSize: MainAxisSize.min, - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - SizedBox( - width: 106, - height: 32, - child: Text( - "Confirm".tr(), - textAlign: TextAlign.center, - style: GoogleFonts.kanit( - color: Colors.white, - fontSize: 20, - fontWeight: FontWeight.w500, - ), + child: SizedBox( + width: double.infinity, + child: Card( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(40), + ), + child: Container( + padding: EdgeInsets.all(10), + child: Text( + "Confirm".tr(), + textAlign: TextAlign.center, + style: GoogleFonts.kanit( + color: ColorCustom.greyBorder, + fontSize: 20, + fontWeight: FontWeight.w500, ), ), - ], + ), ), ), ), diff --git a/neowallet_mobile/lib/api/api.dart b/neowallet_mobile/lib/api/api.dart index a54721e1..424fafe8 100644 --- a/neowallet_mobile/lib/api/api.dart +++ b/neowallet_mobile/lib/api/api.dart @@ -50,6 +50,9 @@ class Api { static String lockTest = BaseUrlBuilding + "api/V2/Authentication/LockUnlock"; static String otp = "https://otp.thaibulksms.com/v2/otp/request"; static String verify = "https://otp.thaibulksms.com/v2/otp/verify"; + static String otpEmail = BaseUrlCathay+"common/user_login/otp/"; + static String menuIcons = BaseUrlCathay+"common/icon"; + static String banner = BaseUrlCathay + "common/banner/"; static String promotion = BaseUrlCathay + "common/promotion/"; static String getTokenAdmin = BaseUrlBuilding + "api/v3/User/Login"; @@ -58,11 +61,11 @@ class Api { static String c2bConfirm = BaseUrlBuilding + "api/v2/Payment/transaction/confirmC2B"; static String getTransaction = BaseUrlBuilding + "api/v2/Payment/getTransactionWeb"; - static String BaseUrlBuildingCathay = "https://sathorn.cathay-pay.com/"; - static String payPromptPayInitial = BaseUrlBuildingCathay + "api/v2/EPaymentBBL/TransferedPromptPayIDInitial"; - static String payPromptPayConfirm = BaseUrlBuildingCathay + "api/v2/EPaymentBBL/TransferedPromptPayIDConfirm"; - static String payThaiInitial = BaseUrlBuildingCathay + "api/v2/EPaymentBBL/TransferedPromptPayQRInitial"; - static String payThaiConfirm = BaseUrlBuildingCathay + "api/v2/EPaymentBBL/TransferedPromptPayQRConfirm"; + // static String BaseUrlBuildingCathay = "https://sathorn.cathay-pay.com/"; + static String payPromptPayInitial = BaseUrlBuilding + "api/v2/EPaymentBBL/TransferedPromptPayIDInitial"; + static String payPromptPayConfirm = BaseUrlBuilding + "api/v2/EPaymentBBL/TransferedPromptPayIDConfirm"; + static String payThaiInitial = BaseUrlBuilding + "api/v2/EPaymentBBL/TransferedPromptPayQRInitial"; + static String payThaiConfirm = BaseUrlBuilding + "api/v2/EPaymentBBL/TransferedPromptPayQRConfirm"; static String user = BaseUrlBuilding + "api/v1/User"; @@ -192,6 +195,48 @@ class Api { } } + static Future getRaw(BuildContext context, String url) async { + try { + http.Response response; + + if (tokenModel != null) { + printLongString("start api " + url + "\ntoken = " + tokenModel!.token!); + Map requestHeaders = {HttpHeaders.contentTypeHeader: "application/json", "Authorization": "Bearer ${tokenModel!.token!}"}; + print(requestHeaders.toString()); + response = await http.get(Uri.parse(url), headers: requestHeaders); + } else { + Map requestHeaders = {HttpHeaders.contentTypeHeader: "application/json"}; + response = await http.get(Uri.parse(url), headers: requestHeaders); + } + printApiStatus(response); + + if (response.statusCode == 200 || response.statusCode == 201) { + // final jsonResponse = json.decode(response.body); + printLongString("response api ${response.body}"); + return response.body; + } else if (response.statusCode == 401) { + var value = await refreshToken(context); + if (value != null) { + var value = await get(context, url); + return value; + } + } else { + showAlertDialog(context, "กรุณาตรวจสอบ Internet ของท่าน"); + // showAlertDialog(context, response.body); + try { + // final jsonResponse = json.decode(response.body); + print(response.body); + return response.body; + } catch (a) { + print(a); + } + } + } catch (e) { + print(e); + // showAlertDialog(context, e.toString()); + } + } + static Future postLogin(BuildContext context, String url, String jsonParam) async { printLongString(jsonParam); try { @@ -371,7 +416,7 @@ class Api { printLongString(jsonParam); try { var response; - if (tokenModel != null) { + if (tokenAdmin != null) { Map requestHeaders = {HttpHeaders.contentTypeHeader: "application/json", "Authorization": "Bearer $tokenAdmin"}; response = await http.post(Uri.parse(url), body: jsonParam, headers: requestHeaders); } else { @@ -379,7 +424,7 @@ class Api { response = await http.post(Uri.parse(url), body: jsonParam, headers: requestHeaders); } - // printApiStatus(response); + printApiStatus(response); if (response.statusCode == 200 || response.statusCode == 201 || response.statusCode == 204) { final jsonResponse = json.decode(response.body); diff --git a/neowallet_mobile/lib/model/menu_icon_model.dart b/neowallet_mobile/lib/model/menu_icon_model.dart new file mode 100644 index 00000000..5672360c --- /dev/null +++ b/neowallet_mobile/lib/model/menu_icon_model.dart @@ -0,0 +1,73 @@ +class MenuIconModel { + String? iconUid; + String? name; + String? link; + String? description; + String? fileUrl; + String? fileName; + bool? isUse; + int? statusId; + var createdBy; + var createdDatetime; + var updatedBy; + var updatedDatetime; + var search; + var ownerAgencyUid; + int? localID = -1; + String? token; + + MenuIconModel( + {this.iconUid, + this.name, + this.link, + this.description, + this.fileUrl, + this.fileName, + this.isUse, + this.statusId, + this.createdBy, + this.createdDatetime, + this.updatedBy, + this.updatedDatetime, + this.search, + this.ownerAgencyUid, + this.token, + this.localID}); + + MenuIconModel.fromJson(Map json) { + iconUid = json['icon_uid']; + name = json['name']; + link = json['link']; + description = json['description']; + fileUrl = json['file_url']; + fileName = json['file_name']; + isUse = json['is_use']; + statusId = json['status_id']; + createdBy = json['created_by']; + createdDatetime = json['created_datetime']; + updatedBy = json['updated_by']; + updatedDatetime = json['updated_datetime']; + search = json['search']; + ownerAgencyUid = json['owner_agency_uid']; + token = json['secret_token']; + } + + Map toJson() { + final Map data = new Map(); + data['icon_uid'] = this.iconUid; + data['name'] = this.name; + data['link'] = this.link; + data['description'] = this.description; + data['file_url'] = this.fileUrl; + data['file_name'] = this.fileName; + data['is_use'] = this.isUse; + data['status_id'] = this.statusId; + data['created_by'] = this.createdBy; + data['created_datetime'] = this.createdDatetime; + data['updated_by'] = this.updatedBy; + data['updated_datetime'] = this.updatedDatetime; + data['search'] = this.search; + data['owner_agency_uid'] = this.ownerAgencyUid; + return data; + } +} \ No newline at end of file diff --git a/neowallet_mobile/lib/utils/color_custom.dart b/neowallet_mobile/lib/utils/color_custom.dart index c5ce45e3..758cf1eb 100644 --- a/neowallet_mobile/lib/utils/color_custom.dart +++ b/neowallet_mobile/lib/utils/color_custom.dart @@ -25,6 +25,7 @@ class ColorCustom { + static const red = Color(0xff9d001b); static const white = Color(0xFFFFFFFF); static const black = Color(0xFF000000); static const primaryColor = Color(0xFFCFDFEB); diff --git a/neowallet_mobile/pubspec.yaml b/neowallet_mobile/pubspec.yaml index 124df3aa..9f7c9122 100644 --- a/neowallet_mobile/pubspec.yaml +++ b/neowallet_mobile/pubspec.yaml @@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html # In Windows, build-name is used as the major, minor, and patch parts # of the product and file versions while build-number is used as the build suffix. -version: 1.0.0+2 +version: 1.0.2+8 environment: sdk: '>=2.19.3 <3.0.0' @@ -31,29 +31,33 @@ dependencies: http: any google_fonts: ^6.0.1 camera: ^0.10.3+2 - pin_code_fields: ^7.4.0 + pin_code_fields: ^8.0.1 shared_preferences: ^2.1.0 path_provider: ^2.0.5 image_picker: ^0.8.7+4 - intl: ^0.18.1 + intl: ^0.19.0 font_awesome_flutter: ^10.4.0 signature: ^5.4.0 - mime: ^1.0.4 + mime: ^2.0.0 device_info_plus: ^9.0.2 qr_code_scanner: ^1.0.1 qr_flutter: ^4.1.0 flutter_launcher_icons: ^0.13.1 webview_flutter: ^4.4.2 - image_gallery_saver: ^2.0.3 +# image_gallery_saver: ^2.0.3 pull_to_refresh_flutter3: ^2.0.2 - carousel_slider: ^4.2.1 + carousel_slider: ^5.0.0 url_launcher: ^6.3.0 package_info_plus: ^8.0.2 mask_text_input_formatter: ^2.9.0 currency_text_input_formatter: ^2.2.5 - screenshot: ^2.5.0 + screenshot: ^3.0.0 easy_localization: ^3.0.7 + saver_gallery: ^4.0.0 + permission_handler: ^11.3.1 +dependency_overrides: + win32: ^5.5.4 flutter: sdk: flutter