Add shimmer loading
This commit is contained in:
parent
f8612b9bc3
commit
56bcef493a
3 changed files with 40 additions and 2 deletions
|
|
@ -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});
|
||||
|
|
@ -16,8 +18,34 @@ class WoolScreen extends StatelessWidget {
|
|||
.get(),
|
||||
builder: (BuildContext context, AsyncSnapshot snapshot) {
|
||||
if (snapshot.connectionState == ConnectionState.waiting) {
|
||||
return const Center(
|
||||
child: CircularProgressIndicator(),
|
||||
return 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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -33,6 +33,8 @@ dependencies:
|
|||
|
||||
blobs:
|
||||
|
||||
shimmer:
|
||||
|
||||
flutter_colorpicker:
|
||||
|
||||
hexcolor:
|
||||
|
|
|
|||
Reference in a new issue