File tree Expand file tree Collapse file tree 1 file changed +18
-4
lines changed Expand file tree Collapse file tree 1 file changed +18
-4
lines changed Original file line number Diff line number Diff line change @@ -107,6 +107,8 @@ class AddAccountPage extends StatefulWidget {
107
107
}
108
108
109
109
class _AddAccountPageState extends State <AddAccountPage > {
110
+ bool _inProgress = false ;
111
+
110
112
final ServerUrlTextEditingController _controller = ServerUrlTextEditingController ();
111
113
late ServerUrlParseResult _parseResult;
112
114
@@ -138,8 +140,18 @@ class _AddAccountPageState extends State<AddAccountPage> {
138
140
}
139
141
assert (url != null );
140
142
141
- // TODO(#35): show feedback that we're working, while fetching server settings
142
- final serverSettings = await getServerSettings (realmUrl: url! );
143
+ final GetServerSettingsResult serverSettings;
144
+ setState (() {
145
+ _inProgress = true ;
146
+ });
147
+ try {
148
+ serverSettings = await getServerSettings (realmUrl: url! );
149
+ // TODO(#35) report errors
150
+ } finally {
151
+ setState (() {
152
+ _inProgress = false ;
153
+ });
154
+ }
143
155
if (context.mounted) {} // https://github.com/dart-lang/linter/issues/4007
144
156
else {
145
157
return ;
@@ -173,10 +185,12 @@ class _AddAccountPageState extends State<AddAccountPage> {
173
185
? null
174
186
: error.message (),
175
187
suffixIcon: IconButton (
176
- onPressed: error == null || error.shouldDeferFeedback ()
188
+ onPressed: ! _inProgress && ( error == null || error.shouldDeferFeedback () )
177
189
? () => _onSubmitted (context)
178
190
: null , // disabled; errorText will be present
179
- icon: const Icon (Icons .arrow_forward))))))));
191
+ icon: _inProgress
192
+ ? const CircularProgressIndicator .adaptive ()
193
+ : const Icon (Icons .arrow_forward))))))));
180
194
}
181
195
}
182
196
You can’t perform that action at this time.
0 commit comments