Skip to content

Commit c146822

Browse files
committed
Change: ViewStateBuilder shrink SizedBoxes.
1 parent 079c629 commit c146822

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

lib/src/view/view_state_builder.dart

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,18 +66,20 @@ class ViewStateBuilder<T, C extends Cubit<ViewState>>
6666
buildWhen: buildWhen,
6767
builder: (BuildContext context, ViewState state) {
6868
if (state is Initial) {
69-
return onReady?.call(context) ?? const SizedBox();
69+
return onReady?.call(context) ?? const SizedBox.shrink();
7070
} else if (state is Loading) {
71-
return onLoading?.call(context) ?? const SizedBox();
71+
return onLoading?.call(context) ?? const SizedBox.shrink();
7272
} else if (state is Refreshing<T>) {
7373
return onRefreshing?.call(context, state.data) ??
74-
const SizedBox();
74+
const SizedBox.shrink();
7575
} else if (state is Success<T>) {
76-
return onSuccess?.call(context, state.data) ?? const SizedBox();
76+
return onSuccess?.call(context, state.data) ??
77+
const SizedBox.shrink();
7778
} else if (state is Empty) {
78-
return onEmpty?.call(context) ?? const SizedBox();
79+
return onEmpty?.call(context) ?? const SizedBox.shrink();
7980
} else if (state is Failure) {
80-
return onError?.call(context, state.error) ?? const SizedBox();
81+
return onError?.call(context, state.error) ??
82+
const SizedBox.shrink();
8183
} else {
8284
throw ArgumentError.value(state, 'state');
8385
}

0 commit comments

Comments
 (0)