backdrop implementation
backdrop implementation in flutter.
this widget is in active development. wait for the stable v1.0.0. any contribution, idea, criticism or feedback is welcomed.
usage
backdropscaffold
use backdropscaffold
instead of the standard scaffold
in your app.
a backlayer
and a frontlayer
have to be defined for the backdrop to work.
backdropscaffold(
title: text("backdrop example"),
backlayer: center(
child: text("back layer"),
),
frontlayer: center(
child: text("front layer"),
),
iconposition: backdropiconposition.leading,
)
navigation with backdrop
to use backdrop for navigation, use the provided backdropnavigationbacklayer
as backlayer
.
the backdropnavigationbacklayer
contains a property items
representing the list elements shown on the back layer. the front layer has to be “manually” set depending on the current index, which can be accessed with the ontap
callback.
class _myappstate extends state<myapp> {
int _currentindex = 0;
final list<widget> _frontlayers = [widget1(), widget2()];
@override
widget build(buildcontext context) {
return new materialapp(
title: 'backdrop demo',
home: backdropscaffold(
title: text("backdrop navigation example"),
iconposition: backdropiconposition.leading,
actions: <widget>[
backdroptogglebutton(
icon: animatedicons.list_view,
),
],
frontlayer: _frontlayers[_currentindex],
backlayer: backdropnavigationbacklayer(
items: [
listtile(title: text("widget 1")),
listtile(title: text("widget 2")),
],
ontap: (int position) => {setstate(() => _currentindex = position)},
),
),
);
}
}
for more information, check out sample code in the example directory
Comments are closed.