From b0992da2014d8b796e4e7e43153b182245cf2985 Mon Sep 17 00:00:00 2001 From: nextwo <1234> Date: Tue, 10 Oct 2023 13:04:37 +0300 Subject: [PATCH] app bar nav bar --- .../common_widgets/app_bar/home_app_bar.dart | 51 +++++++++---------- .../app_bar/notification_icon.dart | 3 +- lib/new_views/pages/land_page/land_page.dart | 4 +- 3 files changed, 29 insertions(+), 29 deletions(-) diff --git a/lib/new_views/common_widgets/app_bar/home_app_bar.dart b/lib/new_views/common_widgets/app_bar/home_app_bar.dart index 41c4156a..94e9f993 100644 --- a/lib/new_views/common_widgets/app_bar/home_app_bar.dart +++ b/lib/new_views/common_widgets/app_bar/home_app_bar.dart @@ -7,45 +7,42 @@ import 'notification_icon.dart'; class HomeAppBar extends StatefulWidget implements PreferredSizeWidget { final int notificationCount; final String userImage; - const HomeAppBar({Key key, this.notificationCount, this.userImage}) : super(key: key); + GlobalKey scaffoldKey; + HomeAppBar({Key key, this.notificationCount, this.userImage, this.scaffoldKey}) : super(key: key); @override State createState() => _AppBarState(); @override - Size get preferredSize => const Size.fromHeight(150); + Size get preferredSize => const Size.fromHeight(60); } class _AppBarState extends State { @override Widget build(BuildContext context) { - return Padding( - padding: const EdgeInsets.only(top: 30.0, right: 12, left: 12), - child: PreferredSize( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - UserImage( + return AppBar( + automaticallyImplyLeading: false, + elevation: 0, + title: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + InkWell( + onTap: (){ + widget.scaffoldKey.currentState.openDrawer(); + }, + child: UserImage( url: widget.userImage, ), - NotificationIcon( - notificationCount: 3, - ) - ], - ), - // SizedBox(height: 15), - // Column( - // crossAxisAlignment: CrossAxisAlignment.start, - // children: [ - // Text("welcome," , style: Theme.of(context).textTheme.titleLarge?.copyWith(fontWeight: FontWeight.w500, color: AppColor.neutral20)), - // Text("Engineer name" , style: Theme.of(context).textTheme.headlineMedium?.copyWith(fontWeight: FontWeight.w600)), - // ], - // ) - ], - ), + ), + NotificationIcon( + notificationCount: 3, + ) + ], + ), + ], ), ); } diff --git a/lib/new_views/common_widgets/app_bar/notification_icon.dart b/lib/new_views/common_widgets/app_bar/notification_icon.dart index 1db7de74..cac4a6ae 100644 --- a/lib/new_views/common_widgets/app_bar/notification_icon.dart +++ b/lib/new_views/common_widgets/app_bar/notification_icon.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; +import 'package:test_sa/extensions/context_extension.dart'; import '../../app_style/app_color.dart'; @@ -10,7 +11,7 @@ class NotificationIcon extends StatelessWidget { Widget build(BuildContext context) { return Stack( children: [ - const Icon(Icons.notifications, size: 36,), + Icon(Icons.notifications, size: 36, ), if(notificationCount != null) Positioned( right: 0, diff --git a/lib/new_views/pages/land_page/land_page.dart b/lib/new_views/pages/land_page/land_page.dart index d01b717a..fffb0b33 100644 --- a/lib/new_views/pages/land_page/land_page.dart +++ b/lib/new_views/pages/land_page/land_page.dart @@ -19,6 +19,7 @@ class LandPage extends StatefulWidget { } class _LandPageState extends State { + final GlobalKey _scaffoldKey = GlobalKey(); int currentPageIndex = 0; static const List _pages = [ DashboardPage(), @@ -49,7 +50,8 @@ class _LandPageState extends State { return false; }, child: Scaffold( - appBar: HomeAppBar(), + key: _scaffoldKey, + appBar: HomeAppBar(scaffoldKey:_scaffoldKey), body: Padding( padding: EdgeInsets.only(left: 16.toScreenWidth, top: 11.toScreenHeight), child: _pages[currentPageIndex],