尽管我是Flutter的新手,但现在我正在克隆在互联网上看到的网站的可扩展和可折叠侧边栏菜单。
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
final appTitle = 'Drawer Demo';
@override
Widget build(BuildContext context) {
return MaterialApp(
title: appTitle,
home: MyHomePage(title: appTitle),
);
}
}
class MyHomePage extends StatelessWidget {
final String title;
MyHomePage({Key key, this.title}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: Text(title)),
body: Center(child: Text('Dashboard')),
drawer: Drawer(
child: ListView(
children: <Widget>[
Text('Dashboard'),
ExpansionTile(
title: Text("User management"),
children: <Widget>[Text("Users"),
Text("Add user"),
Text("Migrate users")
],
),
ExpansionTile(
title: Text("Remittance management"),
children: <Widget>[Text("Add remittance"),
Text("Trace remittance"),
Text("Remittance history"),
Text("Search remittances"),
Text("Online remittance requests")
],
)
],
),
),
);
}
}
尊敬的成员,有什么帮助吗?
谢谢。
答案 0 :(得分:0)
使用ExpansionPanelList()
包装您的ExpansionPanels