refactor: Extracts Quick Actions component

Refactors the "Quick Actions" section on the reception page into a new `QuickActionComponent`.

This improves modularity and reusability of the quick action UI pattern. Also adjusts vertical padding on the main page content for a cleaner layout.
This commit is contained in:
mandreshope 2025-07-24 09:35:56 +03:00
parent 27863f800e
commit 48556dbeed
3 changed files with 85 additions and 75 deletions

View File

@ -3,3 +3,4 @@ export 'loading_progress_component.dart';
export 'primary_button_component.dart';
export 'product_scanned_component.dart';
export 'outline_button_component.dart';
export 'quick_action_component.dart';

View File

@ -0,0 +1,82 @@
import 'package:barcode_scanner/components/components.dart';
import 'package:barcode_scanner/themes/app_theme.dart';
import 'package:flutter/material.dart';
class QuickActionComponent extends StatelessWidget {
const QuickActionComponent({super.key});
@override
Widget build(BuildContext context) {
return Card(
elevation: 0,
color: AppTheme.of(context).secondaryBackground,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10),
side: BorderSide(color: AppTheme.of(context).alternate),
),
child: Padding(
padding: const EdgeInsets.all(16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Text(
'Actions Rapides',
style: AppTheme.of(
context,
).bodyMedium.copyWith(fontWeight: FontWeight.bold),
),
const Spacer(),
Container(
padding: const EdgeInsets.symmetric(
horizontal: 10,
vertical: 4,
),
decoration: BoxDecoration(
color: AppTheme.of(context).alternate,
borderRadius: BorderRadius.circular(20),
),
child: Text(
'3 en attente',
style: AppTheme.of(context).bodySmall,
),
),
],
),
const SizedBox(height: 16),
SizedBox(
width: double.maxFinite,
child: PrimaryButtonComponent(
centered: true,
leading: Icon(Icons.add, color: AppTheme.of(context).white),
text: 'Nouvelle Réception',
onPressed: () {},
),
),
const SizedBox(height: 12),
SizedBox(
width: double.maxFinite,
child: OutlineButtonComponent(
centered: true,
leading: const Icon(Icons.qr_code_scanner),
text: 'Scanner Code-Barres',
onPressed: () {},
),
),
const SizedBox(height: 12),
SizedBox(
width: double.maxFinite,
child: OutlineButtonComponent(
centered: true,
leading: const Icon(Icons.search),
text: 'Rechercher Existant',
onPressed: () {},
),
),
],
),
),
);
}
}

View File

@ -63,84 +63,11 @@ class _ReceptionPageState extends ConsumerState<ReceptionPage> {
elevation: 4,
),
body: Padding(
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
padding: const EdgeInsets.symmetric(horizontal: 16),
child: ListView(
children: [
const SizedBox(height: 16),
Card(
elevation: 0,
color: AppTheme.of(context).secondaryBackground,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10),
side: BorderSide(color: AppTheme.of(context).alternate),
),
child: Padding(
padding: const EdgeInsets.all(16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Text(
'Actions Rapides',
style: AppTheme.of(
context,
).bodyMedium.copyWith(fontWeight: FontWeight.bold),
),
const Spacer(),
Container(
padding: const EdgeInsets.symmetric(
horizontal: 10,
vertical: 4,
),
decoration: BoxDecoration(
color: AppTheme.of(context).alternate,
borderRadius: BorderRadius.circular(20),
),
child: Text(
'3 en attente',
style: AppTheme.of(context).bodySmall,
),
),
],
),
const SizedBox(height: 16),
SizedBox(
width: double.maxFinite,
child: PrimaryButtonComponent(
centered: true,
leading: Icon(
Icons.add,
color: AppTheme.of(context).white,
),
text: 'Nouvelle Réception',
onPressed: () {},
),
),
const SizedBox(height: 12),
SizedBox(
width: double.maxFinite,
child: OutlineButtonComponent(
centered: true,
leading: const Icon(Icons.qr_code_scanner),
text: 'Scanner Code-Barres',
onPressed: () {},
),
),
const SizedBox(height: 12),
SizedBox(
width: double.maxFinite,
child: OutlineButtonComponent(
centered: true,
leading: const Icon(Icons.search),
text: 'Rechercher Existant',
onPressed: () {},
),
),
],
),
),
),
QuickActionComponent(),
const SizedBox(height: 16),
Card(
color: AppTheme.of(context).secondaryBackground,