delay progress indicator display
This commit is contained in:
parent
b4db712719
commit
26dcceffae
3
TODO
3
TODO
@ -1,3 +1,4 @@
|
||||
|
||||
Todo:
|
||||
☐ Item
|
||||
☐ add active/deleted flag to all data models
|
||||
☐ place dropdown items right below their input
|
@ -21,11 +21,17 @@ class ViewWithProgressIndicator extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _ViewWithProgressIndicatorState extends State<ViewWithProgressIndicator> {
|
||||
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
switch (widget.snapshot.connectionState) {
|
||||
case ConnectionState.none:
|
||||
case ConnectionState.waiting:
|
||||
Widget progressIndicator = Container();
|
||||
// Future.delayed(const Duration(milliseconds: 100)).then((_) => {
|
||||
// progressIndicator = const CircularProgressIndicator()
|
||||
// });
|
||||
return Container(
|
||||
alignment: Alignment.center,
|
||||
padding: widget.padding,
|
||||
@ -33,8 +39,15 @@ class _ViewWithProgressIndicatorState extends State<ViewWithProgressIndicator> {
|
||||
child: SizedBox(
|
||||
width: widget.progressIndicatorSize,
|
||||
height: widget.progressIndicatorSize,
|
||||
// TODO: only show if loading takes longer than 30ms
|
||||
child: const CircularProgressIndicator(),
|
||||
child: FutureBuilder(
|
||||
future: Future.delayed(const Duration(seconds: 1)),
|
||||
builder: (context, wait) {
|
||||
if (wait.connectionState != ConnectionState.waiting) {
|
||||
return const CircularProgressIndicator();
|
||||
}
|
||||
return Container();
|
||||
}
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user