fixed bugs

This commit is contained in:
2026-08-21 13:11:55 +02:00
parent ab36215b7a
commit 64eade33f3
16 changed files with 367 additions and 361 deletions
+49 -85
View File
@@ -37,8 +37,6 @@ class _LessonsPageState extends State<LessonsPage> {
LessonsSummary? summary;
List<Lesson> lessons = [];
int bottomIndex = 1;
@override
void initState() {
super.initState();
@@ -104,48 +102,6 @@ class _LessonsPageState extends State<LessonsPage> {
String get _name => (widget.userFirstName ?? '').trim();
String get _avatarLetter => _name.isNotEmpty ? _name[0].toUpperCase() : 'U';
void _handleBottomNav(int i) {
if (i == bottomIndex) return;
setState(() => bottomIndex = i);
if (i == 0) {
Navigator.pushReplacement(
context,
MaterialPageRoute(
builder: (_) => HomePage(
token: widget.token,
school: widget.school,
userFirstName: widget.userFirstName,
),
),
);
return;
}
if (i == 1) return; // sei già su Lezioni
if (i == 2) {
ScaffoldMessenger.of(
context,
).showSnackBar(const SnackBar(content: Text('TODO: vai ad Account')));
return;
}
if (i == 3) {
Navigator.pushReplacement(
context,
MaterialPageRoute(
builder: (_) => MeditationPage(
token: widget.token,
school: widget.school,
userFirstName: widget.userFirstName,
),
),
);
return;
}
}
@override
Widget build(BuildContext context) {
return Scaffold(
@@ -195,8 +151,10 @@ class _LessonsPageState extends State<LessonsPage> {
],
),
bottomNavigationBar: AppBottomNav(
currentIndex: bottomIndex,
onTap: _handleBottomNav,
currentIndex: 1,
token: widget.token,
school: widget.school,
userFirstName: widget.userFirstName,
),
body: YogibookBackground(
@@ -388,47 +346,53 @@ class _SummaryStrip extends StatelessWidget {
_SummaryItem('Perse', summary.lost, const Color(0xFFFBC7C4)),
];
return SizedBox(
height: 76,
child: ListView.separated(
scrollDirection: Axis.horizontal,
itemCount: items.length,
separatorBuilder: (_, __) => const SizedBox(width: 8),
itemBuilder: (_, i) {
final it = items[i];
return Container(
width: 96,
padding: const EdgeInsets.all(8),
decoration: BoxDecoration(
color: it.color,
borderRadius: BorderRadius.circular(12),
),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
'${it.value}',
style: const TextStyle(
fontSize: 22,
fontWeight: FontWeight.w900,
// 3 colonne, spaziatura tra i box
const spacing = 8.0;
const columns = 3;
return LayoutBuilder(
builder: (context, constraints) {
final boxWidth =
(constraints.maxWidth - spacing * (columns - 1)) / columns;
return Wrap(
spacing: spacing,
runSpacing: spacing,
children: items.map((it) {
return Container(
width: boxWidth,
padding: const EdgeInsets.symmetric(vertical: 10, horizontal: 6),
decoration: BoxDecoration(
color: it.color,
borderRadius: BorderRadius.circular(12),
),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
'${it.value}',
style: const TextStyle(
fontSize: 22,
fontWeight: FontWeight.w900,
),
),
),
const SizedBox(height: 2),
Text(
it.label,
textAlign: TextAlign.center,
style: const TextStyle(
fontSize: 10,
fontWeight: FontWeight.w700,
const SizedBox(height: 2),
Text(
it.label,
textAlign: TextAlign.center,
style: const TextStyle(
fontSize: 11,
fontWeight: FontWeight.w700,
),
maxLines: 2,
overflow: TextOverflow.ellipsis,
),
maxLines: 2,
overflow: TextOverflow.ellipsis,
),
],
),
);
},
),
],
),
);
}).toList(),
);
},
);
}
}