0 purchases
cv side menu
an easy side menu
Usage #
import 'package:cv_side_menu/cv_side_menu.dart';
List<SideMenuItem> items = const [
SideMenuItem(
page: SomePageHasMenu(),
routePath: "/somePageHasMenu",
id: 99,
title: "SomePageHasMenu",
leadingIconData: Icons.ac_unit,
),
SideMenuItem(
page: PageA(),
routePath: "/pageA",
id: 1,
title: "page a",
leadingIconData: Icons.ac_unit,
),
SideMenuItem(
id: 3,
title: "page c",
routePath: "exp/page",
leadingIconData: Icons.baby_changing_station,
trailingIconData: Icons.arrow_drop_down_outlined,
expItem: [
SideMenuItem(
page: PageX(),
routePath: "/pageX",
id: 10,
title: "page X",
leadingIconData: Icons.ac_unit,
),
SideMenuItem(
page: PageQ(),
routePath: "/pageQ",
id: 11,
title: "page Q",
leadingIconData: Icons.ac_unit,
),
]
),
];
final SideMenuStyle menuStyle = SideMenuStyle(
itemSelectBGColor: Colors.yellow,
itemHeight: 35,
itemUnselectColor: Colors.grey,
menuWidth: 200,
// titleStyle: TextStyle(fontSize: 50)
);
final SideMenuStyle expStyle = SideMenuStyle(
itemSelectBGColor: Colors.white,
itemUnselectBGColor: Colors.white,
itemSelectColor: Colors.blue,
itemHeight: 35,
itemUnselectColor: Colors.grey);
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title:ConstrainedBox(
constraints: const BoxConstraints(maxWidth: 400,maxHeight: 35),
child: const TextField(
textAlign: TextAlign.center,
decoration: InputDecoration(
hintText: '搜索',
border: OutlineInputBorder(),
contentPadding: EdgeInsets.symmetric(horizontal: 10),
),
),
),
leading: _leading(),
actions: [
ElevatedButton(onPressed: (){}, child: const Text("退出"))
],
leadingWidth: 250,
),
body: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
CVSideMenu(
menuItems: items,
style: menuStyle,
// expStyle: expStyle,
),
CVSideMenuContent(items: items,defaultPage:const Page404(),)
],
),
);
}
copied to clipboard
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.