| 1 | import 'package:cake_wallet/entities/qr_view_data.dart'; |
| 2 | import 'package:cake_wallet/src/widgets/gradient_background.dart'; |
| 3 | import 'package:cake_wallet/src/screens/receive/widgets/qr_image.dart'; |
| 4 | import 'package:flutter/material.dart'; |
| 5 | import 'package:cake_wallet/src/screens/base_page.dart'; |
| 6 | |
| 7 | class FullscreenQRPage extends BasePage { |
| 8 | FullscreenQRPage({required this.qrViewData}); |
| 9 | |
| 10 | final QrViewData qrViewData; |
| 11 | |
| 12 | @override |
| 13 | bool get gradientBackground => true; |
| 14 | |
| 15 | @override |
| 16 | bool get resizeToAvoidBottomInset => false; |
| 17 | |
| 18 | @override |
| 19 | Widget leading(BuildContext context) { |
| 20 | final _backButton = Icon( |
| 21 | Icons.arrow_back_ios, |
| 22 | color: Theme.of(context).colorScheme.onSurface, |
| 23 | size: 16, |
| 24 | ); |
| 25 | |
| 26 | return SizedBox( |
| 27 | height: 37, |
| 28 | width: 37, |
| 29 | child: ButtonTheme( |
| 30 | minWidth: double.minPositive, |
| 31 | child: TextButton( |
| 32 | // FIX-ME: Style |
| 33 | //highlightColor: Colors.transparent, |
| 34 | //splashColor: Colors.transparent, |
| 35 | //padding: EdgeInsets.all(0), |
| 36 | onPressed: () => onClose(context), |
| 37 | child: _backButton, |
| 38 | ), |
| 39 | ), |
| 40 | ); |
| 41 | } |
| 42 | |
| 43 | @override |
| 44 | Widget Function(BuildContext, Widget) get rootWrapper => |
| 45 | (BuildContext context, Widget scaffold) => GradientBackground(scaffold: scaffold); |
| 46 | |
| 47 | @override |
| 48 | Widget body(BuildContext context) { |
| 49 | return Padding( |
| 50 | padding: EdgeInsets.symmetric(horizontal: MediaQuery.of(context).size.width * 0.05), |
| 51 | child: Hero( |
| 52 | tag: Key(qrViewData.heroTag ?? qrViewData.data), |
| 53 | child: Center( |
| 54 | child: AspectRatio( |
| 55 | aspectRatio: 1.0, |
| 56 | child: Container( |
| 57 | padding: EdgeInsets.all(10), |
| 58 | decoration: BoxDecoration( |
| 59 | border: Border.all( |
| 60 | width: 3, |
| 61 | color: Theme.of(context).colorScheme.primary, |
| 62 | ), |
| 63 | borderRadius: BorderRadius.circular(16), |
| 64 | color: Theme.of(context).colorScheme.surface, |
| 65 | ), |
| 66 | child: Container( |
| 67 | decoration: BoxDecoration( |
| 68 | border: Border.all( |
| 69 | width: 3, |
| 70 | color: Theme.of(context).colorScheme.surface, |
| 71 | ), |
| 72 | ), |
| 73 | child: QrImage( |
| 74 | size: 360, |
| 75 | data: qrViewData.data, |
| 76 | version: qrViewData.version, |
| 77 | embeddedImagePath: qrViewData.embeddedImagePath, |
| 78 | ), |
| 79 | ), |
| 80 | ), |
| 81 | ), |
| 82 | ), |
| 83 | ), |
| 84 | ); |
| 85 | } |
| 86 | } |