Skip to content

Commit 96fe452

Browse files
committed
Payment success page completed
1 parent 65f84fc commit 96fe452

File tree

7 files changed

+151
-6
lines changed

7 files changed

+151
-6
lines changed

android/app/build.gradle

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ android {
4343
versionCode flutterVersionCode.toInteger()
4444
versionName flutterVersionName
4545
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
46+
4647
}
4748
signingConfigs {
4849
release {
@@ -63,7 +64,9 @@ android {
6364

6465
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
6566
}
67+
6668
}
69+
6770
}
6871

6972
flutter {

lib/logic/viewmodel/menu_view_model.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ class MenuViewModel {
5353
title: "Payment",
5454
icon: Icons.payment,
5555
image: UIData.paymentImage,
56-
items: ["Credit Card", "Payment 2", "Payment 3", "Payment 4"]),
56+
items: ["Credit Card", "Payment Success", "Payment 3", "Payment 4"]),
5757
];
5858
}
5959
}

lib/main.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import 'package:flutter_uikit/myapp.dart';
55

66
void main() {
77
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
8-
MaterialPageRoute.debugEnableFadingRoutes = true;
8+
// MaterialPageRoute.debugEnableFadingRoutes = true;
99
Injector.configure(Flavor.MOCK);
1010
runApp(MyApp());
1111
}

lib/myapp.dart

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import 'package:flutter_uikit/ui/page/home_page.dart';
55
import 'package:flutter_uikit/ui/page/login/login_page.dart';
66
import 'package:flutter_uikit/ui/page/notfound/notfound_page.dart';
77
import 'package:flutter_uikit/ui/page/payment/credit_card_page.dart';
8+
import 'package:flutter_uikit/ui/page/payment/payment_success_page.dart';
89
import 'package:flutter_uikit/ui/page/profile/profile_one_page.dart';
910
import 'package:flutter_uikit/ui/page/profile/profile_two_page.dart';
1011
import 'package:flutter_uikit/ui/page/settings/settings_one_page.dart';
@@ -26,7 +27,7 @@ class MyApp extends StatelessWidget {
2627
primarySwatch: Colors.amber),
2728
debugShowCheckedModeBanner: false,
2829
showPerformanceOverlay: false,
29-
home: ProfileTwoPage(),
30+
home: HomePage(),
3031
// initialRoute: UIData.notFoundRoute,
3132

3233
//routes
@@ -45,6 +46,7 @@ class MyApp extends StatelessWidget {
4546
ProductDetailPage(),
4647
UIData.loginOneRoute: (BuildContext context) => LoginPage(),
4748
UIData.paymentOneRoute: (BuildContext context) => CreditCardPage(),
49+
UIData.paymentTwoRoute: (BuildContext context) => PaymentSuccessPage(),
4850
UIData.dashboardOneRoute: (BuildContext context) => DashboardOnePage(),
4951
UIData.dashboardTwoRoute: (BuildContext context) => DashboardTwoPage(),
5052
},

