bug fixed
This commit is contained in:
@@ -1,6 +1,13 @@
|
||||
import 'dart:io';
|
||||
import 'dart:math';
|
||||
import 'dart:typed_data';
|
||||
|
||||
import 'package:cathaypay_mobile/Home/HomePage.dart';
|
||||
import 'package:cathaypay_mobile/utils/utils.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:saver_gallery/saver_gallery.dart';
|
||||
import 'package:screenshot/screenshot.dart';
|
||||
|
||||
import '../api/api.dart';
|
||||
import '../model/profile_model.dart';
|
||||
@@ -19,237 +26,320 @@ class TransferPromtptPayDialog extends StatefulWidget {
|
||||
|
||||
class _TransferPromtptPayDialogState extends State<TransferPromtptPayDialog> {
|
||||
@override
|
||||
ScreenshotController screenshotController = ScreenshotController();
|
||||
|
||||
void initState() {
|
||||
getProfile(context);
|
||||
super.initState();
|
||||
}
|
||||
|
||||
getProfile(BuildContext context) {
|
||||
Api.get(context, Api.profile).then((value) => {
|
||||
if (value != null) {profile = Profile.fromJson(value["profile"])} else {}
|
||||
});
|
||||
Api.get(context, Api.profile).then((value) =>
|
||||
{
|
||||
if (value != null) {profile = Profile.fromJson(value["profile"])} else
|
||||
{}
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.fromLTRB(20, 0, 20, 0),
|
||||
child: Column(mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, children: [
|
||||
Card(
|
||||
color: Color(0xfffbfbfb),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(15.0),
|
||||
child: Column(
|
||||
return Screenshot(
|
||||
controller: screenshotController,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.fromLTRB(20, 0, 20, 0),
|
||||
child: Column(mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Container(height: 180,width: 180,
|
||||
child: Image(
|
||||
image: AssetImage('images/neopay_logo.png'),
|
||||
),
|
||||
),
|
||||
Text(
|
||||
"Approved or completed successfully",
|
||||
style: TextStyle(
|
||||
color: Color(0xff65676b),
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w300,
|
||||
),
|
||||
) ,
|
||||
Text(
|
||||
"ดำเนินการโอน/จ่ายสำเร็จ",
|
||||
style: TextStyle(
|
||||
color: Color(0xff65676b),
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w300,
|
||||
),
|
||||
) ,
|
||||
|
||||
Text(
|
||||
"จำนวนเงิน/Amount ฿"+widget.price,
|
||||
style: TextStyle(
|
||||
color: Color(0xff65676b),
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w300,
|
||||
),
|
||||
) ,
|
||||
SizedBox(height: 30,),
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
image: DecorationImage(
|
||||
image: AssetImage('images/neo_backgroup.png'),
|
||||
fit: BoxFit.fill,
|
||||
|
||||
),
|
||||
),
|
||||
child:Column(children: [ Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
"Date Time / วันที่ เวลา",
|
||||
style: TextStyle(
|
||||
color: Color(0xff65676b),
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w300,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
Utils.getDateTimeCreate(),
|
||||
style: TextStyle(
|
||||
color: Color(0xff65676b),
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
|
||||
Row(
|
||||
children: [
|
||||
Text(
|
||||
"Receiver / ผู้รับเงิน",
|
||||
style: TextStyle(
|
||||
color: Color(0xff65676b),
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w300,
|
||||
),
|
||||
),
|
||||
Spacer(),
|
||||
|
||||
Text(//profile?.fullName??"",
|
||||
widget.name,
|
||||
style: TextStyle(
|
||||
color: Color(0xff65676b),
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
"PhoneNumber / Wallet ID",
|
||||
style: TextStyle(
|
||||
color: Color(0xff65676b),
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w300,
|
||||
),
|
||||
),
|
||||
Text(widget.phone,
|
||||
//profile?.phoneNumber ?? "",
|
||||
style: TextStyle(
|
||||
color: Color(0xff65676b),
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
"From",
|
||||
style: TextStyle(
|
||||
color: Color(0xff65676b),
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w300,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
profile?.fullName ?? "",
|
||||
style: TextStyle(
|
||||
color: Color(0xff65676b),
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
"PhoneNumber / Wallet ID",
|
||||
style: TextStyle(
|
||||
color: Color(0xff65676b),
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w300,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
profile?.phoneNumber ?? "",
|
||||
style: TextStyle(
|
||||
color: Color(0xff65676b),
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: 35,
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
"Transaction ID : ",
|
||||
style: TextStyle(
|
||||
color: Color(0xff65676b),
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w300,
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Container(
|
||||
child: Text(
|
||||
widget.bill,
|
||||
Card(
|
||||
color: Color(0xfffbfbfb),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(15.0),
|
||||
child: Column(
|
||||
children: [
|
||||
Container(height: 180, width: 180,
|
||||
child: Image(
|
||||
image: AssetImage('images/neopay_logo.png'),
|
||||
),
|
||||
),
|
||||
Text(
|
||||
"Approved or completed successfully",
|
||||
style: TextStyle(
|
||||
color: Color(0xff65676b),
|
||||
fontSize: 12,
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w300,
|
||||
),
|
||||
textAlign: TextAlign.start,
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),],)
|
||||
),
|
||||
|
||||
SizedBox(height: 15,),
|
||||
|
||||
InkWell(
|
||||
onTap: () {
|
||||
Navigator.popUntil(context, ModalRoute.withName('/HomePage'));
|
||||
},
|
||||
child: Container(
|
||||
margin: EdgeInsets.only(bottom: 15),
|
||||
width: MediaQuery.of(context).size.width,
|
||||
height: 46,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(100),
|
||||
color: Color(0xffad022c),
|
||||
),
|
||||
child: Center(
|
||||
child: Text(
|
||||
"ปิด",
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.w300,
|
||||
Text(
|
||||
"ดำเนินการโอน/จ่ายสำเร็จ",
|
||||
style: TextStyle(
|
||||
color: Color(0xff65676b),
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w300,
|
||||
),
|
||||
),
|
||||
)),
|
||||
))
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
]));
|
||||
|
||||
Text(
|
||||
"จำนวนเงิน/Amount ฿" + widget.price,
|
||||
style: TextStyle(
|
||||
color: Color(0xff65676b),
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w300,
|
||||
),
|
||||
),
|
||||
SizedBox(height: 30,),
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
image: DecorationImage(
|
||||
image: AssetImage('images/neo_backgroup.png'),
|
||||
fit: BoxFit.fill,
|
||||
|
||||
),
|
||||
),
|
||||
child: Column(children: [ Row(
|
||||
mainAxisAlignment: MainAxisAlignment
|
||||
.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
"Date Time / วันที่ เวลา",
|
||||
style: TextStyle(
|
||||
color: Color(0xff65676b),
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w300,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
Utils.getDateTimeCreate(),
|
||||
style: TextStyle(
|
||||
color: Color(0xff65676b),
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
|
||||
Row(
|
||||
children: [
|
||||
Text(
|
||||
"Receiver / ผู้รับเงิน",
|
||||
style: TextStyle(
|
||||
color: Color(0xff65676b),
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w300,
|
||||
),
|
||||
),
|
||||
Spacer(),
|
||||
|
||||
Text( //profile?.fullName??"",
|
||||
widget.name,
|
||||
style: TextStyle(
|
||||
color: Color(0xff65676b),
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment
|
||||
.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
"PhoneNumber / Wallet ID",
|
||||
style: TextStyle(
|
||||
color: Color(0xff65676b),
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w300,
|
||||
),
|
||||
),
|
||||
Text(widget.phone,
|
||||
//profile?.phoneNumber ?? "",
|
||||
style: TextStyle(
|
||||
color: Color(0xff65676b),
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment
|
||||
.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
"From",
|
||||
style: TextStyle(
|
||||
color: Color(0xff65676b),
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w300,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
profile?.fullName ?? "",
|
||||
style: TextStyle(
|
||||
color: Color(0xff65676b),
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment
|
||||
.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
"PhoneNumber / Wallet ID",
|
||||
style: TextStyle(
|
||||
color: Color(0xff65676b),
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w300,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
profile?.phoneNumber ?? "",
|
||||
style: TextStyle(
|
||||
color: Color(0xff65676b),
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: 35,
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment
|
||||
.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
"Transaction ID : ",
|
||||
style: TextStyle(
|
||||
color: Color(0xff65676b),
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w300,
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Container(
|
||||
child: Text(
|
||||
widget.bill,
|
||||
style: TextStyle(
|
||||
color: Color(0xff65676b),
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w300,
|
||||
),
|
||||
textAlign: TextAlign.start,
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
],)
|
||||
),
|
||||
|
||||
SizedBox(height: 15,),
|
||||
|
||||
InkWell(
|
||||
onTap: () {
|
||||
Navigator.popUntil(
|
||||
context, ModalRoute.withName('/HomePage'));
|
||||
},
|
||||
child: Container(
|
||||
margin: EdgeInsets.only(bottom: 15),
|
||||
width: MediaQuery
|
||||
.of(context)
|
||||
.size
|
||||
.width,
|
||||
height: 46,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(100),
|
||||
color: Color(0xffad022c),
|
||||
),
|
||||
child: Center(
|
||||
child: Text(
|
||||
"ปิด",
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.w300,
|
||||
),
|
||||
)),
|
||||
)),
|
||||
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,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
])));
|
||||
}
|
||||
}
|
||||
|
||||
Future<dynamic> ShowCapturedWidget(BuildContext context,
|
||||
Uint8List capturedImage) {
|
||||
return showDialog(
|
||||
useSafeArea: false,
|
||||
context: context,
|
||||
builder: (context) =>
|
||||
Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text("Captured widget screenshot"),
|
||||
),
|
||||
body: Center(child: Image.memory(capturedImage as Uint8List)),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user