flutter_inner_drawer
inner drawer is an easy way to create an internal side section (left/right) where you can insert a list menu or other.
installing the side section
add this to your package’s pubspec.yaml file:
dependencies:
flutter_inner_drawer: "^0.2.2"
new version 0.1.5 -> 0.2.0
animation type
- static
- linear – linear animation from version 0.2.0 has a different behavior
- quadratic (linear of 0.1.5 version)
demo
simple usage
import 'package:flutter_inner_drawer/inner_drawer.dart';
.
.
.
final globalkey<innerdrawerstate> _innerdrawerkey = globalkey<innerdrawerstate>();
@override
widget build(buildcontext context)
{
return innerdrawer(
key: _innerdrawerkey,
position: innerdrawerposition.start, // required
ontapclose: true, // default false
swipe: true, // default true
offset: 0.6, // default 0.4
colortransition: color.red, // default color.black54
animationtype: innerdraweranimation.linear, // default static
innerdrawercallback: (a) => print(a), // return bool
child: material(
child: safearea(
child: container(...)
)
),
// a scaffold is generally used but you are free to use other widgets
// note: use "automaticallyimplyleading: false" if you do not personalize "leading" of bar
scaffold: scaffold(
appbar: appbar(
automaticallyimplyleading: false
)
.
.
)
or
cupertinopagescaffold(
navigationbar: cupertinonavigationbar(
automaticallyimplyleading: false
),
.
.
),
)
}
void _open()
{
_innerdrawerkey.currentstate.open();
}
void _close()
{
_innerdrawerkey.currentstate.close();
}
all parameters
- child – inner widget (required)
- scaffold – a scaffold is generally used but you are free to use other widgets (required)
- position – this controls the direction in which the user should swipe to open and close the innerdrawer (required)
- offset – offset drawer width (default 0.4)
- ontapclose – bool (default false)
- swipe – bool (default true)
- boxshadow – boxshadow of scaffold opened
- colortransition – default colors.black54
- animationtype – static / linear / quadratic (default static)
- innerdrawercallback – optional callback that is called when a innerdrawer is opened or closed
issues
if you encounter problems, open an issue. pull request are also welcome.
Comments are closed.