Created
November 22, 2021 08:13
-
-
Save gabrielgatu/5ed72360d1d565fbfe24f8482a3f8002 to your computer and use it in GitHub Desktop.
Flutter2Start - Drawer #flutter2start
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
// ignore_for_file: use_key_in_widget_constructors, prefer_const_constructors, prefer_const_literals_to_create_immutables | |
import 'package:flutter/material.dart'; | |
void main() { | |
runApp(App()); | |
} | |
class App extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
home: HomePage(), | |
); | |
} | |
} | |
class HomePage extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
appBar: AppBar( | |
title: Text("Flutter2Start"), | |
centerTitle: true, | |
), | |
body: Center( | |
child: Text("Empty."), | |
), | |
drawer: Drawer( | |
child: ListView( | |
padding: EdgeInsets.all(0), | |
children: [ | |
DrawerHeader( | |
decoration: BoxDecoration( | |
image: DecorationImage( | |
image: NetworkImage( | |
"https://images.unsplash.com/photo-1637499202056-cf221f3b0712?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=3087&q=80"), | |
fit: BoxFit.cover, | |
colorFilter: ColorFilter.mode(Colors.black38, BlendMode.darken), | |
), | |
), | |
child: Padding( | |
padding: EdgeInsets.only(bottom: 16), | |
child: Column( | |
crossAxisAlignment: CrossAxisAlignment.start, | |
mainAxisAlignment: MainAxisAlignment.end, | |
children: [ | |
Text( | |
"@gabrielgatu", | |
style: TextStyle( | |
color: Colors.white, | |
fontSize: 16, | |
fontWeight: FontWeight.bold, | |
), | |
) | |
], | |
), | |
), | |
), | |
ListTile( | |
onTap: () => Navigator.pop(context), | |
leading: Icon(Icons.home), | |
title: Text("Home"), | |
), | |
ListTile( | |
onTap: () => Navigator.pop(context), | |
leading: Icon(Icons.person), | |
title: Text("Profilo"), | |
), | |
], | |
), | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment