bug fixed
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
/*
|
||||
import 'package:cathaypay_mobile/Home/HomePage.dart';
|
||||
import 'package:cathaypay_mobile/utils/utils.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
@@ -31,6 +32,8 @@ class _PayQrDialogState extends State<PayQrDialog> {
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Padding(
|
||||
@@ -280,3 +283,157 @@ class _PayQrDialogState extends State<PayQrDialog> {
|
||||
);
|
||||
}
|
||||
}
|
||||
*/
|
||||
import 'dart:io';
|
||||
import 'dart:typed_data';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:path_provider/path_provider.dart';
|
||||
import 'package:saver_gallery/saver_gallery.dart';
|
||||
import 'package:screenshot/screenshot.dart';
|
||||
|
||||
import '../utils/utils.dart';
|
||||
|
||||
class PayQrDialog extends StatefulWidget {
|
||||
const PayQrDialog({
|
||||
Key? key,
|
||||
required this.name,
|
||||
required this.phone,
|
||||
required this.transactionId,
|
||||
required this.price,
|
||||
}) : super(key: key);
|
||||
|
||||
final String name;
|
||||
final String phone;
|
||||
final String transactionId;
|
||||
final String price;
|
||||
|
||||
@override
|
||||
State<PayQrDialog> createState() => _PayQrDialogState();
|
||||
}
|
||||
|
||||
class _PayQrDialogState extends State<PayQrDialog> {
|
||||
|
||||
ScreenshotController screenshotController = ScreenshotController();
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Screenshot(
|
||||
controller: screenshotController,
|
||||
child:Padding(
|
||||
padding: const EdgeInsets.all(20.0),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Card(
|
||||
color: const Color(0xfffbfbfb),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(10.0),
|
||||
child: Column(
|
||||
children: [
|
||||
Container(
|
||||
height: 180,
|
||||
width: 180,
|
||||
child: const Image(
|
||||
image: AssetImage('images/neopay_logo.png'),
|
||||
),
|
||||
),
|
||||
const Text(
|
||||
"Approved or completed successfully",
|
||||
style: TextStyle(
|
||||
color: Color(0xff65676b),
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w300,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
Text(
|
||||
"Amount ฿${widget.price}",
|
||||
style: const TextStyle(
|
||||
color: Color(0xff65676b),
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w300,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
const Text(
|
||||
"Receiver:",
|
||||
style: TextStyle(
|
||||
color: Color(0xff65676b),
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w300,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
widget.name,
|
||||
style: const TextStyle(
|
||||
color: Color(0xff65676b),
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
InkWell(
|
||||
onTap: () async {
|
||||
screenshotController
|
||||
.capture(delay: Duration(milliseconds: 10))
|
||||
.then((capturedImage) async {
|
||||
String fileName = "neopay_${DateTime.now().millisecondsSinceEpoch}.jpg";
|
||||
SaverGallery.saveImage(capturedImage!, fileName: fileName, skipIfExists: false);
|
||||
Utils.showAlertDialog(context, "บันทึกสำเร็จ");
|
||||
}).catchError((onError) {
|
||||
print(onError);
|
||||
});
|
||||
|
||||
},
|
||||
child: Container(
|
||||
margin: EdgeInsets.only(top: 20, bottom: 20),
|
||||
width: MediaQuery
|
||||
.of(context)
|
||||
.size
|
||||
.width,
|
||||
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,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
],
|
||||
),
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user