edit backgroun and inmclude
This commit is contained in:
+114
-160
@@ -9,6 +9,9 @@ import 'meditation_page.dart';
|
||||
import '../services/vanguard_api.dart';
|
||||
import 'login_page.dart';
|
||||
import 'medical_certificates_page.dart';
|
||||
import '../widgets/app_drawer.dart';
|
||||
import '../widgets/app_bottom_nav.dart';
|
||||
import '../widgets/yogibook_background.dart';
|
||||
|
||||
class HomePage extends StatefulWidget {
|
||||
final String token;
|
||||
@@ -251,60 +254,14 @@ class _HomePageState extends State<HomePage> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: kBg,
|
||||
drawer: Drawer(
|
||||
child: SafeArea(
|
||||
child: ListView(
|
||||
padding: EdgeInsets.zero,
|
||||
children: [
|
||||
const DrawerHeader(
|
||||
child: Align(
|
||||
alignment: Alignment.bottomLeft,
|
||||
child: Text(
|
||||
'Menu',
|
||||
style: TextStyle(fontSize: 22, fontWeight: FontWeight.w900),
|
||||
),
|
||||
),
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.swap_horiz),
|
||||
title: const Text('Cambia scuola'),
|
||||
onTap: () {
|
||||
Navigator.of(context).pop();
|
||||
Navigator.pushReplacement(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (_) => SelectSchoolPage(token: widget.token),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.medical_information),
|
||||
title: const Text('Certificati medici'),
|
||||
onTap: () {
|
||||
Navigator.of(context).pop(); // chiude drawer
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (_) =>
|
||||
MedicalCertificatesPage(token: widget.token),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
const Divider(height: 1),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.logout),
|
||||
title: const Text('Logout'),
|
||||
onTap: _logout,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
drawer: AppDrawer(
|
||||
token: widget.token,
|
||||
school: widget.school,
|
||||
userFirstName: widget.userFirstName,
|
||||
),
|
||||
|
||||
appBar: AppBar(
|
||||
backgroundColor: kBg,
|
||||
backgroundColor: Colors.transparent,
|
||||
elevation: 0,
|
||||
centerTitle: true,
|
||||
title: const Text(
|
||||
@@ -329,128 +286,125 @@ class _HomePageState extends State<HomePage> {
|
||||
),
|
||||
],
|
||||
),
|
||||
bottomNavigationBar: BottomNavigationBar(
|
||||
type: BottomNavigationBarType.fixed, // con 4 icone serve
|
||||
backgroundColor: Colors.white,
|
||||
selectedItemColor: const Color(0xFF10B981),
|
||||
unselectedItemColor: Colors.black54,
|
||||
|
||||
bottomNavigationBar: AppBottomNav(
|
||||
currentIndex: bottomIndex,
|
||||
onTap: _handleBottomNav,
|
||||
items: const [
|
||||
BottomNavigationBarItem(
|
||||
icon: Icon(Icons.home_rounded),
|
||||
label: 'Home',
|
||||
),
|
||||
BottomNavigationBarItem(
|
||||
icon: Icon(Icons.event_note_rounded),
|
||||
label: 'Lezioni',
|
||||
),
|
||||
BottomNavigationBarItem(
|
||||
icon: Icon(Icons.person_rounded),
|
||||
label: 'Account',
|
||||
),
|
||||
BottomNavigationBarItem(
|
||||
icon: Icon(Icons.self_improvement_rounded),
|
||||
label: 'Meditazione',
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
body: Padding(
|
||||
padding: const EdgeInsets.fromLTRB(16, 10, 16, 16),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
// Ciao + nome
|
||||
Text(
|
||||
_name.isNotEmpty ? 'Ciao, $_name' : 'Ciao',
|
||||
style: const TextStyle(fontSize: 18, fontWeight: FontWeight.w900),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
body: YogibookBackground(
|
||||
child: SafeArea(
|
||||
top: false,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.fromLTRB(16, 10, 16, 16),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
|
||||
// Nome scuola + indirizzo sotto
|
||||
Text(
|
||||
widget.school.name,
|
||||
style: const TextStyle(fontSize: 16, fontWeight: FontWeight.w900),
|
||||
),
|
||||
if (_schoolAddress.isNotEmpty) ...[
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
_schoolAddress,
|
||||
style: const TextStyle(
|
||||
fontSize: 12,
|
||||
color: Colors.black54,
|
||||
fontWeight: FontWeight.w600,
|
||||
children: [
|
||||
// Ciao + nome
|
||||
Text(
|
||||
_name.isNotEmpty ? 'Ciao, $_name' : 'Ciao',
|
||||
style: const TextStyle(
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.w900,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
const SizedBox(height: 10),
|
||||
const SizedBox(height: 10),
|
||||
|
||||
// Pulsante mappe
|
||||
OutlinedButton.icon(
|
||||
onPressed: _openMaps,
|
||||
icon: const Icon(Icons.directions, size: 18, color: kGreen),
|
||||
label: const Text(
|
||||
'Apri Mappe',
|
||||
style: TextStyle(fontWeight: FontWeight.w800, color: kGreen),
|
||||
),
|
||||
style: OutlinedButton.styleFrom(
|
||||
side: const BorderSide(color: kGreen, width: 2),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(14),
|
||||
// Nome scuola + indirizzo sotto
|
||||
Text(
|
||||
widget.school.name,
|
||||
style: const TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w900,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
const SizedBox(height: 14),
|
||||
|
||||
// Tiles
|
||||
_HomeTile(
|
||||
icon: Icons.event_note_rounded,
|
||||
title: 'Vedi lezioni',
|
||||
subtitle: 'Prenotazioni e gestione lezioni',
|
||||
onTap: _goLessons,
|
||||
),
|
||||
_HomeTile(
|
||||
icon: Icons.shopping_bag_rounded,
|
||||
title: 'Vedi ordini',
|
||||
subtitle: 'Storico e stato ordini (TODO)',
|
||||
onTap: () => ScaffoldMessenger.of(
|
||||
context,
|
||||
).showSnackBar(const SnackBar(content: Text('TODO: Ordini'))),
|
||||
),
|
||||
_HomeTile(
|
||||
icon: Icons.person_rounded,
|
||||
title: 'Account',
|
||||
subtitle: 'Profilo e impostazioni (TODO)',
|
||||
onTap: () => ScaffoldMessenger.of(
|
||||
context,
|
||||
).showSnackBar(const SnackBar(content: Text('TODO: Account'))),
|
||||
),
|
||||
|
||||
const Spacer(),
|
||||
|
||||
// Logo + frase zen
|
||||
Center(
|
||||
child: Column(
|
||||
children: [
|
||||
if (_schoolAddress.isNotEmpty) ...[
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
'“$zenQuote”',
|
||||
textAlign: TextAlign.center,
|
||||
_schoolAddress,
|
||||
style: const TextStyle(
|
||||
fontSize: 16,
|
||||
height: 1.3,
|
||||
color: Colors.black87,
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 12,
|
||||
color: Colors.black54,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 14),
|
||||
Image.asset('assets/images/yogibook_logo.png', height: 78),
|
||||
const SizedBox(height: 6),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
|
||||
// Pulsante mappe
|
||||
OutlinedButton.icon(
|
||||
onPressed: _openMaps,
|
||||
icon: const Icon(Icons.directions, size: 18, color: kGreen),
|
||||
label: const Text(
|
||||
'Apri Mappe',
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w800,
|
||||
color: kGreen,
|
||||
),
|
||||
),
|
||||
style: OutlinedButton.styleFrom(
|
||||
side: const BorderSide(color: kGreen, width: 2),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(14),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
const SizedBox(height: 14),
|
||||
|
||||
// Tiles
|
||||
_HomeTile(
|
||||
icon: Icons.event_note_rounded,
|
||||
title: 'Vedi lezioni',
|
||||
subtitle: 'Prenotazioni e gestione lezioni',
|
||||
onTap: _goLessons,
|
||||
),
|
||||
_HomeTile(
|
||||
icon: Icons.shopping_bag_rounded,
|
||||
title: 'Vedi ordini',
|
||||
subtitle: 'Storico e stato ordini (TODO)',
|
||||
onTap: () => ScaffoldMessenger.of(
|
||||
context,
|
||||
).showSnackBar(const SnackBar(content: Text('TODO: Ordini'))),
|
||||
),
|
||||
_HomeTile(
|
||||
icon: Icons.person_rounded,
|
||||
title: 'Account',
|
||||
subtitle: 'Profilo e impostazioni (TODO)',
|
||||
onTap: () => ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(content: Text('TODO: Account')),
|
||||
),
|
||||
),
|
||||
|
||||
const Spacer(),
|
||||
|
||||
// Logo + frase zen
|
||||
Center(
|
||||
child: Column(
|
||||
children: [
|
||||
Text(
|
||||
'“$zenQuote”',
|
||||
textAlign: TextAlign.center,
|
||||
style: const TextStyle(
|
||||
fontSize: 16,
|
||||
height: 1.3,
|
||||
color: Colors.black87,
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 14),
|
||||
Image.asset(
|
||||
'assets/images/yogibook_logo.png',
|
||||
height: 78,
|
||||
),
|
||||
const SizedBox(height: 6),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user