sliver state handler padding support
This commit is contained in:
parent
325f82e52b
commit
32ee689fe5
|
|
@ -11,15 +11,17 @@ class SliverStateHandler<T extends CoreProvier> extends SliverList {
|
|||
final bool enableEmptyState;
|
||||
final Widget? emptyState;
|
||||
final Widget? placeholder;
|
||||
final EdgeInsets? itemPadding;
|
||||
SliverStateHandler({
|
||||
Key? key,
|
||||
required this.state,
|
||||
required this.builder,
|
||||
required this.childCount,
|
||||
this.itemPadding,
|
||||
this.placeholder,
|
||||
this.emptyState,
|
||||
this.enableEmptyState = false,
|
||||
this.onRefresh,
|
||||
required this.state,
|
||||
}) : super(
|
||||
key: key,
|
||||
delegate: SliverChildBuilderDelegate(
|
||||
|
|
@ -31,9 +33,15 @@ class SliverStateHandler<T extends CoreProvier> extends SliverList {
|
|||
return emptyState;
|
||||
}
|
||||
if (state.appState == AppState.busy) {
|
||||
return placeholder;
|
||||
return Padding(
|
||||
padding: itemPadding ?? const EdgeInsets.all(0),
|
||||
child: placeholder,
|
||||
);
|
||||
}
|
||||
return builder(context, state, index);
|
||||
return Padding(
|
||||
padding: itemPadding ?? const EdgeInsets.all(0),
|
||||
child: builder(context, state, index),
|
||||
);
|
||||
},
|
||||
childCount: state.appState == AppState.idle
|
||||
? childCount
|
||||
|
|
|
|||
Loading…
Reference in New Issue