Non puoi selezionare più di 25 argomenti
Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
148 righe
5.2 KiB
148 righe
5.2 KiB
import 'package:flutter/material.dart'; |
|
import 'package:hexcolor/hexcolor.dart'; |
|
import 'package:idrocap/private/notifiche.dart'; |
|
import 'package:idrocap/utility/utility.dart'; |
|
import '../constant/globals.dart' as globals; |
|
|
|
class Menu extends StatelessWidget { |
|
@override |
|
Widget build(BuildContext context) { |
|
return Drawer( |
|
backgroundColor: Colors.white, |
|
child: ListView( |
|
padding: EdgeInsets.zero, |
|
children: [ |
|
Container( |
|
height: 40, |
|
color: HexColor(globals.colorAppbar), |
|
), |
|
Container( |
|
color: HexColor(globals.colorAppbar), |
|
child: ListTile( |
|
leading: Icon( |
|
Icons.account_circle_outlined, |
|
color: Colors.white, |
|
size: 50, |
|
), |
|
title: Column( |
|
children: [ |
|
Wrap( |
|
children: [ |
|
Align( |
|
alignment: Alignment.topLeft, |
|
child: Text( |
|
globals.titolo, |
|
style: TextStyle(color: Colors.white), |
|
), |
|
) |
|
], |
|
), |
|
Wrap( |
|
children: [ |
|
Align( |
|
alignment: Alignment.topLeft, |
|
child: Text( |
|
globals.userAccess.user.name + " " + globals.userAccess.user.surname, |
|
style: TextStyle(color: Colors.white), |
|
), |
|
) |
|
], |
|
) |
|
], |
|
), |
|
// subtitle: Text(" "), |
|
onTap: () {}, |
|
), |
|
), |
|
for (int i = 0; i < globals.userAccess.user.mobile_menu.length; i++) |
|
Column( |
|
children: [ |
|
if (globals.userAccess.user.mobile_menu[i]['menu_item'] == "water_drawing_paperworks") |
|
ListTile( |
|
leading: Icon( |
|
Icons.description, |
|
size: 30, |
|
), |
|
title: Text('Pratiche di Attingimento'), |
|
// subtitle: Text(" "), |
|
onTap: () { |
|
print(ModalRoute.of(context)?.settings.name.toString()); |
|
if (ModalRoute.of(context)?.settings.name.toString() != "pratiche") { |
|
if (Navigator.canPop(context)) { |
|
Navigator.pop(context); |
|
} |
|
Navigator.of(context).pushNamedAndRemoveUntil('pratiche', (Route<dynamic> route) => false); |
|
} |
|
}, |
|
), |
|
if (globals.userAccess.user.mobile_menu[i]['menu_item'] == "users") |
|
ListTile( |
|
leading: Icon( |
|
Icons.person, |
|
size: 30, |
|
), |
|
title: Text("Utenti"), |
|
onTap: () { |
|
if (ModalRoute.of(context)?.settings.name.toString() != "userList") { |
|
if (Navigator.canPop(context)) { |
|
Navigator.pop(context); |
|
} |
|
Navigator.of(context).pushNamedAndRemoveUntil('userList', (Route<dynamic> route) => false); |
|
} |
|
}, |
|
), |
|
if (globals.userAccess.user.mobile_menu[i]['menu_item'] == "organisations") |
|
ListTile( |
|
leading: Icon( |
|
Icons.supervisor_account, |
|
size: 30, |
|
), |
|
title: Text("Organizzazioni"), |
|
onTap: () { |
|
if (ModalRoute.of(context)?.settings.name.toString() != "organizzazioni") { |
|
if (Navigator.canPop(context)) { |
|
Navigator.pop(context); |
|
} |
|
Navigator.of(context).pushNamedAndRemoveUntil('organizzazioni', (Route<dynamic> route) => false); |
|
} |
|
}, |
|
), |
|
], |
|
), |
|
ListTile( |
|
leading: Icon( |
|
Icons.notifications, |
|
size: 30, |
|
), |
|
title: Text("Notifiche"), |
|
onTap: () { |
|
Navigator.push(context, MaterialPageRoute(builder: (context) => Notifiche())); |
|
}, |
|
), |
|
Container( |
|
child: Align( |
|
alignment: FractionalOffset.bottomLeft, |
|
child: Container( |
|
child: Column( |
|
children: <Widget>[ |
|
Divider(), |
|
ListTile( |
|
leading: Icon( |
|
Icons.logout, |
|
size: 30, |
|
), |
|
title: Text("Disconetti"), |
|
onTap: () { |
|
Utility.logout(context); |
|
}, |
|
), |
|
], |
|
), |
|
), |
|
), |
|
), |
|
], |
|
), |
|
); |
|
} |
|
}
|
|
|