Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
2
22_23-J 21
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
22_23-J 21
22_23-J 21
Commits
419befd9
Commit
419befd9
authored
May 09, 2023
by
Hirunika R.A.S.
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added drawer widget
parent
f2f25046
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
96 additions
and
0 deletions
+96
-0
FrontEnd/lib/widgets/drawer_widget.dart
FrontEnd/lib/widgets/drawer_widget.dart
+96
-0
No files found.
FrontEnd/lib/widgets/drawer_widget.dart
0 → 100644
View file @
419befd9
import
'package:flutter/material.dart'
;
import
'package:govimithura/constants/images.dart'
;
import
'package:govimithura/providers/authentication_provider.dart'
;
import
'package:govimithura/screens/home.dart'
;
import
'package:govimithura/screens/my_post_list.dart'
;
import
'package:govimithura/screens/my_profile.dart'
;
import
'package:provider/provider.dart'
;
import
'../screens/saved_posts.dart'
;
import
'../utils/utils.dart'
;
class
DrawerWidget
extends
StatefulWidget
{
const
DrawerWidget
({
super
.
key
});
@override
State
<
DrawerWidget
>
createState
()
=>
_DrawerWidgetState
();
}
class
_DrawerWidgetState
extends
State
<
DrawerWidget
>
{
late
AuthenticationProvider
pAuthentication
;
@override
void
initState
()
{
super
.
initState
();
pAuthentication
=
Provider
.
of
<
AuthenticationProvider
>(
context
,
listen:
false
);
}
@override
Widget
build
(
BuildContext
context
)
{
return
Drawer
(
shape:
Theme
.
of
(
context
).
drawerTheme
.
endShape
,
child:
ListView
(
padding:
EdgeInsets
.
zero
,
children:
<
Widget
>[
UserAccountsDrawerHeader
(
currentAccountPicture:
CircleAvatar
(
onBackgroundImageError:
(
exception
,
stackTrace
)
=>
Utils
.
showSnackBar
(
context
,
'Error loading image'
),
backgroundColor:
Theme
.
of
(
context
).
primaryColor
,
backgroundImage:
NetworkImage
(
pAuthentication
.
getCurrentUser
()?.
photoURL
??
Images
.
defaultAvatar
),
),
decoration:
BoxDecoration
(
color:
Theme
.
of
(
context
).
primaryColor
,
),
accountName:
Text
(
pAuthentication
.
getCurrentUser
()!.
displayName
.
toString
(),
style:
const
TextStyle
(
fontSize:
20
),
),
accountEmail:
Text
(
pAuthentication
.
getCurrentUser
()!.
email
.
toString
()),
),
ListTile
(
onTap:
()
{
Navigator
.
pushReplacement
(
context
,
MaterialPageRoute
(
builder:
(
_
)
=>
const
Home
()));
},
leading:
const
Icon
(
Icons
.
home_rounded
),
title:
const
Text
(
'Home'
),
),
ListTile
(
onTap:
()
{
Navigator
.
pushReplacement
(
context
,
MaterialPageRoute
(
builder:
(
_
)
=>
const
MyProfile
()));
},
leading:
const
Icon
(
Icons
.
person_rounded
),
title:
const
Text
(
'My Profile'
),
),
ListTile
(
onTap:
()
{
Navigator
.
pushReplacement
(
context
,
MaterialPageRoute
(
builder:
(
_
)
=>
const
MyPostList
()));
},
leading:
const
Icon
(
Icons
.
post_add_rounded
),
title:
const
Text
(
'My Posts'
),
),
ListTile
(
onTap:
()
{
Navigator
.
pushReplacement
(
context
,
MaterialPageRoute
(
builder:
(
_
)
=>
const
SavedPosts
()));
},
leading:
const
Icon
(
Icons
.
bookmark_rounded
),
title:
const
Text
(
'Saved'
),
),
ListTile
(
onTap:
()
{},
leading:
const
Icon
(
Icons
.
contact_phone_rounded
),
title:
const
Text
(
'Contact Us'
),
),
],
),
);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment