Skip to content

Instantly share code, notes, and snippets.

@rafaelqueiroz88
Created August 21, 2023 15:26
Show Gist options
  • Save rafaelqueiroz88/f3337422ae2676201f69788091c8b60d to your computer and use it in GitHub Desktop.
Save rafaelqueiroz88/f3337422ae2676201f69788091c8b60d to your computer and use it in GitHub Desktop.
Flutter Drawer Example
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