类似QQ的侧滑栏
效果图如下:
[图片上传失败...(image-a7a741-1564022874639)]
Usage
declare in pubspec.yaml
dependencies:
...
residemenu:
^1.3.5
initState(){
_menuController = MenuController(vsync:this,direction:ScrollDirection.Left);
}
dispose(){
_menuController.dispose();
}
Widget buildItem(msg) {
return new Material(
color: Colors.transparent,
child: new InkWell(
child: const ResideMenuItem(
title: "菜单一", icon: const Icon(Icons.home, color: Colors.grey),right: const Icon(Icons.arrow_forward,color:Colors.grey),),
onTap: () {
Scaffold
.of(context)
.showSnackBar(new SnackBar(content: new Text('你点击了$msg')));
},
),
);
}
new ResideMenu.scafford(
decoration: new BoxDecoration(
image: new DecorationImage(
image: new AssetImage("images/menu_background.png"),
fit: BoxFit.cover)),
leftScafford: new MenuScaffold(
header: new ConstrainedBox(
constraints: new BoxConstraints(maxHeight: 80.0, maxWidth: 80.0),
child: new CircleAvatar(
backgroundImage: new AssetImage('images/author.jpeg'),
radius: 40.0,
),
),
children: <Widget>[
buildItem("菜单一"),
buildItem("菜单二"),
buildItem("菜单三"),
buildItem("菜单四"),
buildItem("菜单五")
],
),
rightScafford: ...,
controller: _menuController,
child: ...
)
网友评论