feat: Refactor review order action bar for improved button layout and async handling in permanent order BLoC
This commit is contained in:
@@ -170,10 +170,10 @@ class PermanentOrderBloc extends Bloc<PermanentOrderEvent, PermanentOrderState>
|
||||
await _loadRolesForVendor(event.vendor.id, emit);
|
||||
}
|
||||
|
||||
void _onHubsLoaded(
|
||||
Future<void> _onHubsLoaded(
|
||||
PermanentOrderHubsLoaded event,
|
||||
Emitter<PermanentOrderState> emit,
|
||||
) {
|
||||
) async {
|
||||
final PermanentOrderHubOption? selectedHub = event.hubs.isNotEmpty
|
||||
? event.hubs.first
|
||||
: null;
|
||||
@@ -186,16 +186,16 @@ class PermanentOrderBloc extends Bloc<PermanentOrderEvent, PermanentOrderState>
|
||||
);
|
||||
|
||||
if (selectedHub != null) {
|
||||
_loadManagersForHub(selectedHub.id, emit);
|
||||
await _loadManagersForHub(selectedHub.id, emit);
|
||||
}
|
||||
}
|
||||
|
||||
void _onHubChanged(
|
||||
Future<void> _onHubChanged(
|
||||
PermanentOrderHubChanged event,
|
||||
Emitter<PermanentOrderState> emit,
|
||||
) {
|
||||
) async {
|
||||
emit(state.copyWith(selectedHub: event.hub, location: event.hub.name));
|
||||
_loadManagersForHub(event.hub.id, emit);
|
||||
await _loadManagersForHub(event.hub.id, emit);
|
||||
}
|
||||
|
||||
void _onHubManagerChanged(
|
||||
|
||||
@@ -37,13 +37,16 @@ class ReviewOrderActionBar extends StatelessWidget {
|
||||
leadingIcon: UiIcons.chevronLeft,
|
||||
onPressed: onBack,
|
||||
size: UiButtonSize.large,
|
||||
text: '',
|
||||
),
|
||||
const SizedBox(width: UiConstants.space3),
|
||||
UiButton.primary(
|
||||
text: submitLabel ?? t.client_create_order.review.post_order,
|
||||
onPressed: onSubmit,
|
||||
isLoading: isLoading,
|
||||
size: UiButtonSize.large,
|
||||
Expanded(
|
||||
child: UiButton.primary(
|
||||
text: submitLabel ?? t.client_create_order.review.post_order,
|
||||
onPressed: onSubmit,
|
||||
isLoading: isLoading,
|
||||
size: UiButtonSize.large,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user