diff --git a/lib/screens/wool.dart b/lib/screens/wool.dart index 53195a5..fcdb26c 100644 --- a/lib/screens/wool.dart +++ b/lib/screens/wool.dart @@ -1,8 +1,10 @@ import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; +import 'package:shimmer/shimmer.dart'; import 'package:temperaturdecke/database.dart'; import 'package:temperaturdecke/screens/add_wool_modal.dart'; import 'package:temperaturdecke/widgets/cards/wool_card.dart'; +import 'package:temperaturdecke/widgets/custom_card.dart'; class WoolScreen extends StatelessWidget { WoolScreen({super.key}); @@ -10,19 +12,48 @@ 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 const Center( - child: CircularProgressIndicator(), + child = Center( + child: Shimmer.fromColors( + baseColor: Theme.of(context).colorScheme.secondaryContainer, + highlightColor: Theme.of(context) + .colorScheme + .onSecondaryContainer + .withOpacity(.3), + child: ListView.builder( + itemBuilder: (BuildContext context, int index) { + return Padding( + padding: const EdgeInsets.symmetric(horizontal: 10), + child: Column( + children: [ + CustomCard( + SizedBox( + height: 70, + ), + ), + const SizedBox( + height: 15, + ) + ], + ), + ); + }, + itemCount: 6, + ), + ), ); } else { // Hier können Sie den Inhalt basierend auf den geladenen Daten anzeigen - return Scaffold( - floatingActionButton: FloatingActionButton( + child = Scaffold( + floatingActionButton: FloatingActionButton.extended( + label: Text("Hinzufügen"), onPressed: () { showModalBottomSheet( isScrollControlled: true, @@ -33,7 +64,7 @@ class WoolScreen extends StatelessWidget { }, ); }, - child: Icon(Icons.add), + icon: Icon(Icons.add), ), body: Column( children: [ @@ -64,6 +95,12 @@ class WoolScreen extends StatelessWidget { ), ); } + return AnimatedSwitcher( + duration: Duration(milliseconds: 500), + switchInCurve: Curves.easeOut, + switchOutCurve: Curves.ease, + child: child, + ); }, ); } diff --git a/lib/widgets/modal_wrapper.dart b/lib/widgets/modal_wrapper.dart index 6cbcc56..170ff7a 100644 --- a/lib/widgets/modal_wrapper.dart +++ b/lib/widgets/modal_wrapper.dart @@ -14,7 +14,7 @@ class ModalWrapper extends StatelessWidget { child: Wrap( children: [ SizedBox( - width: 500, + width: 750, height: MediaQuery.of(context).size.height - 100, child: Padding( padding: EdgeInsets.symmetric(horizontal: 25, vertical: 10), diff --git a/pubspec.lock b/pubspec.lock index 26d6386..7737e2d 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -584,6 +584,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.0.4" + shimmer: + dependency: "direct main" + description: + name: shimmer + sha256: "5f88c883a22e9f9f299e5ba0e4f7e6054857224976a5d9f839d4ebdc94a14ac9" + url: "https://pub.dev" + source: hosted + version: "3.0.0" sky_engine: dependency: transitive description: flutter diff --git a/pubspec.yaml b/pubspec.yaml index cc4d040..0f920b0 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -33,6 +33,8 @@ dependencies: blobs: + shimmer: + flutter_colorpicker: hexcolor: