import 'package:flutter/material.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:intl/intl.dart'; import 'package:saver_gallery/saver_gallery.dart'; import 'package:screenshot/screenshot.dart'; import '../utils/utils.dart'; class WithDrawDialog extends StatefulWidget { WithDrawDialog({Key? key}) : super(key: key); @override State createState() => _WithDrawDialogState(); } class _WithDrawDialogState extends State { ScreenshotController screenshotController = ScreenshotController(); @override Widget build(BuildContext context) { return AlertDialog( title: Screenshot( controller: screenshotController, child:Container( child: Padding( padding: const EdgeInsets.all(0.0), child: Column( mainAxisSize: MainAxisSize.min, mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [ Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text( "จ่ายเงินสำเร็จ", style: TextStyle( color: Color(0xff65676b), fontSize: 16, fontWeight: FontWeight.w300, ), ), Text( "0158987", style: TextStyle( color: Color(0xff65676b), fontSize: 16, fontWeight: FontWeight.w300, ), ) ], ), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text( "เลขที่บิล", style: TextStyle( color: Color(0xff65676b), fontSize: 16, fontWeight: FontWeight.w300, ), ), Text( "0158987", style: TextStyle( color: Color(0xff65676b), fontSize: 16, fontWeight: FontWeight.w300, ), ) ], ), SizedBox( height: 15, ), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text( "เวลา", style: TextStyle( color: Color(0xff65676b), fontSize: 16, fontWeight: FontWeight.w300, ), ), Text( "${DateFormat("yyyy-MM-dd").format(DateTime.now())}", style: TextStyle( color: Color(0xff65676b), fontSize: 16, fontWeight: FontWeight.w300, ), ) ], ), Text( "ช่องทางการเติมเงิน", style: TextStyle( color: Color(0xff050505), fontSize: 16, ), ), Row( children: [ Container( width: 70, height: 70, child: Image( image: AssetImage('images/bank/kbank.png'), fit: BoxFit.cover, ), ), Spacer(), Text( "015-5-40141-2", textAlign: TextAlign.right, style: TextStyle( color: Color(0xff050505), fontSize: 20, ), ) ], ), Padding( padding: const EdgeInsets.symmetric(vertical: 10), child: Divider( color: Color.fromRGBO(101, 103, 107, 1), thickness: 0.4000000059604645), ), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text( "จำนวนเงิน", style: TextStyle( color: Color(0xff65676b), fontSize: 16, fontWeight: FontWeight.w300, ), ), Text( "500", style: TextStyle( color: Color(0xff65676b), fontSize: 20, fontWeight: FontWeight.w800, ), ) ], ), SizedBox( height: 20, ), InkWell( onTap: () async { Navigator.popUntil( context, ModalRoute.withName('/HomePage')); }, 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, ), ), ), ], ), ), ), 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, ), ), ), ], ), ), ), ]))))); } }