nav bar
main_design2.0
nextwo 2 years ago
parent dd524bcbd1
commit b0992da201

@ -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<ScaffoldState> scaffoldKey;
HomeAppBar({Key key, this.notificationCount, this.userImage, this.scaffoldKey}) : super(key: key);
@override
State<HomeAppBar> createState() => _AppBarState();
@override
Size get preferredSize => const Size.fromHeight(150);
Size get preferredSize => const Size.fromHeight(60);
}
class _AppBarState extends State<HomeAppBar> {
@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,
)
],
),
],
),
);
}

@ -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: <Widget>[
const Icon(Icons.notifications, size: 36,),
Icon(Icons.notifications, size: 36, ),
if(notificationCount != null)
Positioned(
right: 0,

@ -19,6 +19,7 @@ class LandPage extends StatefulWidget {
}
class _LandPageState extends State<LandPage> {
final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
int currentPageIndex = 0;
static const List<Widget> _pages = <Widget>[
DashboardPage(),
@ -49,7 +50,8 @@ class _LandPageState extends State<LandPage> {
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],

Loading…
Cancel
Save