92 lines
2.6 KiB
Dart
92 lines
2.6 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:go_router/go_router.dart';
|
|
|
|
import 'integration_controller.dart';
|
|
|
|
class IntegrationScreen extends StatefulWidget {
|
|
const IntegrationScreen({super.key});
|
|
|
|
@override
|
|
State<IntegrationScreen> createState() => _IntegrationScreenState();
|
|
}
|
|
|
|
class _IntegrationScreenState extends State<IntegrationScreen> {
|
|
late IntegrationController controller;
|
|
|
|
@override
|
|
void initState() {
|
|
super.initState();
|
|
controller = IntegrationController(context);
|
|
|
|
controller.doIntegration();
|
|
}
|
|
|
|
@override
|
|
void dispose() {
|
|
controller.dispose();
|
|
super.dispose();
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
appBar: AppBar(
|
|
title: const Text('Completing your transaction'),
|
|
),
|
|
body: ListenableBuilder(
|
|
listenable: controller,
|
|
builder: (context, child) {
|
|
if (controller.model.status == 'SUCCESS') {
|
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
|
context.go('/receipt');
|
|
});
|
|
}
|
|
|
|
return Container(
|
|
padding: EdgeInsets.all(50),
|
|
child: Center(
|
|
child: Column(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
children: [
|
|
SizedBox(height: 75),
|
|
SizedBox(height: 5),
|
|
Text(
|
|
'We\'ve successfully collected your funds',
|
|
style: TextStyle(fontSize: 22),
|
|
textAlign: TextAlign.center,
|
|
),
|
|
Image.asset('assets/peak-animation.gif', width: 150),
|
|
SizedBox(
|
|
width: 50,
|
|
child: LinearProgressIndicator(),
|
|
),
|
|
SizedBox(height: 50),
|
|
Text(
|
|
'We are now updating your billing account',
|
|
style: TextStyle(fontSize: 20),
|
|
textAlign: TextAlign.center,
|
|
),
|
|
Text(
|
|
'This won\'t take long',
|
|
style: TextStyle(fontSize: 20),
|
|
textAlign: TextAlign.center,
|
|
),
|
|
SizedBox(height: 30,),
|
|
if(controller.model.status == 'FAILED')
|
|
OutlinedButton(
|
|
child: Text('Retry'),
|
|
onPressed: () {
|
|
controller.doIntegration();
|
|
},
|
|
)
|
|
],
|
|
),
|
|
),
|
|
);
|
|
},
|
|
),
|
|
);
|
|
}
|
|
}
|