refactor: Refines reception validation and quick actions

Allows reception validation regardless of its synchronization status, enabling more flexible use cases.

Simplifies the quick actions available on the reception list page by removing the 'Add' and 'Scan' buttons, retaining only the 'Search' option.

Adds vertical spacing before the search button within the QuickActionComponent for improved visual layout.
This commit is contained in:
mandreshope 2025-07-31 14:25:03 +03:00
parent a9d0e4485d
commit ba1d7a6264
3 changed files with 21 additions and 28 deletions

View File

@ -114,7 +114,8 @@ class QuickActionComponent extends StatelessWidget {
),
const SizedBox(height: 12),
],
if (onTapSearch != null)
if (onTapSearch != null) ...[
const SizedBox(height: 12),
SizedBox(
width: double.maxFinite,
child: OutlineButtonComponent(
@ -125,6 +126,7 @@ class QuickActionComponent extends StatelessWidget {
),
),
],
],
),
),
);

View File

@ -55,13 +55,9 @@ class _ReceptionDetailsPageState extends ConsumerState<ReceptionDetailsPage> {
const SizedBox(height: 16),
if (reception?.isDone == false) ...[
QuickActionComponent(
onTapValidateReception: reception?.synchronized == false
? () {
onTapValidateReception: () {
ref
.read(
receptionDetailsPageModelProvider
.notifier,
)
.read(receptionDetailsPageModelProvider.notifier)
.validate(
receptionId: widget.receptionId,
onSuccess: () {
@ -75,8 +71,7 @@ class _ReceptionDetailsPageState extends ConsumerState<ReceptionDetailsPage> {
);
},
);
}
: null,
},
validateReceptionLoading: state.validateLoading,
syncReceptionLoading: state.saveLoading,
onTapSyncReception: reception?.synchronized == false

View File

@ -48,11 +48,7 @@ class _ReceptionPageState extends ConsumerState<ReceptionPage> {
child: ListView(
children: [
const SizedBox(height: 16),
QuickActionComponent(
onTapAdd: () {},
onTapScan: () {},
onTapSearch: () {},
),
QuickActionComponent(onTapSearch: () {}),
const SizedBox(height: 16),
Consumer(
builder: (_, WidgetRef ref, _) {