Created
August 21, 2023 15:26
-
-
Save rafaelqueiroz88/f3337422ae2676201f69788091c8b60d to your computer and use it in GitHub Desktop.
Flutter Drawer Example
This file contains 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'; | |
class AppDrawer extends StatelessWidget { | |
const AppDrawer({super.key}); | |
@override | |
Widget build(BuildContext context) { | |
return Drawer( | |
backgroundColor: Colors.white, | |
child: Column( | |
crossAxisAlignment: CrossAxisAlignment.start, | |
children: [ | |
AppBar( | |
title: const Text('Drawer Title'), | |
automaticallyImplyLeading: false, | |
), | |
TextButton.icon( | |
onPressed: null, | |
icon: IconButton( | |
icon: const Icon(Icons.home_outlined), | |
onPressed: () => Navigator.of(context).pushReplacementNamed('/path-to-somewhere'), | |
), | |
label: const Text('Home'), | |
), | |
], | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment