(Feat) Migration PocketBase

This commit is contained in:
2026-07-18 11:05:26 +02:00
parent 4d936d2ee3
commit 54091398a5
9 changed files with 473 additions and 41 deletions
+60 -1
View File
@@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import '../services/produit_repository.dart';
import 'etiquettes_screen.dart';
import 'produits_screen.dart';
import 'scan_screen.dart';
@@ -23,7 +24,19 @@ class _HomeShellState extends State<HomeShell> {
const EtiquettesScreen(),
];
return Scaffold(
body: IndexedStack(index: _index, children: pages),
body: Column(
children: [
ListenableBuilder(
listenable: ProduitRepository.instance,
builder: (context, _) {
final repo = ProduitRepository.instance;
if (repo.connecte) return const SizedBox.shrink();
return _BanniereHorsLigne(onReessayer: () => repo.charger());
},
),
Expanded(child: IndexedStack(index: _index, children: pages)),
],
),
bottomNavigationBar: NavigationBar(
selectedIndex: _index,
height: 68,
@@ -50,3 +63,49 @@ class _HomeShellState extends State<HomeShell> {
);
}
}
/// Fin bandeau affiché en haut quand la tablette n'est pas synchronisée au serveur.
class _BanniereHorsLigne extends StatelessWidget {
final VoidCallback onReessayer;
const _BanniereHorsLigne({required this.onReessayer});
static const _ambre = Color(0xFFB26B00);
@override
Widget build(BuildContext context) {
return Material(
color: const Color(0xFFFFF3E0),
child: SafeArea(
bottom: false,
child: InkWell(
onTap: onReessayer,
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 7),
child: Row(
children: [
const Icon(Icons.cloud_off_rounded, size: 16, color: _ambre),
const SizedBox(width: 8),
const Expanded(
child: Text(
'Hors ligne — non synchronisé',
style: TextStyle(
color: _ambre,
fontSize: 12.5,
fontWeight: FontWeight.w600),
),
),
const Text('Réessayer',
style: TextStyle(
color: _ambre,
fontSize: 12.5,
fontWeight: FontWeight.w700)),
const SizedBox(width: 4),
const Icon(Icons.refresh, size: 15, color: _ambre),
],
),
),
),
),
);
}
}