Compare commits
2 Commits
b936d27445
...
d6a9b3fd66
| Author | SHA1 | Date | |
|---|---|---|---|
| d6a9b3fd66 | |||
| 134b9781c8 |
@ -20,6 +20,8 @@ class AdminAmChildrenCapacityGrid extends StatelessWidget {
|
|||||||
final int capacity;
|
final int capacity;
|
||||||
final void Function(ParentChildSummary child) onOpen;
|
final void Function(ParentChildSummary child) onOpen;
|
||||||
final void Function(ParentChildSummary child) onDetach;
|
final void Function(ParentChildSummary child) onDetach;
|
||||||
|
/// Clic sur une case libre → même flux que « Rattacher un enfant » (#149).
|
||||||
|
final VoidCallback? onAttachEmpty;
|
||||||
|
|
||||||
const AdminAmChildrenCapacityGrid({
|
const AdminAmChildrenCapacityGrid({
|
||||||
super.key,
|
super.key,
|
||||||
@ -27,6 +29,7 @@ class AdminAmChildrenCapacityGrid extends StatelessWidget {
|
|||||||
required this.capacity,
|
required this.capacity,
|
||||||
required this.onOpen,
|
required this.onOpen,
|
||||||
required this.onDetach,
|
required this.onDetach,
|
||||||
|
this.onAttachEmpty,
|
||||||
});
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -78,7 +81,7 @@ class AdminAmChildrenCapacityGrid extends StatelessWidget {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (index < maxSlots) {
|
if (index < maxSlots) {
|
||||||
return const _EmptySlot();
|
return _EmptySlot(onTap: onAttachEmpty);
|
||||||
}
|
}
|
||||||
return const _UnavailableSlot();
|
return const _UnavailableSlot();
|
||||||
}
|
}
|
||||||
@ -129,18 +132,52 @@ class _UnavailableSlot extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class _EmptySlot extends StatelessWidget {
|
class _EmptySlot extends StatefulWidget {
|
||||||
const _EmptySlot();
|
final VoidCallback? onTap;
|
||||||
|
|
||||||
|
const _EmptySlot({this.onTap});
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<_EmptySlot> createState() => _EmptySlotState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _EmptySlotState extends State<_EmptySlot> {
|
||||||
|
bool _hovered = false;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return _SlotShell(
|
final clickable = widget.onTap != null;
|
||||||
backgroundColor: Colors.grey.shade50,
|
return MouseRegion(
|
||||||
borderColor: Colors.grey.shade300,
|
onEnter: clickable ? (_) => setState(() => _hovered = true) : null,
|
||||||
|
onExit: clickable ? (_) => setState(() => _hovered = false) : null,
|
||||||
|
cursor: clickable ? SystemMouseCursors.click : MouseCursor.defer,
|
||||||
|
child: Material(
|
||||||
|
color: Colors.transparent,
|
||||||
|
borderRadius: BorderRadius.circular(8),
|
||||||
|
child: InkWell(
|
||||||
|
onTap: widget.onTap,
|
||||||
|
borderRadius: BorderRadius.circular(8),
|
||||||
|
hoverColor: const Color(0x149CC5C0),
|
||||||
|
child: _SlotShell(
|
||||||
|
backgroundColor: _hovered
|
||||||
|
? const Color(0xFFF3F0FA)
|
||||||
|
: Colors.grey.shade50,
|
||||||
|
borderColor: _hovered
|
||||||
|
? const Color(0xFFB8A4D4)
|
||||||
|
: Colors.grey.shade300,
|
||||||
child: Center(
|
child: Center(
|
||||||
child: Text(
|
child: Text(
|
||||||
'Place libre',
|
'Place libre',
|
||||||
style: TextStyle(fontSize: 12, color: Colors.grey.shade500),
|
style: TextStyle(
|
||||||
|
fontSize: 12,
|
||||||
|
color: _hovered
|
||||||
|
? const Color(0xFF6B3FA0)
|
||||||
|
: Colors.grey.shade500,
|
||||||
|
fontWeight: _hovered ? FontWeight.w600 : FontWeight.w400,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|||||||
@ -745,6 +745,7 @@ class _AdminAmEditModalState extends State<AdminAmEditModal>
|
|||||||
capacity: capacity,
|
capacity: capacity,
|
||||||
onOpen: _openChild,
|
onOpen: _openChild,
|
||||||
onDetach: _detachChild,
|
onDetach: _detachChild,
|
||||||
|
onAttachEmpty: _capacityFull ? null : _attachChild,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user