From c9d62743f622880629528671e5fa6765a036181e Mon Sep 17 00:00:00 2001 From: Leandro Date: Mon, 20 May 2024 16:42:03 +0200 Subject: [PATCH] crappy load animation --- lib/screens/wool.dart | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/screens/wool.dart b/lib/screens/wool.dart index b13c0a1..fcdb26c 100644 --- a/lib/screens/wool.dart +++ b/lib/screens/wool.dart @@ -12,13 +12,15 @@ class WoolScreen extends StatelessWidget { @override Widget build(BuildContext context) { + Widget child; + return FutureBuilder( future: Provider.of(context) .select(Provider.of(context).wolle) .get(), builder: (BuildContext context, AsyncSnapshot snapshot) { if (snapshot.connectionState == ConnectionState.waiting) { - return Center( + child = Center( child: Shimmer.fromColors( baseColor: Theme.of(context).colorScheme.secondaryContainer, highlightColor: Theme.of(context) @@ -49,7 +51,7 @@ class WoolScreen extends StatelessWidget { ); } else { // Hier können Sie den Inhalt basierend auf den geladenen Daten anzeigen - return Scaffold( + child = Scaffold( floatingActionButton: FloatingActionButton.extended( label: Text("Hinzufügen"), onPressed: () { @@ -93,6 +95,12 @@ class WoolScreen extends StatelessWidget { ), ); } + return AnimatedSwitcher( + duration: Duration(milliseconds: 500), + switchInCurve: Curves.easeOut, + switchOutCurve: Curves.ease, + child: child, + ); }, ); }