Flutter is an open-source mobile application development framework that allows developers to build high-performance, cross-platform apps for both iOS and Android.
One of the key features of Flutter is the ability to easily create navigation drawers. In this article, we will take a look at an example of how to create a navigation drawer in Flutter.
Flutter Drawer
In this tutorial, you learn, how to create a flutter drawer. Flutter Drawer is like a slider menu. When you click this widget opens and looks like a slider widget.
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^1.0.2
After adding these dependencies, we can now start building our navigation drawer. Open up the main.dart
file and replace the existing code with the following code:
Create a flutter navigation drawer:
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatefulWidget {
@override
_MyAppState createState() => _MyAppState();
}
@override
class _MyAppState extends State<MyApp> {
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
home: Scaffold(
appBar: AppBar(
title: Text('Title'),
),
drawer: Drawer(
child: Column(
children: [
UserAccountsDrawerHeader(
margin: EdgeInsets.all(0.0),
accountName: Text('Instructive Tech'),
accountEmail: Text('[email protected]'),
currentAccountPicture: CircleAvatar(
backgroundImage: NetworkImage('https://scontent.fdac34-1.fna.fbcdn.net/v/t39.30808-6/271190257_281054324087750_6540061642459300040_n.jpg?_nc_cat=104&ccb=1-5&_nc_sid=09cbfe&_nc_eui2=AeFttG8HoFhQR66PER8P1qlCmYLMf-XZ-6eZgsx_5dn7p_GuyzigLxTlWB6hG8P9_Xyl-vNoVRcDCM4TC4Cq0-OQ&_nc_ohc=AEZU2a_wVEgAX-GrhuG&_nc_zt=23&_nc_ht=scontent.fdac34-1.fna&oh=00_AT8k_MqY1MK22Uyis0AYbw6tmMVMs4_hkAIiuHexRT2jhg&oe=620911D4'),
),
currentAccountPictureSize: Size(60,60),
),
ListTile(
title: Text('This is Titel'),
subtitle: Text('Subtitle'),
leading: Icon(Icons.home),
),
ListTile(
title: Text('This is Titel'),
subtitle: Text('Subtitle'),
leading: Icon(Icons.account_box_outlined),
),
ListTile(
title: Text('This is Titel'),
subtitle: Text('Subtitle'),
leading: Icon(Icons.info),
),
],
),
),
),
);
}
}
Flutter Drawer Tutorial
- How to Conduct YouTube Keyword Research Easily?Introduction YouTube is the second largest search engine in the world, making it a valuable platform for content creators and businesses alike. To maximize your visibility and reach on YouTube, it is crucial to conduct proper keyword research. By identifying the right keywords, you can optimize your videos for search and increase your chances of …
- How to upgrade the Dart SDK version in flutterIf you’re a Flutter developer, you know how important it is to stay up-to-date with the latest version of the Dart SDK. Upgrading the Dart SDK ensures that you have access to the latest features, bug fixes, and performance improvements. Step 1: Check Your Current Dart SDK Version Before you begin the upgrade process, it’s …
- Why Do Advertisers Use Testimonials?In the ever-competitive business landscape, nurturing strong connections with your customers remains paramount for enhancing your credibility and positioning yourself as an industry authority. Establishing credibility is the bedrock upon which trust is built, ultimately translating into increased sales. To bolster your company’s credibility, integrating testimonial advertising into your marketing strategy is essential. So, what …
- How To Earn $5 Fast Method!Looking to boost your income by $25 in less than an hour? This isn’t the start of a clichéd sales pitch; it’s about discovering several quick and simple ways to earn $5 online within minutes. For instance, you can make five bucks by completing tasks such as taking brief surveys, participating in short website usability …
- What Does BMF Mean On TikTok? Latest Social Media AcronymsIn the fast-paced world of social media, acronyms are the language of choice, enabling users to communicate swiftly without the need for lengthy phrases. While classics like LOL and OMG are still in use, the younger generation on TikTok has introduced a new acronym into the mix: BMF. So, what exactly does BMF mean, and …
Read also, the Flutter Slideable widget.
Overall, Flutter Navigation Drawer is a great example of how Flutter empowers developers to create highly customizable, performant, and engaging mobile applications that provide a seamless and intuitive user experience