/
main.dart
148 lines (136 loc) · 4.35 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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
import 'package:flutter/material.dart';
import 'progress_bar_example.dart';
import 'value_notifier_example.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatefulWidget {
const MyApp({Key? key}) : super(key: key);
@override
State<MyApp> createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
@override
void initState() {
super.initState();
}
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text('Progress bar example app'),
),
body: const ExampleHome(),
),
);
}
}
class ExampleHome extends StatelessWidget {
const ExampleHome({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
final ButtonStyle buttonStyle = ButtonStyle(
textStyle: MaterialStateProperty.all(TextStyle(
foreground: Paint()..color = Colors.white,
fontSize: 20,
fontWeight: FontWeight.bold,
)),
minimumSize: MaterialStateProperty.all(const Size.fromHeight(60)),
backgroundColor: MaterialStateProperty.all(
Colors.black.withOpacity(0.25),
),
alignment: Alignment.center,
);
return Container(
decoration: const BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: [
Color(0xff0d324d),
Color(0xff7f5a83),
],
)),
child: Padding(
padding: const EdgeInsets.only(left: 20, right: 20),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
children: [
const SizedBox(
height: 20,
),
// Create 'Progress bar example' button.
// -----------------------------------------------------------------
// Most of the examples of working with the progress bar, you can
// find in the file: progress_bar_example.dart.
// -----------------------------------------------------------------
Expanded(
child: ElevatedButton(
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const ProgressBarExample(),
),
);
},
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Text('Progress bar example'.toUpperCase()),
const Text(
'More than 18 examples of bar progress states',
textAlign: TextAlign.center,
style: TextStyle(
fontWeight: FontWeight.normal,
),
),
],
),
style: buttonStyle,
),
),
const SizedBox(
height: 20,
),
// Create 'Value notifier example' button.
// -----------------------------------------------------------------
// Examples of working with value notifier, you can see in the file:
// value_notifier_example.dart.
// -----------------------------------------------------------------
Expanded(
child: ElevatedButton(
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const ValueNotifierExample(),
),
);
},
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Text('Value notifier example'.toUpperCase()),
const Text(
'An example showing how to work with ValueNotifier',
textAlign: TextAlign.center,
style: TextStyle(
fontWeight: FontWeight.normal,
),
),
],
),
style: buttonStyle,
),
),
const SizedBox(
height: 20,
),
],
),
),
);
}
}