-
-
Notifications
You must be signed in to change notification settings - Fork 545
/
Copy pathmain.dart
68 lines (60 loc) · 1.59 KB
/
main.dart
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
// ignore_for_file: use_key_in_widget_constructors
import 'package:flutter/material.dart';
import 'package:flutter_stripe/flutter_stripe.dart';
import 'package:stripe_example/.env.dart';
import 'screens/screens.dart';
import 'widgets/dismiss_focus_overlay.dart';
void main() async {
WidgetsFlutterBinding.ensureInitialized();
Stripe.publishableKey = stripePublishableKey;
Stripe.merchantIdentifier = 'merchant.flutter.stripe.test';
Stripe.urlScheme = 'flutterstripe';
await Stripe.instance.applySettings();
runApp(const App());
}
class App extends StatelessWidget {
const App({super.key});
@override
Widget build(BuildContext context) {
return DismissFocusOverlay(
child: MaterialApp(
theme: exampleAppTheme,
home: HomePage(),
navigatorObservers: [],
),
);
}
}
class HomePage extends StatefulWidget {
@override
_HomePageState createState() => _HomePageState();
}
class _HomePageState extends State<HomePage> {
@override
void initState() {
super.initState();
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Stripe Examples'),
),
body: ListView(children: [
...ListTile.divideTiles(
context: context,
tiles: [for (final example in Example.screens) example],
),
]),
);
}
}
final exampleAppTheme = ThemeData(
colorScheme: ColorScheme.light(
primary: Color(0xff6058F7),
secondary: Color(0xff6058F7),
),
primaryColor: Colors.white,
useMaterial3: false,
appBarTheme: AppBarTheme(elevation: 1),
);