feat: Refactor review order action bar for improved button layout and async handling in permanent order BLoC

This commit is contained in:
Achintha Isuru
2026-03-10 10:21:18 -04:00
parent c5d6bcbe04
commit a3aab678fd
2 changed files with 14 additions and 11 deletions

View File

@@ -170,10 +170,10 @@ class PermanentOrderBloc extends Bloc<PermanentOrderEvent, PermanentOrderState>
await _loadRolesForVendor(event.vendor.id, emit); await _loadRolesForVendor(event.vendor.id, emit);
} }
void _onHubsLoaded( Future<void> _onHubsLoaded(
PermanentOrderHubsLoaded event, PermanentOrderHubsLoaded event,
Emitter<PermanentOrderState> emit, Emitter<PermanentOrderState> emit,
) { ) async {
final PermanentOrderHubOption? selectedHub = event.hubs.isNotEmpty final PermanentOrderHubOption? selectedHub = event.hubs.isNotEmpty
? event.hubs.first ? event.hubs.first
: null; : null;
@@ -186,16 +186,16 @@ class PermanentOrderBloc extends Bloc<PermanentOrderEvent, PermanentOrderState>
); );
if (selectedHub != null) { if (selectedHub != null) {
_loadManagersForHub(selectedHub.id, emit); await _loadManagersForHub(selectedHub.id, emit);
} }
} }
void _onHubChanged( Future<void> _onHubChanged(
PermanentOrderHubChanged event, PermanentOrderHubChanged event,
Emitter<PermanentOrderState> emit, Emitter<PermanentOrderState> emit,
) { ) async {
emit(state.copyWith(selectedHub: event.hub, location: event.hub.name)); emit(state.copyWith(selectedHub: event.hub, location: event.hub.name));
_loadManagersForHub(event.hub.id, emit); await _loadManagersForHub(event.hub.id, emit);
} }
void _onHubManagerChanged( void _onHubManagerChanged(

View File

@@ -37,14 +37,17 @@ class ReviewOrderActionBar extends StatelessWidget {
leadingIcon: UiIcons.chevronLeft, leadingIcon: UiIcons.chevronLeft,
onPressed: onBack, onPressed: onBack,
size: UiButtonSize.large, size: UiButtonSize.large,
text: '',
), ),
const SizedBox(width: UiConstants.space3), const SizedBox(width: UiConstants.space3),
UiButton.primary( Expanded(
child: UiButton.primary(
text: submitLabel ?? t.client_create_order.review.post_order, text: submitLabel ?? t.client_create_order.review.post_order,
onPressed: onSubmit, onPressed: onSubmit,
isLoading: isLoading, isLoading: isLoading,
size: UiButtonSize.large, size: UiButtonSize.large,
), ),
),
], ],
), ),
), ),