@@ -6,6 +6,8 @@ void main() {
66}
77
88class MyExample extends StatelessWidget {
9+ const MyExample ({Key ? key}) : super (key: key);
10+
911 @override
1012 Widget build (BuildContext context) {
1113 return MaterialApp (
@@ -15,7 +17,9 @@ class MyExample extends StatelessWidget {
1517}
1618
1719class Home extends StatelessWidget {
18- _normalProgress (context) async {
20+ const Home ({Key ? key}) : super (key: key);
21+
22+ Future <void > _normalProgress (dynamic context) async {
1923 /// Create progress dialog
2024 ProgressDialog pd = ProgressDialog (context: context);
2125
@@ -40,13 +44,13 @@ class Home extends StatelessWidget {
4044 }
4145
4246 /// Shows a progress dialog with a determinate progress bar.
43- _valuableProgress (context) async {
47+ Future < void > _valuableProgress (dynamic context) async {
4448 ProgressDialog pd = ProgressDialog (context: context);
4549
4650 pd.show (
4751 max: 100 ,
4852 msg: 'File Downloading...' ,
49- progressType: ProgressType .valuable ,
53+ progressType: ProgressType .determinate ,
5054 );
5155 for (int i = 0 ; i <= 100 ; i++ ) {
5256 pd.update (value: i);
@@ -57,7 +61,7 @@ class Home extends StatelessWidget {
5761
5862 /// Shows a progress dialog that starts with a preparation message,
5963 /// then switches to a downloading message.
60- _preparingProgress (context) async {
64+ Future < void > _preparingProgress (dynamic context) async {
6165 ProgressDialog pd = ProgressDialog (context: context);
6266
6367 pd.show (
@@ -75,7 +79,7 @@ class Home extends StatelessWidget {
7579 }
7680
7781 /// Shows a customizable progress dialog with a dark theme.
78- _customProgress (context) async {
82+ Future < void > _customProgress (dynamic context) async {
7983 ProgressDialog pd = ProgressDialog (context: context);
8084 pd.show (
8185 max: 100 ,
@@ -84,8 +88,8 @@ class Home extends StatelessWidget {
8488 backgroundColor: Color (0xff212121 ),
8589 progressValueColor: Color (0xff3550B4 ),
8690 progressBgColor: Colors .white70,
87- msgColor : Colors .white,
88- valueColor : Colors .white);
91+ msgStyle : TextStyle (color : Colors .white) ,
92+ valueStyle : TextStyle (color : Colors .white) );
8993 await Future .delayed (Duration (milliseconds: 3000 ));
9094 for (int i = 0 ; i <= 100 ; i++ ) {
9195 pd.update (value: i, msg: 'File Downloading...' );
@@ -95,7 +99,7 @@ class Home extends StatelessWidget {
9599 }
96100
97101 /// Shows a progress dialog that completes with a custom completion widget.
98- _completedProgress (context) async {
102+ Future < void > _completedProgress (dynamic context) async {
99103 ProgressDialog pd = ProgressDialog (context: context);
100104 pd.show (
101105 max: 100 ,
@@ -113,7 +117,7 @@ class Home extends StatelessWidget {
113117 }
114118
115119 /// Shows a message-only progress dialog without a progress bar.
116- _onlyMessageProgress (context) async {
120+ Future < void > _onlyMessageProgress (dynamic context) async {
117121 ProgressDialog pd = ProgressDialog (context: context);
118122 pd.show (
119123 barrierDismissible: true ,
@@ -129,7 +133,7 @@ class Home extends StatelessWidget {
129133 }
130134
131135 /// Shows a message-only progress dialog that completes automatically.
132- _onlyMessageWithCompletionProgress (context) async {
136+ Future < void > _onlyMessageWithCompletionProgress (dynamic context) async {
133137 ProgressDialog pd = ProgressDialog (context: context);
134138 pd.show (
135139 barrierDismissible: true ,
@@ -152,65 +156,63 @@ class Home extends StatelessWidget {
152156 @override
153157 Widget build (BuildContext context) {
154158 return Scaffold (
155- body: Container (
156- child: Center (
157- child: Column (
158- mainAxisAlignment: MainAxisAlignment .center,
159- children: [
160- Padding (
161- padding: const EdgeInsets .all (20.0 ),
162- child: Text (
163- 'Sn Progress Example' ,
164- style: TextStyle (
165- fontSize: 30.0 ,
166- fontWeight: FontWeight .bold,
167- ),
159+ body: Center (
160+ child: Column (
161+ mainAxisAlignment: MainAxisAlignment .center,
162+ children: [
163+ Padding (
164+ padding: const EdgeInsets .all (20.0 ),
165+ child: Text (
166+ 'Sn Progress Example' ,
167+ style: TextStyle (
168+ fontSize: 30.0 ,
169+ fontWeight: FontWeight .bold,
168170 ),
169171 ),
170- MaterialButton (
171- color : Color ( 0xfff7f7f7 ),
172- child : Text ( 'Normal Progress' ),
173- onPressed : () {
174- _normalProgress (context);
175- }),
176- MaterialButton (
177- color : Color ( 0xfff7f7f7 ),
178- child : Text ( 'Valuable Progress' ),
179- onPressed : () {
180- _valuableProgress (context);
181- }),
182- MaterialButton (
183- color : Color ( 0xfff7f7f7 ),
184- child : Text ( 'Preparing Progress' ),
185- onPressed : () {
186- _preparingProgress (context);
187- }),
188- MaterialButton (
189- color : Color ( 0xfff7f7f7 ),
190- child : Text ( 'Custom Progress' ),
191- onPressed : () {
192- _customProgress (context);
193- }),
194- MaterialButton (
195- color : Color ( 0xfff7f7f7 ),
196- child : Text ( 'Completed Progress' ),
197- onPressed : () {
198- _completedProgress (context);
199- }),
200- MaterialButton (
201- color : Color ( 0xfff7f7f7 ),
202- child : Text ( 'Message Progress' ),
203- onPressed : () {
204- _onlyMessageProgress (context);
205- }),
206- MaterialButton (
207- color : Color ( 0xfff7f7f7 ),
208- child : Text ( 'Message Progress With Completed' ),
209- onPressed : () {
210- _onlyMessageWithCompletionProgress (context);
211- }),
212- ] ,
213- ) ,
172+ ),
173+ MaterialButton (
174+ color : Color ( 0xfff7f7f7 ),
175+ child : Text ( 'Normal Progress' ),
176+ onPressed : () {
177+ _normalProgress (context);
178+ }),
179+ MaterialButton (
180+ color : Color ( 0xfff7f7f7 ),
181+ child : Text ( 'Valuable Progress' ),
182+ onPressed : () {
183+ _valuableProgress (context);
184+ }),
185+ MaterialButton (
186+ color : Color ( 0xfff7f7f7 ),
187+ child : Text ( 'Preparing Progress' ),
188+ onPressed : () {
189+ _preparingProgress (context);
190+ }),
191+ MaterialButton (
192+ color : Color ( 0xfff7f7f7 ),
193+ child : Text ( 'Custom Progress' ),
194+ onPressed : () {
195+ _customProgress (context);
196+ }),
197+ MaterialButton (
198+ color : Color ( 0xfff7f7f7 ),
199+ child : Text ( 'Completed Progress' ),
200+ onPressed : () {
201+ _completedProgress (context);
202+ }),
203+ MaterialButton (
204+ color : Color ( 0xfff7f7f7 ),
205+ child : Text ( 'Message Progress' ),
206+ onPressed : () {
207+ _onlyMessageProgress (context);
208+ }),
209+ MaterialButton (
210+ color : Color ( 0xfff7f7f7 ),
211+ child : Text ( 'Message Progress With Completed' ),
212+ onPressed : () {
213+ _onlyMessageWithCompletionProgress (context);
214+ }) ,
215+ ] ,
214216 ),
215217 ),
216218 );
0 commit comments