
Implements a dedicated page for viewing detailed stock picking information. - Introduces `getStockPikingById` API call to fetch a single stock picking record by ID. - Enhances `MainAppbarComponent` to support customizable leading widgets, enabling a back button on detail pages. - Improves `QuickActionComponent` by allowing optional `onTap` callbacks for actions, making buttons conditionally visible and reusable across different contexts. - Adds `margin` property to `StockPickingCard` for flexible layout adjustments. - Refactors `ReceptionDetailsPage` to utilize the new API call and display a single stock picking's details, adapting its app bar and quick actions accordingly.
96 lines
3.0 KiB
Dart
96 lines
3.0 KiB
Dart
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,
|
|
this.onTapAdd,
|
|
this.onTapScan,
|
|
this.onTapSearch,
|
|
});
|
|
final VoidCallback? onTapAdd;
|
|
final VoidCallback? onTapScan;
|
|
final VoidCallback? onTapSearch;
|
|
|
|
@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,
|
|
// ),
|
|
// ),
|
|
],
|
|
),
|
|
if (onTapAdd != null) ...[
|
|
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: onTapAdd,
|
|
),
|
|
),
|
|
],
|
|
if (onTapScan != null) ...[
|
|
const SizedBox(height: 12),
|
|
SizedBox(
|
|
width: double.maxFinite,
|
|
child: OutlineButtonComponent(
|
|
centered: true,
|
|
leading: const Icon(Icons.qr_code_scanner),
|
|
text: 'Scanner Code-Barres',
|
|
onPressed: onTapScan,
|
|
),
|
|
),
|
|
const SizedBox(height: 12),
|
|
],
|
|
if (onTapSearch != null)
|
|
SizedBox(
|
|
width: double.maxFinite,
|
|
child: OutlineButtonComponent(
|
|
centered: true,
|
|
leading: const Icon(Icons.search),
|
|
text: 'Rechercher Existant',
|
|
onPressed: onTapSearch,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|