Browse Source

Change DA to MGA

master
Stephane 6 months ago
parent
commit
da03076411
  1. 21
      lib/Views/newCommand.dart

21
lib/Views/newCommand.dart

@ -45,7 +45,7 @@ class _NouvelleCommandePageState extends State<NouvelleCommandePage> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
appBar: const CustomAppBar(title: 'Nouvelle Commande'), appBar: const CustomAppBar(title: 'Nouvelle Commande'),
drawer: CustomDrawer(), drawer: CustomDrawer(),
body: Column( body: Column(
children: [ children: [
// Header avec logo et titre // Header avec logo et titre
@ -221,7 +221,8 @@ class _NouvelleCommandePageState extends State<NouvelleCommandePage> {
if (value == null || value.isEmpty) { if (value == null || value.isEmpty) {
return 'Veuillez entrer un email'; return 'Veuillez entrer un email';
} }
if (!RegExp(r'^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$').hasMatch(value)) { if (!RegExp(r'^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$')
.hasMatch(value)) {
return 'Veuillez entrer un email valide'; return 'Veuillez entrer un email valide';
} }
return null; return null;
@ -328,7 +329,7 @@ class _NouvelleCommandePageState extends State<NouvelleCommandePage> {
children: [ children: [
const SizedBox(height: 4), const SizedBox(height: 4),
Text( Text(
'${product.price.toStringAsFixed(2)} DA', '${product.price.toStringAsFixed(2)} MGA',
style: TextStyle( style: TextStyle(
color: Colors.green.shade700, color: Colors.green.shade700,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
@ -364,12 +365,14 @@ class _NouvelleCommandePageState extends State<NouvelleCommandePage> {
), ),
Text( Text(
quantity.toString(), quantity.toString(),
style: const TextStyle(fontWeight: FontWeight.bold), style: const TextStyle(
fontWeight: FontWeight.bold),
), ),
IconButton( IconButton(
icon: const Icon(Icons.add, size: 18), icon: const Icon(Icons.add, size: 18),
onPressed: () { onPressed: () {
if (product.stock == null || quantity < product.stock!) { if (product.stock == null ||
quantity < product.stock!) {
setState(() { setState(() {
_quantites[product.id!] = quantity + 1; _quantites[product.id!] = quantity + 1;
}); });
@ -454,9 +457,10 @@ class _NouvelleCommandePageState extends State<NouvelleCommandePage> {
child: const Icon(Icons.shopping_bag, size: 20), child: const Icon(Icons.shopping_bag, size: 20),
), ),
title: Text(product.name), title: Text(product.name),
subtitle: Text('${entry.value} x ${product.price.toStringAsFixed(2)} DA'), subtitle: Text(
'${entry.value} x ${product.price.toStringAsFixed(2)} MGA'),
trailing: Text( trailing: Text(
'${(entry.value * product.price).toStringAsFixed(2)} DA', '${(entry.value * product.price).toStringAsFixed(2)} MGA',
style: TextStyle( style: TextStyle(
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
color: Colors.blue.shade800, color: Colors.blue.shade800,
@ -499,7 +503,7 @@ class _NouvelleCommandePageState extends State<NouvelleCommandePage> {
style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold), style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
), ),
Text( Text(
'${total.toStringAsFixed(2)} DA', '${total.toStringAsFixed(2)} MGA',
style: const TextStyle( style: const TextStyle(
fontSize: 18, fontSize: 18,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
@ -599,7 +603,6 @@ class _NouvelleCommandePageState extends State<NouvelleCommandePage> {
setState(() { setState(() {
_quantites.clear(); _quantites.clear();
}); });
} catch (e) { } catch (e) {
Get.snackbar( Get.snackbar(
'Erreur', 'Erreur',

Loading…
Cancel
Save