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

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