import 'package:flutter/material.dart';
class HomePage extends StatefulWidget {
const HomePage({Key? key}) : super(key: key);
@override
State<HomePage> createState() => _HomePageState();
}
class _HomePageState extends State<HomePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
leading: Builder(builder: (cxt){
return IconButton(onPressed: (){Scaffold.of(cxt).openDrawer();}, icon: const Icon(Icons.settings));
},),
actions: [
Builder(builder: (cxt){
return IconButton(onPressed: (){Scaffold.of(cxt).openEndDrawer();}, icon: const Icon(Icons.padding));
},),
IconButton(onPressed: ()=>print("search"), icon: const Icon(Icons.search)),
IconButton(onPressed: ()=>print("add"), icon: const Icon(Icons.add)),
],
),
backgroundColor: Colors.white,
body: Container(
alignment: Alignment.center,
height: 812,
width: 375,
color: Colors.red,
child: const Form(child: Text("asd")),
),
drawer: Drawer(
child: Column(
children: <Widget>[
DrawerHeader(
decoration: const BoxDecoration(
color: Colors.yellow,
),
child: ListView(
children: const [
Text('头部')
],
),
),
const ListTile(
title: Text("个人中心"),
leading: CircleAvatar(
child: Icon(Icons.people)
),
),
const Divider(),
const ListTile(
title: Text("系统设置"),
leading: CircleAvatar(
child: Icon(Icons.settings)
),
)
],
)
),
endDrawer: Drawer(
child: Column(
children: const <Widget>[
UserAccountsDrawerHeader(
accountName:Text("zxc") ,
accountEmail:Text("asd") ,
decoration: BoxDecoration(
color: Colors.yellow,
),
otherAccountsPictures: <Widget>[
Icon(Icons.add),
Icon(Icons.add_a_photo_outlined),
],
),
ListTile(
title: Text("个人中心"),
leading: CircleAvatar(
child: Icon(Icons.people)
),
),
Divider(),
ListTile(
title: Text("系统设置"),
leading: CircleAvatar(
child: Icon(Icons.settings)
),
)
],
)
),
);
}
}
网友评论