home_page.dart 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. import 'package:flutter/material.dart';
  2. class HomePage extends StatefulWidget {
  3. const HomePage({super.key});
  4. @override
  5. State<HomePage> createState() => _HomePageState();
  6. }
  7. class _HomePageState extends State<HomePage> {
  8. // bool _isVisible = true;
  9. final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
  10. @override
  11. void initState() {
  12. super.initState();
  13. WidgetsBinding.instance.addPostFrameCallback((_) {
  14. _scaffoldKey.currentState?.openDrawer();
  15. });
  16. }
  17. void _closeDrawer() {
  18. Navigator.of(context).pop();
  19. }
  20. @override
  21. Widget build(BuildContext context) {
  22. return Scaffold(
  23. key: _scaffoldKey,
  24. appBar: AppBar(
  25. title: Text("utils"),
  26. // leading: IconButton(
  27. // icon: Icon(Icons.menu),
  28. // onPressed: () {
  29. // _scaffoldKey.currentState?.openDrawer();
  30. // },
  31. // ),
  32. ),
  33. drawer: Container(
  34. width: 70.0,
  35. child: Drawer(
  36. child: ListView(
  37. padding: EdgeInsets.zero,
  38. children: <Widget>[
  39. ListTile(
  40. leading: Image.asset('email.png', height: 24, width: 24),
  41. onTap: () {
  42. // Handle email tap
  43. // Navigator.of(context).pop(); // Close the drawer
  44. print("email");
  45. },
  46. ),
  47. ListTile(
  48. leading: Image.asset('contact-book.png', height: 24, width: 24),
  49. onTap: () {
  50. print("contact");
  51. // Handle contact tap
  52. // Navigator.of(context).pop(); // Close the drawer
  53. },
  54. ),
  55. ListTile(
  56. leading:
  57. Image.asset('communications.png', height: 24, width: 24),
  58. onTap: () {
  59. // Handle calendar tap
  60. // Navigator.of(context).pop(); // Close the drawer
  61. print("communications");
  62. },
  63. ),
  64. ListTile(
  65. leading: Image.asset('back.png', height: 24, width: 24),
  66. onTap: () {
  67. // Handle tasks tap
  68. // Navigator.of(context).pop(); // Close the drawer
  69. _closeDrawer();
  70. },
  71. ),
  72. ],
  73. ),
  74. ),
  75. ),
  76. );
  77. }
  78. }