From 1a7a4a188af9dd2749927ef5daf722e266fe2380 Mon Sep 17 00:00:00 2001 From: Muhamad Bagus Prasetyo Date: Wed, 9 Jul 2025 10:38:15 +0700 Subject: [PATCH 1/2] Update SkeletonListView - Fix spacing not used - Add shrinkWrap - Add separatorBuilder --- lib/src/widgets.dart | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/lib/src/widgets.dart b/lib/src/widgets.dart index a3f58fe..47c4787 100644 --- a/lib/src/widgets.dart +++ b/lib/src/widgets.dart @@ -218,27 +218,34 @@ class SkeletonListTile extends StatelessWidget { class SkeletonListView extends StatelessWidget { final Widget? item; final Widget Function(BuildContext, int)? itemBuilder; - final int? itemCount; + final int itemCount; final bool scrollable; final EdgeInsets? padding; - final double? spacing; + final double spacing; + final bool shrinkWrap; + final Widget Function(BuildContext, int)? separatorBuilder; SkeletonListView({ Key? key, this.item, this.itemBuilder, - this.itemCount, + this.itemCount = 3, this.scrollable = false, - this.padding = const EdgeInsets.symmetric(horizontal: 16), - this.spacing = 8, + this.padding = const EdgeInsets.symmetric(horizontal: 16.0), + this.spacing = 8.0, + this.shrinkWrap = true, + this.separatorBuilder, }) : super(key: key); @override Widget build(BuildContext context) { return SkeletonItem( - child: ListView.builder( + child: ListView.separated( + separatorBuilder: + separatorBuilder ?? (context, index) => SizedBox(height: spacing), padding: padding, physics: scrollable ? null : NeverScrollableScrollPhysics(), + shrinkWrap: shrinkWrap, itemCount: itemCount, itemBuilder: itemBuilder ?? (context, index) => From f4493fe2e604373161d2d98fa8e6829908212043 Mon Sep 17 00:00:00 2001 From: Muhamad Bagus Prasetyo Date: Wed, 16 Jul 2025 11:23:42 +0700 Subject: [PATCH 2/2] Change backgroundColor to scaffoldBackgroundColor --- lib/src/widgets.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/src/widgets.dart b/lib/src/widgets.dart index 47c4787..bf27e8f 100644 --- a/lib/src/widgets.dart +++ b/lib/src/widgets.dart @@ -53,7 +53,7 @@ class SkeletonAvatar extends StatelessWidget { style.maxHeight ?? constraints.maxHeight) : style.height, decoration: BoxDecoration( - color: Theme.of(context).backgroundColor, + color: Theme.of(context).scaffoldBackgroundColor, shape: style.shape, borderRadius: style.shape != BoxShape.circle ? style.borderRadius : null, @@ -97,7 +97,7 @@ class SkeletonLine extends StatelessWidget { : style.width, height: style.height, decoration: BoxDecoration( - color: Theme.of(context).backgroundColor, + color: Theme.of(context).scaffoldBackgroundColor, borderRadius: style.borderRadius, ), );