barcode_scanner/lib/components/stock_picking_card_component.dart
mandreshope 8252cf0b22 feat: Adds stock picking detail view and API call
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.
2025-07-29 14:43:43 +03:00

84 lines
2.4 KiB
Dart
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import 'package:barcode_scanner/themes/app_theme.dart';
import 'package:flutter/material.dart';
class StockPickingCard extends StatelessWidget {
const StockPickingCard({
super.key,
required this.reference,
required this.from,
required this.to,
required this.contact,
required this.origin,
required this.status,
this.margin,
});
final String? reference;
final String? from;
final String? to;
final String? contact;
final String? origin;
final String? status;
final EdgeInsetsGeometry? margin;
@override
Widget build(BuildContext context) {
return Card(
elevation: 3,
color: AppTheme.of(context).primaryBackground,
margin: margin ?? const EdgeInsets.symmetric(horizontal: 12, vertical: 8),
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
const Icon(Icons.receipt_long, color: Colors.blue),
const SizedBox(width: 8),
Expanded(
child: Text(
reference ?? 'Référence inconnue',
style: const TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold,
),
),
),
],
),
const SizedBox(height: 12),
_infoRow(Icons.call_made, "De", from),
_infoRow(Icons.call_received, "Vers", to),
_infoRow(Icons.person, "Contact", contact),
_infoRow(Icons.insert_drive_file, "Document dorigine", origin),
_infoRow(Icons.check_circle, "Statut", status),
],
),
),
);
}
Widget _infoRow(IconData icon, String label, String? value) {
return Padding(
padding: const EdgeInsets.symmetric(vertical: 4.0),
child: Row(
children: [
Icon(icon, size: 20, color: Colors.grey[700]),
const SizedBox(width: 8),
Text(
"$label : ",
style: const TextStyle(fontWeight: FontWeight.w600),
),
Expanded(
child: Text(
value ?? "-",
style: const TextStyle(color: Colors.black87),
),
),
],
),
);
}
}