Last active
April 29, 2025 16:15
-
-
Save SalcidoJesus/e2025e52f308838d385c3540d0b271dc to your computer and use it in GitHub Desktop.
Custom Drawer para Flutter
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// import 'dart:developer'; | |
import 'package:flutter/material.dart'; | |
import 'package:get/get.dart'; | |
class CustomDrawer extends StatelessWidget { | |
const CustomDrawer({super.key}); | |
@override | |
Widget build(BuildContext context) { | |
// log(Get.currentRoute, name: 'CustomDrawer'); | |
return Drawer( | |
child: Column( | |
children: [ | |
Container( | |
padding: EdgeInsets.only(top: 50, bottom: 20), | |
height: 160, | |
// color: Colors.deepPurple, | |
child: Center( | |
child: CircleAvatar( | |
backgroundImage: AssetImage('assets/yo.jpg'), | |
radius: 50, | |
), | |
), | |
), | |
Divider(), | |
ListTile( | |
leading: Icon(Icons.home), | |
title: Text('Inicio'), | |
selectedTileColor: Colors.deepPurple.shade400, | |
selectedColor: Colors.white, | |
selected: Get.currentRoute == '/', | |
onTap: () { | |
Navigator.pop(context); | |
Get.toNamed('/'); | |
}, | |
), | |
ListTile( | |
leading: Icon(Icons.message), | |
title: Text('Mensajes'), | |
selectedTileColor: Colors.deepPurple.shade400, | |
selectedColor: Colors.white, | |
selected: Get.currentRoute == '/mensajes', | |
onTap: () { | |
Navigator.pop(context); | |
Get.toNamed('/mensajes'); | |
}, | |
), | |
ListTile( | |
leading: Icon(Icons.person), | |
title: Text('Perfil'), | |
selectedTileColor: Colors.deepPurple.shade400, | |
selectedColor: Colors.white, | |
selected: Get.currentRoute == '/perfil', | |
onTap: () { | |
Navigator.pop(context); | |
Get.toNamed('/perfil'); | |
}, | |
), | |
ListTile( | |
leading: Icon(Icons.list), | |
title: Text('Menú'), | |
selectedTileColor: Colors.deepPurple.shade400, | |
selectedColor: Colors.white, | |
selected: Get.currentRoute == '/menu', | |
onTap: () { | |
Navigator.pop(context); | |
Get.toNamed('/menu'); | |
}, | |
), | |
], | |
), | |
); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
// import 'package:flutter_2025/components/custom_drawer.dart'; | |
class Mensajes extends StatelessWidget { | |
const Mensajes({super.key}); | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
appBar: AppBar( | |
backgroundColor: Colors.deepPurple, | |
iconTheme: IconThemeData(color: Colors.white), | |
title: Text('Mensajes', style: TextStyle(color: Colors.white)), | |
), | |
body: Center(child: Text('mensajes')), | |
// drawer: CustomDrawer(), | |
); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
// import 'package:flutter_2025/components/custom_drawer.dart'; | |
class Perfil extends StatelessWidget { | |
const Perfil({super.key}); | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
appBar: AppBar( | |
backgroundColor: Colors.deepPurple, | |
iconTheme: IconThemeData(color: Colors.white), | |
title: Text('Perfil', style: TextStyle(color: Colors.white)), | |
), | |
body: Center(child: Text('Perfil')), | |
// drawer: CustomDrawer(), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment