@@ -33,21 +33,19 @@ class Home extends StatelessWidget {
3333 );
3434 for (int i = 0 ; i <= 100 ; i++ ) {
3535 /// You don't need to update state, just pass the value.
36- /// Only value required
3736 pd.update (value: i);
3837 i++ ;
3938 await Future .delayed (Duration (milliseconds: 100 ));
4039 }
4140 }
4241
42+ /// Shows a progress dialog with a determinate progress bar.
4343 _valuableProgress (context) async {
4444 ProgressDialog pd = ProgressDialog (context: context);
4545
4646 pd.show (
4747 max: 100 ,
4848 msg: 'File Downloading...' ,
49-
50- /// Assign the type of progress bar.
5149 progressType: ProgressType .valuable,
5250 );
5351 for (int i = 0 ; i <= 100 ; i++ ) {
@@ -57,50 +55,46 @@ class Home extends StatelessWidget {
5755 }
5856 }
5957
58+ /// Shows a progress dialog that starts with a preparation message,
59+ /// then switches to a downloading message.
6060 _preparingProgress (context) async {
6161 ProgressDialog pd = ProgressDialog (context: context);
6262
63- /// show the state of preparation first.
6463 pd.show (
6564 max: 100 ,
6665 msg: 'Preparing Download...' ,
67- progressType: ProgressType .valuable ,
66+ progressType: ProgressType .determinate ,
6867 );
6968
70- /// Added to test late loading starts
7169 await Future .delayed (Duration (milliseconds: 3000 ));
7270 for (int i = 0 ; i <= 100 ; i++ ) {
73- /// You can indicate here that the download has started.
7471 pd.update (value: i, msg: 'File Downloading...' );
7572 i++ ;
7673 await Future .delayed (Duration (milliseconds: 100 ));
7774 }
7875 }
7976
77+ /// Shows a customizable progress dialog with a dark theme.
8078 _customProgress (context) async {
8179 ProgressDialog pd = ProgressDialog (context: context);
82-
83- /// show the state of preparation first.
8480 pd.show (
8581 max: 100 ,
8682 msg: 'Preparing Download...' ,
87- progressType: ProgressType .valuable ,
83+ progressType: ProgressType .determinate ,
8884 backgroundColor: Color (0xff212121 ),
8985 progressValueColor: Color (0xff3550B4 ),
9086 progressBgColor: Colors .white70,
9187 msgColor: Colors .white,
9288 valueColor: Colors .white);
93-
94- /// Added to test late loading starts
9589 await Future .delayed (Duration (milliseconds: 3000 ));
9690 for (int i = 0 ; i <= 100 ; i++ ) {
97- /// You can indicate here that the download has started.
9891 pd.update (value: i, msg: 'File Downloading...' );
9992 i++ ;
10093 await Future .delayed (Duration (milliseconds: 100 ));
10194 }
10295 }
10396
97+ /// Shows a progress dialog that completes with a custom completion widget.
10498 _completedProgress (context) async {
10599 ProgressDialog pd = ProgressDialog (context: context);
106100 pd.show (
@@ -118,6 +112,7 @@ class Home extends StatelessWidget {
118112 }
119113 }
120114
115+ /// Shows a message-only progress dialog without a progress bar.
121116 _onlyMessageProgress (context) async {
122117 ProgressDialog pd = ProgressDialog (context: context);
123118 pd.show (
@@ -126,31 +121,32 @@ class Home extends StatelessWidget {
126121 hideValue: true ,
127122 );
128123
129- /** You can update the message value after a certain action **/
130124 await Future .delayed (Duration (milliseconds: 1000 ));
131125 pd.update (msg: "Almost done..." );
132126
133127 await Future .delayed (Duration (milliseconds: 1000 ));
134128 pd.close ();
135129 }
136130
131+ /// Shows a message-only progress dialog that completes automatically.
137132 _onlyMessageWithCompletionProgress (context) async {
138133 ProgressDialog pd = ProgressDialog (context: context);
139134 pd.show (
140135 barrierDismissible: true ,
141136 msg: "Please waiting..." ,
142137 hideValue: true ,
143- completed: Completed (), // Set Completed
138+ completed: Completed (completionDelay : 1500 ), // Set Completed
144139 );
145-
146- /** You can update the message value after a certain action **/
147140 await Future .delayed (Duration (milliseconds: 1000 ));
148141
142+ pd.update (msg: "Almost done..." );
143+
144+ await Future .delayed (Duration (milliseconds: 1000 ));
149145 /**
150146 * if you can't assign value and want to use completed object. You should set the Value to 100.
151147 * The dialog will close automatically.
152148 * **/
153- pd.update (msg : "Almost done..." , value: 100 );
149+ pd.update (value: 100 );
154150 }
155151
156152 @override
0 commit comments