This commit is contained in:
Manasit.K
2024-12-12 10:12:19 +07:00
parent 43c32ef6cf
commit ed510b00d1
52 changed files with 1256 additions and 1027 deletions

View File

@@ -444,7 +444,7 @@ class _TopUpHistoryState extends State<TopUpHistory> {
"invoiceId": "",
"referencE1": "",
"referencE2": "",
"topupStatus": "WALLETADDED",
"paymentStatus": "WALLETADDED",
"paymentChannel": "",
"createDatefrom": end,
"createDateto": start,

View File

@@ -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<TopUpAmountPage> {
}
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<TopUpAmountPage> {
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<TopUpAmountPage> {
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<TopUpAmountPage> {
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,
),
),
],
),
),
),
),

View File

@@ -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<TopUpMyQrPage> {
@override
void initState() {
initMyQr();
super.initState();
}
bool loading = false;
QrCodeModel? myQrCode;
initMyQr() {
var param = jsonEncode(<dynamic, dynamic>{"MobileDeviceNo": profile?.phoneNumber ?? "", "Note": "myQr",});
Api.post(context, Api.myQrCode, param).then((value) => {
if (value != null) {initQrCode(value)} else {}
var param = jsonEncode(<dynamic, dynamic>{
"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<TopUpMyQrPage> {
);
}
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<TopUpMyQrPage> {
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<TopUpMyQrPage> {
),
))),
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,
),