lib/ui/page/payment/credit_card_page.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,11 @@ class CreditCardPage extends StatelessWidget {
5151
Widget cardEntries() => Padding(
5252
padding: const EdgeInsets.all(16.0),
5353
child: Column(
54+
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
5455
crossAxisAlignment: CrossAxisAlignment.start,
5556
children: <Widget>[
5657
Align(
57-
alignment: Alignment.centerRight,
58+
alignment: Alignment.topRight,
5859
child: Icon(
5960
FontAwesomeIcons.ccVisa,
6061
size: 40.0,
Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
import 'dart:async';
2+
3+
import 'package:flutter/material.dart';
4+
import 'package:flutter_uikit/ui/widgets/common_scaffold.dart';
5+
import 'package:flutter_uikit/ui/widgets/profile_tile.dart';
6+
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
7+
import 'package:random_pk/random_pk.dart';
8+
9+
class PaymentSuccessPage extends StatefulWidget {
10+
@override
11+
PaymentSuccessPageState createState() {
12+
return new PaymentSuccessPageState();
13+
}
14+
}
15+
16+
class PaymentSuccessPageState extends State<PaymentSuccessPage> {
17+
bool isDataAvailable = true;
18+
Widget bodyData() => Center(
19+
child: isDataAvailable
20+
? RaisedButton(
21+
shape: StadiumBorder(),
22+
onPressed: () => showSuccessDialog(),
23+
color: Colors.amber,
24+
child: Text("Process Payment"),
25+
)
26+
: CircularProgressIndicator(),
27+
);
28+
29+
@override
30+
Widget build(BuildContext context) {
31+
return CommonScaffold(
32+
appTitle: "Payment Success",
33+
actionFirstIcon: null,
34+
bodyData: bodyData(),
35+
);
36+
}
37+
38+
void showSuccessDialog() {
39+
setState(() {
40+
isDataAvailable = false;
41+
Future.delayed(Duration(seconds: 3)).then((_) => goToDialog());
42+
});
43+
}
44+
45+
goToDialog() {
46+
setState(() {
47+
isDataAvailable = true;
48+
});
49+
showDialog(
50+
context: context,
51+
barrierDismissible: true,
52+
builder: (context) => Center(
53+
child: Column(
54+
mainAxisAlignment: MainAxisAlignment.center,
55+
children: <Widget>[
56+
successTicket(),
57+
SizedBox(
58+
height: 10.0,
59+
),
60+
FloatingActionButton(
61+
backgroundColor: Colors.grey,
62+
child: Icon(
63+
Icons.clear,
64+
color: Colors.white,
65+
),
66+
onPressed: () {
67+
Navigator.pop(context);
68+
},
69+
)
70+
],
71+
),
72+
));
73+
}
74+
75+
successTicket() => Container(
76+
width: double.infinity,
77+
padding: const EdgeInsets.all(16.0),
78+
child: Material(
79+
elevation: 2.0,
80+
borderRadius: BorderRadius.circular(4.0),
81+
child: Padding(
82+
padding: const EdgeInsets.all(16.0),
83+
child: Column(
84+
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
85+
children: <Widget>[
86+
ProfileTile(
87+
title: "Thank You!",
88+
textColor: Colors.purple,
89+
subtitle: "Your transaction was successful",
90+
),
91+
Row(
92+
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
93+
mainAxisSize: MainAxisSize.min,
94+
children: List
95+
.generate(50, (i) => "-")
96+
.map((o) => Text(
97+
o,
98+
maxLines: 1,
99+
))
100+
.toList(),
101+
),
102+
ListTile(
103+
title: Text("Date"),
104+
subtitle: Text("26 June 2018"),
105+
trailing: Text("11:00 AM"),
106+
),
107+
ListTile(
108+
title: Text("Pawan Kumar"),
109+
subtitle: Text("mtechviral@gmail.com"),
110+
trailing: CircleAvatar(
111+
radius: 20.0,
112+
backgroundImage: NetworkImage(
113+
"https://avatars0.githubusercontent.com/u/12619420?s=460&v=4"),
114+
),
115+
),
116+
ListTile(
117+
title: Text("Amount"),
118+
subtitle: Text("\$299"),
119+
trailing: Text("Completed"),
120+
),
121+
Card(
122+
elevation: 0.0,
123+
color: Colors.grey.shade300,
124+
child: ListTile(
125+
leading: Icon(
126+
FontAwesomeIcons.ccAmex,
127+
color: Colors.blue,
128+
),
129+
title: Text("Credit/Debit Card"),
130+
subtitle: Text("Amex Card ending ***6"),
131+
),
132+
)
133+
],
134+
),
135+
),
136+
),
137+
);
138+
}

lib/utils/uidata.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ class UIData {
1616
static const String shoppingTwoRoute = "/Shopping Details";
1717
static const String shoppingThreeRoute = "/Product Details";
1818
static const String paymentOneRoute = "/Credit Card";
19+
static const String paymentTwoRoute = "/Payment Success";
1920
static const String loginOneRoute = "/Login With OTP";
2021
static const String dashboardOneRoute = "/Dashboard 1";
2122
static const String dashboardTwoRoute = "/Dashboard 2";
@@ -73,8 +74,8 @@ class UIData {
7374
Colors.black87,
7475
];
7576
static List<Color> kitGradients2 = [
76-
Colors.orange.shade800,
77-
Colors.pink,
77+
Color(0xffb7ac50),
78+
Colors.orange.shade900
7879
];
7980

8081
//randomcolor

0 commit comments

Comments
 (0)