import 'dart:convert'; import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:get/get.dart'; import 'package:qr_flutter/qr_flutter.dart'; import 'package:screenshot/screenshot.dart'; // import 'package:screenshot/screenshot.dart'; import '../../../core/constants/app_assets.dart'; import '../../../core/constants/translation_keys.dart'; import '../../../core/utils/SessionCache.dart'; import '../../../custom_widgets/custom_app_bar.dart'; import '../../../custom_widgets/custom_button.dart'; import '../../../res/app_colors.dart'; import '../controllers/qr_setting_controller.dart'; class QrSettingView extends GetView { const QrSettingView({Key? key}) : super(key: key); @override Widget build(BuildContext context) { return Scaffold( appBar: DashBoardAppBar( title: TranslationKeys.makeTranslation(TranslationKeys.textQRSetting), onBackButtonPressed: () { Get.back(); }, ), body: Padding( padding: const EdgeInsets.symmetric(horizontal: 20.0, vertical: 20.0), child: Column( children: [ const SizedBox(height: 20), Align( alignment: Alignment.center, child: Text( TranslationKeys.makeTranslation(TranslationKeys.textYourUCOQR), style: Theme.of(context).textTheme.titleSmall?.copyWith(fontWeight: FontWeight.w500, fontSize: 20), textAlign: TextAlign.center, ), ), const SizedBox(height: 20), Text( TranslationKeys.makeTranslation(TranslationKeys.textUCOQRContent), style: Theme.of(context).textTheme.bodySmall?.copyWith(fontWeight: FontWeight.w400, fontSize: 14), textAlign: TextAlign.center, ), const SizedBox(height: 20), Screenshot( controller: controller.screenshotController, child: Container( color: Colors.white, padding: const EdgeInsets.all(12), child: QrImageView( data: jsonEncode({"phoneNumber": SessionCache.instance.depositAccountList.first.padAdrsmobphone}), version: QrVersions.auto, size: 200.0, ), ), ), const SizedBox(height: 20), Text( SessionCache.instance.depositAccountList.first.mbmBkmstitle, style: Theme.of(context).textTheme.titleSmall?.copyWith(fontWeight: FontWeight.w500, fontSize: 20), textAlign: TextAlign.center, ), const SizedBox(height: 20), Text( TranslationKeys.makeTranslation(TranslationKeys.textQrAccountNumber), style: Theme.of(context).textTheme.bodyMedium?.copyWith(fontWeight: FontWeight.w400, fontSize: 14), textAlign: TextAlign.center, ), ], ), ), persistentFooterButtons: [ Row( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ CustomButton( onPressed: () { controller.saveAssetImage(); }, icon: SvgPicture.asset( AppAssets.ic_download, height: 15, width: 15, ), buttonText: TranslationKeys.makeTranslation(TranslationKeys.textSavetoGallery), buttonColor: AppColors.colorButton, textStyle: Theme.of(context).textTheme.bodyMedium?.copyWith(color: AppColors.white, fontWeight: FontWeight.w400, fontSize: 13), iconPadding: const EdgeInsets.only(left: 5), buttonPadding: const EdgeInsets.symmetric(vertical: 10, horizontal: 10), ), SizedBox( child: CustomButton( onPressed: () { controller.shareQRImage(); }, iconPadding: const EdgeInsets.only(left: 5), textStyle: Theme.of(context).textTheme.bodyMedium?.copyWith(color: AppColors.black, fontWeight: FontWeight.w400, fontSize: 13), buttonPadding: const EdgeInsets.symmetric(vertical: 10, horizontal: 10), buttonText: TranslationKeys.makeTranslation(TranslationKeys.textShareQRCode), buttonColor: AppColors.colorSkipBtn, sideBorder: const BorderSide(width: 1, color: AppColors.colorBorderSkipBtn), icon: SvgPicture.asset(AppAssets.ic_share, height: 15, width: 15), ), ), ], ), ], persistentFooterAlignment: AlignmentDirectional.bottomCenter, resizeToAvoidBottomInset: false, backgroundColor: AppColors.colorSecondary, ); } }