-
Notifications
You must be signed in to change notification settings - Fork 77
Expand file tree
/
Copy pathpay_success_screen.dart
More file actions
98 lines (94 loc) · 3.25 KB
/
Copy pathpay_success_screen.dart
File metadata and controls
98 lines (94 loc) · 3.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
import 'package:bb_mobile/core/themes/app_theme.dart';
import 'package:bb_mobile/core/utils/build_context_x.dart';
import 'package:bb_mobile/core/widgets/buttons/button.dart';
import 'package:bb_mobile/features/exchange/ui/exchange_router.dart';
import 'package:bb_mobile/features/pay/presentation/pay_bloc.dart';
import 'package:bb_mobile/features/transactions/ui/transactions_router.dart';
import 'package:bb_mobile/generated/flutter_gen/assets.gen.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:gap/gap.dart';
import 'package:gif/gif.dart';
import 'package:go_router/go_router.dart';
class PaySuccessScreen extends StatelessWidget {
const PaySuccessScreen({super.key});
@override
Widget build(BuildContext context) {
final order = context.select(
(PayBloc bloc) =>
bloc.state is PaySuccessState
? (bloc.state as PaySuccessState).payOrder
: null,
);
return PopScope(
canPop: false,
onPopInvokedWithResult: (didPop, _) {
if (didPop) return; // Don't allow back navigation
context.goNamed(ExchangeRoute.exchangeHome.name);
},
child: Scaffold(
appBar: AppBar(
title: Text(context.loc.payTitle),
automaticallyImplyLeading: false,
actions: [
IconButton(
icon: const Icon(Icons.close),
onPressed: () {
context.goNamed(ExchangeRoute.exchangeHome.name);
},
),
],
),
body: SafeArea(
child: Center(
child: Column(
mainAxisAlignment: .center,
children: [
Gif(
image: AssetImage(Assets.animations.successTick.path),
autostart: Autostart.once,
height: 100,
width: 100,
),
const Gap(20),
Text(context.loc.payCompleted, style: context.font.titleLarge),
const Gap(10),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 32.0),
child: Text(
context.loc.payCompletedDescription,
style: context.font.bodyMedium,
textAlign: .center,
),
),
],
),
),
),
bottomNavigationBar: SafeArea(
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
mainAxisSize: .min,
children: [
if (order != null)
BBButton.big(
label: context.loc.payViewDetails,
onPressed: () {
context.pushNamed(
TransactionsRoute.orderTransactionDetails.name,
pathParameters: {'orderId': order.orderId},
queryParameters: {'returnToExchange': 'true'},
);
},
bgColor: context.appColors.secondary,
textColor: context.appColors.onSecondary,
),
],
),
),
),
),
);
}
}