Created
February 8, 2020 11:10
-
-
Save maheshj01/04c7ed2fee325d56598b24f085e02912 to your computer and use it in GitHub Desktop.
end drawer image stacked issue
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
// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file | |
// for details. All rights reserved. Use of this source code is governed by a | |
// BSD-style license that can be found in the LICENSE file. | |
import 'package:flutter/material.dart'; | |
void main() => runApp(MyApp()); | |
class MyApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
title: 'Flutter Demo', | |
debugShowCheckedModeBanner: false, | |
theme: ThemeData( | |
primarySwatch: Colors.blue, | |
), | |
home: MyHomePage(title: 'Flutter Demo Home Page'), | |
); | |
} | |
} | |
class MyHomePage extends StatefulWidget { | |
MyHomePage({Key key, this.title}) : super(key: key); | |
final String title; | |
@override | |
_MyHomePageState createState() => _MyHomePageState(); | |
} | |
class _MyHomePageState extends State<MyHomePage> { | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
endDrawer: Drawer( | |
child: Stack( | |
children: <Widget>[ | |
// background of the drawer | |
Container( | |
decoration: BoxDecoration( | |
gradient: LinearGradient( | |
begin: Alignment.topCenter, | |
end: Alignment.bottomCenter, | |
colors: [Colors.black87, Colors.grey[800]], | |
)), | |
), | |
ListView( | |
children: List.generate(2, (x) { | |
if (x == 0) { | |
return Container( | |
height: 100, | |
alignment: Alignment.center, | |
child: Text( | |
'TITLE', | |
style: TextStyle(color: Colors.white), | |
), | |
); | |
} | |
return Row( | |
children: <Widget>[ | |
Expanded( | |
flex: 1, | |
child: Stack( | |
children: <Widget>[ | |
FractionalTranslation( | |
translation: Offset(-0.5, 0.30), | |
child: Container( | |
height: 50, | |
width: 50, | |
margin: EdgeInsets.only( | |
top: 10, | |
), | |
decoration: BoxDecoration( | |
shape: BoxShape.circle, color: Colors.white), | |
padding: EdgeInsets.all(5), | |
child: CircleAvatar( | |
backgroundImage: NetworkImage("https://everipedia-storage.s3-accelerate.amazonaws.com/ProfilePics/6969909036-1492880896.jpeg"), | |
radius: 40, | |
backgroundColor: Colors.grey, | |
), | |
), | |
), | |
], | |
)), | |
Expanded( | |
flex: 5, | |
child: Container( | |
height: 130, | |
width: 150, | |
margin: EdgeInsets.symmetric(horizontal: 10, vertical: 10), | |
decoration: BoxDecoration( | |
boxShadow: [ | |
BoxShadow( | |
offset: Offset(0, 5.0), | |
blurRadius: 2.0, | |
color: Colors.red | |
) | |
], | |
color: Colors.red, | |
borderRadius: BorderRadius.circular(10)), | |
child: Column( | |
children: <Widget>[ | |
Expanded( | |
flex: 2, | |
child: Row( | |
mainAxisAlignment: MainAxisAlignment.spaceBetween, | |
children: <Widget>[ | |
Container( | |
padding: EdgeInsets.all(10), | |
child: Text( | |
"John Doe", | |
style: TextStyle(color: Colors.white), | |
), | |
), | |
Container( | |
padding: EdgeInsets.all(10), | |
child: Text( | |
"18:50", | |
style: TextStyle(color: Colors.white), | |
), | |
), | |
], | |
), | |
), | |
Expanded( | |
flex: 4, | |
child: Container( | |
padding: EdgeInsets.all(10), | |
child: Text( | |
'Neque porro quisquam est qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit...', | |
style: TextStyle(color: Colors.white), | |
), | |
), | |
) | |
], | |
), | |
), | |
) | |
], | |
); | |
})) | |
], | |
)), | |
appBar: AppBar( | |
actions: [ | |
Builder( | |
builder: (context) => IconButton( | |
icon: Icon(Icons.menu), | |
onPressed: () => Scaffold.of(context).openEndDrawer(), | |
tooltip: MaterialLocalizations.of(context).openAppDrawerTooltip, | |
), | |
), | |
], | |
), | |
body: new Container( | |
child: Center( | |
child: Text("Tap the Menu on Top Right"), | |
), | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment