Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 15 additions & 8 deletions lib/src/widgets.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
),
);
Expand Down Expand Up @@ -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) =>
Expand Down