forked from woltapp/wolt_modal_sheet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.dart
133 lines (126 loc) · 4.84 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
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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
import 'dart:io';
import 'package:coffee_maker/entities/grouped_coffee_orders.dart';
import 'package:coffee_maker/entities/mock_coffee_orders.dart';
import 'package:coffee_maker/home/home_screen.dart';
import 'package:demo_ui_components/demo_ui_components.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'constants/demo_app_colors.dart';
void main() => runApp(const DemoApp());
class DemoApp extends StatefulWidget {
const DemoApp({Key? key}) : super(key: key);
@override
State<DemoApp> createState() => _DemoAppState();
}
class _DemoAppState extends State<DemoApp> {
@override
void initState() {
super.initState();
SystemChrome.setSystemUIOverlayStyle(
const SystemUiOverlayStyle(
systemNavigationBarIconBrightness: Brightness.dark,
systemNavigationBarDividerColor: DemoAppColors.white,
systemNavigationBarColor: DemoAppColors.white,
),
);
}
@override
Widget build(BuildContext context) {
return CupertinoApp(
// This is needed to make the app working with CupertinoApp.
// For more details on CupertinoApp support, see the "CupertinoApp Support" section in the README file.
localizationsDelegates: const <LocalizationsDelegate<dynamic>>[
DefaultMaterialLocalizations.delegate,
],
scrollBehavior: const CustomScrollBehavior(),
debugShowCheckedModeBanner: false,
home: Theme(
data: Theme.of(context).copyWith(
primaryColor: DemoAppColors.blue,
useMaterial3: true,
inputDecorationTheme: const InputDecorationTheme(
suffixStyle: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w400,
color: DemoAppColors.black64,
),
contentPadding: EdgeInsetsDirectional.fromSTEB(16, 12, 16, 8),
border: UnderlineInputBorder(borderSide: BorderSide.none),
constraints: BoxConstraints(minHeight: 64),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: WoltColors.blue),
borderRadius: BorderRadius.all(Radius.circular(8)),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: WoltColors.black16),
borderRadius: BorderRadius.all(Radius.circular(8)),
),
focusColor: WoltColors.blue,
),
textTheme: TextTheme(
headlineMedium: TextStyle(
fontSize: 28,
color: DemoAppColors.black,
fontWeight: FontWeight.w800,
letterSpacing: kIsWeb || Platform.isAndroid ? 0.2 : 0.12,
),
),
typography: Typography.material2021(platform: defaultTargetPlatform),
scaffoldBackgroundColor: DemoAppColors.white,
indicatorColor: Colors.transparent,
cardColor: DemoAppColors.white,
cardTheme: CardTheme(
elevation: 2,
color: DemoAppColors.white,
surfaceTintColor: DemoAppColors.white,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12),
),
),
outlinedButtonTheme: OutlinedButtonThemeData(
style: OutlinedButton.styleFrom(
textStyle: Theme.of(context)
.textTheme
.bodyMedium!
.copyWith(fontWeight: FontWeight.bold),
foregroundColor: DemoAppColors.black,
backgroundColor: DemoAppColors.white,
surfaceTintColor: DemoAppColors.white,
fixedSize: const Size.fromHeight(36),
padding: const EdgeInsets.all(12),
visualDensity: VisualDensity.compact,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8)),
side: BorderSide.none,
),
),
navigationBarTheme: NavigationBarThemeData(
height: 56,
surfaceTintColor: Colors.transparent,
backgroundColor: DemoAppColors.white,
indicatorColor: Colors.transparent,
labelBehavior: NavigationDestinationLabelBehavior.alwaysShow,
labelTextStyle: MaterialStateProperty.resolveWith<TextStyle>(
(state) {
return TextStyle(
fontSize: 10,
color: state.contains(MaterialState.selected)
? DemoAppColors.blue
: DemoAppColors.black64,
);
},
),
),
),
child: HomeScreen(
groupedCoffeeOrders:
GroupedCoffeeOrders.fromCoffeeOrders(mockCoffeeOrders),
isStoreOnline: true,
isGridOverlayVisible: false,
),
),
);
}
}