crappy load animation

This commit is contained in:
Leandro 2024-05-20 16:42:03 +02:00
parent 56bcef493a
commit c9d62743f6

View file

@ -12,13 +12,15 @@ class WoolScreen extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
Widget child;
return FutureBuilder( return FutureBuilder(
future: Provider.of<AppDatabase>(context) future: Provider.of<AppDatabase>(context)
.select(Provider.of<AppDatabase>(context).wolle) .select(Provider.of<AppDatabase>(context).wolle)
.get(), .get(),
builder: (BuildContext context, AsyncSnapshot snapshot) { builder: (BuildContext context, AsyncSnapshot snapshot) {
if (snapshot.connectionState == ConnectionState.waiting) { if (snapshot.connectionState == ConnectionState.waiting) {
return Center( child = Center(
child: Shimmer.fromColors( child: Shimmer.fromColors(
baseColor: Theme.of(context).colorScheme.secondaryContainer, baseColor: Theme.of(context).colorScheme.secondaryContainer,
highlightColor: Theme.of(context) highlightColor: Theme.of(context)
@ -49,7 +51,7 @@ class WoolScreen extends StatelessWidget {
); );
} else { } else {
// Hier können Sie den Inhalt basierend auf den geladenen Daten anzeigen // Hier können Sie den Inhalt basierend auf den geladenen Daten anzeigen
return Scaffold( child = Scaffold(
floatingActionButton: FloatingActionButton.extended( floatingActionButton: FloatingActionButton.extended(
label: Text("Hinzufügen"), label: Text("Hinzufügen"),
onPressed: () { onPressed: () {
@ -93,6 +95,12 @@ class WoolScreen extends StatelessWidget {
), ),
); );
} }
return AnimatedSwitcher(
duration: Duration(milliseconds: 500),
switchInCurve: Curves.easeOut,
switchOutCurve: Curves.ease,
child: child,
);
}, },
); );
} }