mydrawer.dart 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. import 'package:flutter/material.dart';
  2. class MyDrawer extends StatelessWidget {
  3. const MyDrawer({
  4. Key? key,
  5. }) : super(key: key);
  6. @override
  7. Widget build(BuildContext context) {
  8. return Drawer(
  9. child: MediaQuery.removePadding(
  10. context: context,
  11. //移除抽屉菜单顶部默认留白
  12. removeTop: true,
  13. child: Column(
  14. crossAxisAlignment: CrossAxisAlignment.start,
  15. children: <Widget>[
  16. Padding(
  17. padding: const EdgeInsets.only(top: 38.0),
  18. child: Row(
  19. children: <Widget>[
  20. Padding(
  21. padding: const EdgeInsets.symmetric(horizontal: 16.0),
  22. child: ClipOval(
  23. child: Image.asset(
  24. "imgs/avatar.png",
  25. width: 80,
  26. ),
  27. ),
  28. ),
  29. Text(
  30. "Wendux",
  31. style: TextStyle(fontWeight: FontWeight.bold),
  32. )
  33. ],
  34. ),
  35. ),
  36. Expanded(
  37. child: ListView(
  38. children: <Widget>[
  39. ListTile(
  40. leading: const Icon(Icons.add),
  41. title: const Text('Add account'),
  42. ),
  43. ListTile(
  44. leading: const Icon(Icons.settings),
  45. title: const Text('Manage accounts'),
  46. ),
  47. ],
  48. ),
  49. ),
  50. ],
  51. ),
  52. ),
  53. );
  54. }
  55. }