bugfix: resolve runtime issues - encoding accents, ListView dynamic heights, notifyListeners exceptions during build phase, and layout overflows
This commit is contained in:
@@ -80,7 +80,7 @@ class EquipmentProvider extends ChangeNotifier {
|
|||||||
Future<void> loadEquipments() async {
|
Future<void> loadEquipments() async {
|
||||||
print('[EquipmentProvider] Starting to load ALL equipments...');
|
print('[EquipmentProvider] Starting to load ALL equipments...');
|
||||||
_isLoading = true;
|
_isLoading = true;
|
||||||
notifyListeners();
|
scheduleMicrotask(notifyListeners);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
_equipment.clear();
|
_equipment.clear();
|
||||||
@@ -272,7 +272,7 @@ class EquipmentProvider extends ChangeNotifier {
|
|||||||
_lastVisible = null;
|
_lastVisible = null;
|
||||||
_hasMore = true;
|
_hasMore = true;
|
||||||
_isLoading = true;
|
_isLoading = true;
|
||||||
notifyListeners();
|
scheduleMicrotask(notifyListeners);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await loadNextPage();
|
await loadNextPage();
|
||||||
@@ -296,7 +296,7 @@ class EquipmentProvider extends ChangeNotifier {
|
|||||||
|
|
||||||
_isLoadingMore = true;
|
_isLoadingMore = true;
|
||||||
_isLoading = true;
|
_isLoading = true;
|
||||||
notifyListeners();
|
scheduleMicrotask(notifyListeners);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
final result = await _dataService.getEquipmentsPaginated(
|
final result = await _dataService.getEquipmentsPaginated(
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ class AppInitializer with ChangeNotifier {
|
|||||||
Future<void> initialize() async {
|
Future<void> initialize() async {
|
||||||
if (_isInitialized || _isInitializing) return;
|
if (_isInitialized || _isInitializing) return;
|
||||||
_isInitializing = true;
|
_isInitializing = true;
|
||||||
notifyListeners();
|
scheduleMicrotask(() => notifyListeners());
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Initialiser Firebase
|
// Initialiser Firebase
|
||||||
|
|||||||
@@ -980,6 +980,10 @@ class _CalendarPageState extends State<CalendarPage> {
|
|||||||
? eventsForSelectedDay[_selectedEventIndex]
|
? eventsForSelectedDay[_selectedEventIndex]
|
||||||
: null;
|
: null;
|
||||||
|
|
||||||
|
return LayoutBuilder(
|
||||||
|
builder: (context, constraints) {
|
||||||
|
final maxHeight = constraints.maxHeight;
|
||||||
|
|
||||||
// GESTURE DETECTOR pour swipe vertical (plier/déplier) et horizontal (mois)
|
// GESTURE DETECTOR pour swipe vertical (plier/déplier) et horizontal (mois)
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
onVerticalDragEnd: (details) {
|
onVerticalDragEnd: (details) {
|
||||||
@@ -1028,12 +1032,12 @@ class _CalendarPageState extends State<CalendarPage> {
|
|||||||
AnimatedPositioned(
|
AnimatedPositioned(
|
||||||
duration: const Duration(milliseconds: 400),
|
duration: const Duration(milliseconds: 400),
|
||||||
curve: Curves.easeInOut,
|
curve: Curves.easeInOut,
|
||||||
top: _calendarCollapsed ? -600 : 0, // cache le calendrier en haut
|
top: _calendarCollapsed ? -maxHeight : 0, // cache le calendrier en haut
|
||||||
left: 0,
|
left: 0,
|
||||||
right: 0,
|
right: 0,
|
||||||
height: _calendarCollapsed ? 0 : null,
|
height: _calendarCollapsed ? 0 : null,
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
height: MediaQuery.of(context).size.height,
|
height: maxHeight,
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
_buildMonthHeader(context),
|
_buildMonthHeader(context),
|
||||||
@@ -1144,12 +1148,12 @@ class _CalendarPageState extends State<CalendarPage> {
|
|||||||
AnimatedPositioned(
|
AnimatedPositioned(
|
||||||
duration: const Duration(milliseconds: 400),
|
duration: const Duration(milliseconds: 400),
|
||||||
curve: Curves.easeInOut,
|
curve: Curves.easeInOut,
|
||||||
top: _calendarCollapsed ? 0 : 600,
|
top: _calendarCollapsed ? 0 : maxHeight,
|
||||||
left: 0,
|
left: 0,
|
||||||
right: 0,
|
right: 0,
|
||||||
bottom: 0,
|
bottom: 0,
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
height: MediaQuery.of(context).size.height,
|
height: maxHeight,
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
_buildMonthHeader(context),
|
_buildMonthHeader(context),
|
||||||
@@ -1212,6 +1216,8 @@ class _CalendarPageState extends State<CalendarPage> {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildMonthHeader(BuildContext context) {
|
Widget _buildMonthHeader(BuildContext context) {
|
||||||
|
|||||||
@@ -57,6 +57,12 @@ class _EquipmentFormPageState extends State<EquipmentFormPage> {
|
|||||||
final provider = Provider.of<EquipmentProvider>(context, listen: false);
|
final provider = Provider.of<EquipmentProvider>(context, listen: false);
|
||||||
provider.loadBrands();
|
provider.loadBrands();
|
||||||
provider.loadModels();
|
provider.loadModels();
|
||||||
|
if (widget.equipment != null) {
|
||||||
|
if (_selectedBrand != null && _selectedBrand!.isNotEmpty) {
|
||||||
|
_loadFilteredModels(_selectedBrand!);
|
||||||
|
}
|
||||||
|
_loadFilteredSubCategories(_selectedCategory);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
if (widget.equipment != null) {
|
if (widget.equipment != null) {
|
||||||
_populateFields();
|
_populateFields();
|
||||||
@@ -84,14 +90,6 @@ class _EquipmentFormPageState extends State<EquipmentFormPage> {
|
|||||||
});
|
});
|
||||||
|
|
||||||
DebugLog.info('[EquipmentForm] Populating fields for equipment: ${equipment.id}');
|
DebugLog.info('[EquipmentForm] Populating fields for equipment: ${equipment.id}');
|
||||||
|
|
||||||
|
|
||||||
if (_selectedBrand != null && _selectedBrand!.isNotEmpty) {
|
|
||||||
_loadFilteredModels(_selectedBrand!);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Charger les sous-catégories pour la catégorie sélectionnée
|
|
||||||
_loadFilteredSubCategories(_selectedCategory);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -500,12 +500,7 @@ class _EquipmentManagementPageState extends State<EquipmentManagementPage>
|
|||||||
return ListView.builder(
|
return ListView.builder(
|
||||||
controller: _scrollController,
|
controller: _scrollController,
|
||||||
itemCount: itemCount,
|
itemCount: itemCount,
|
||||||
// ✅ prototypeItem utilisé car les cartes ont des hauteurs variables :
|
// ✅ Augmenter le cache pour un scroll plus fluide (prototypeItem retiré car les hauteurs dynamiques varient selon le type d'équipement)
|
||||||
// - Les équipements standards (ListTile + margin) font ~88px
|
|
||||||
// - Les consommables/câbles affichent _buildQuantityDisplay en plus (~30px)
|
|
||||||
// - prototypeItem permet à Flutter d'optimiser le scroll sans couper les items
|
|
||||||
prototypeItem: const SizedBox(height: 88),
|
|
||||||
// ✅ Augmenter le cache pour un scroll plus fluide
|
|
||||||
cacheExtent: 500, // Précharger 500px en plus
|
cacheExtent: 500, // Précharger 500px en plus
|
||||||
itemBuilder: (context, index) {
|
itemBuilder: (context, index) {
|
||||||
// Dernier élément = indicateur de chargement
|
// Dernier élément = indicateur de chargement
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user