diff --git a/example/lib/main.dart b/example/lib/main.dart index b935069f..6ecd4ad4 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -100,7 +100,7 @@ class _MyHomePageState extends State "https://cdn.pixabay.com/photo/2017/12/03/18/04/christmas-balls-2995437_960_720.jpg"), ), decoration: BoxDecoration( - color: Colors.transparent, + color: Colors.teal, ), otherAccountsPictures: [ Image( @@ -112,6 +112,7 @@ class _MyHomePageState extends State child: Text("dcf"), ) ], +// closeButton: Text("Close"), child: Column( mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, @@ -174,6 +175,8 @@ class _MyHomePageState extends State // Container(color: Colors.green), // Container(color: Colors.blue) // ]), + + SingleChildScrollView( child: Column( mainAxisAlignment: MainAxisAlignment.center, @@ -645,6 +648,7 @@ class _MyHomePageState extends State // ), // GFButton( +// position: GFPosition.end, // icon: GFBadge( // child: Text("12"), // color: GFColor.dark, @@ -661,9 +665,9 @@ class _MyHomePageState extends State // hoverColor: GFColor.dark, color: GFColor.secondary, // focusColor: GFColor.danger, - type: GFButtonType.solid, - shape: GFButtonShape.pills, - buttonBoxShadow: true, +// type: GFButtonType.solid, +// shape: GFButtonShape.pills, +// buttonBoxShadow: true, // boxShadow: BoxShadow( // color: Colors.pink, // blurRadius: 2.0, @@ -675,7 +679,7 @@ class _MyHomePageState extends State // size: GFSize.large, // disabledColor: GFColor.dark, // disabledTextColor: GFColor.light, - blockButton: true, +// blockButton: true, // fullWidthButton: true, // borderSide: BorderSide(color: Colors.pink, width: 1.0, style: BorderStyle.solid), // borderShape: RoundedRectangleBorder(side: BorderSide(color: Colors.pink, width: 2.0, style: BorderStyle.solid), borderRadius: BorderRadius.zero), diff --git a/lib/components/drawer/gf_drawer_header.dart b/lib/components/drawer/gf_drawer_header.dart index 1315f46f..ba840659 100644 --- a/lib/components/drawer/gf_drawer_header.dart +++ b/lib/components/drawer/gf_drawer_header.dart @@ -1,21 +1,39 @@ import 'package:flutter/widgets.dart'; import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; +import 'package:getflutter/components/button/gf_icon_button.dart'; +import 'package:getflutter/getflutter.dart'; class GFDrawerHeaderPictures extends StatelessWidget { - const GFDrawerHeaderPictures({ - Key key, - this.currentAccountPicture, - this.otherAccountsPictures, - }) : super(key: key); + const GFDrawerHeaderPictures( + {Key key, + this.currentAccountPicture, + this.otherAccountsPictures, + this.closeButton}) + : super(key: key); final Widget currentAccountPicture; final List otherAccountsPictures; + /// widget onTap drawer get closed + final Widget closeButton; + @override Widget build(BuildContext context) { return Stack( children: [ + closeButton == null + ? GFIconButton( + icon: Icon( + Icons.close, + color: Colors.white, + ), + onPressed: (){ + Navigator.pop(context); + }, + type: GFButtonType.transparent, + ) + : closeButton, PositionedDirectional( top: 0.0, end: 0.0, @@ -39,7 +57,7 @@ class GFDrawerHeaderPictures extends StatelessWidget { ), ), Positioned( - top: 0.0, + top: 40.0, child: Semantics( explicitChildNodes: true, child: SizedBox( @@ -71,6 +89,7 @@ class GFDrawerHeader extends StatefulWidget { this.child, this.duration = const Duration(milliseconds: 250), this.curve = Curves.fastOutSlowIn, + this.closeButton }) : super(key: key); /// The header's background. If decoration is null then a [BoxDecoration] @@ -103,6 +122,9 @@ class GFDrawerHeader extends StatefulWidget { /// The curve for animations of the [decoration]. final Curve curve; + /// widget onTap drawer get closed + final Widget closeButton; + @override _GFDrawerHeaderState createState() => _GFDrawerHeaderState(); } @@ -112,10 +134,13 @@ class _GFDrawerHeaderState extends State { Widget build(BuildContext context) { assert(debugCheckHasMaterial(context)); assert(debugCheckHasMaterialLocalizations(context)); + final double statusBarHeight = MediaQuery.of(context).padding.top; + return Semantics( container: true, label: MaterialLocalizations.of(context).signedInLabel, - child: DrawerHeader( + child: Container( + height: statusBarHeight + 185.0, decoration: widget.decoration ?? BoxDecoration( color: Theme.of(context).primaryColor, @@ -125,6 +150,7 @@ class _GFDrawerHeaderState extends State { child: SafeArea( bottom: false, child: Column( + mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.stretch, children: [ Expanded( @@ -133,14 +159,16 @@ class _GFDrawerHeaderState extends State { child: GFDrawerHeaderPictures( currentAccountPicture: widget.currentAccountPicture, otherAccountsPictures: widget.otherAccountsPictures, + closeButton: widget.closeButton, ), ), ), AnimatedContainer( - padding: EdgeInsets.only(bottom: 16.0), - duration: widget.duration, - curve: widget.curve, - child: widget.child), + padding: EdgeInsets.only(bottom: 16.0), + duration: widget.duration, + curve: widget.curve, + child: widget.child, + ), ], ), ),