delay progress indicator display
This commit is contained in:
parent
b4db712719
commit
26dcceffae
3
TODO
3
TODO
@ -1,3 +1,4 @@
|
|||||||
|
|
||||||
Todo:
|
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> {
|
class _ViewWithProgressIndicatorState extends State<ViewWithProgressIndicator> {
|
||||||
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
switch (widget.snapshot.connectionState) {
|
switch (widget.snapshot.connectionState) {
|
||||||
case ConnectionState.none:
|
case ConnectionState.none:
|
||||||
case ConnectionState.waiting:
|
case ConnectionState.waiting:
|
||||||
|
Widget progressIndicator = Container();
|
||||||
|
// Future.delayed(const Duration(milliseconds: 100)).then((_) => {
|
||||||
|
// progressIndicator = const CircularProgressIndicator()
|
||||||
|
// });
|
||||||
return Container(
|
return Container(
|
||||||
alignment: Alignment.center,
|
alignment: Alignment.center,
|
||||||
padding: widget.padding,
|
padding: widget.padding,
|
||||||
@ -33,8 +39,15 @@ class _ViewWithProgressIndicatorState extends State<ViewWithProgressIndicator> {
|
|||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
width: widget.progressIndicatorSize,
|
width: widget.progressIndicatorSize,
|
||||||
height: widget.progressIndicatorSize,
|
height: widget.progressIndicatorSize,
|
||||||
// TODO: only show if loading takes longer than 30ms
|
child: FutureBuilder(
|
||||||
child: const CircularProgressIndicator(),
|
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