drawer update

This commit is contained in:
Juki-shiba 2025-02-14 17:06:35 +05:30
parent 9768e4c882
commit a90782a48b
4 changed files with 47 additions and 27 deletions

View File

@ -664,10 +664,24 @@ class _BaseScaffoldState extends ConsumerState<BaseScaffold> {
preferredSize: Size.fromHeight(1), // Height of the line preferredSize: Size.fromHeight(1), // Height of the line
child: Container( child: Container(
color: widget.dividerColor, // Line color color: widget.dividerColor, // Line color
width: MediaQuery.of(context).size.width, // Ensures full width
height: 1, // Line thickness height: 1, // Line thickness
margin: EdgeInsets.zero, // Ensure no extra margins
padding: EdgeInsets.zero, // Remove padding if any
), ),
) )
: null, : null,
// bottom: widget.showDivider
// ? PreferredSize(
// preferredSize: Size.fromHeight(1), // Height of the line
// child: Container(
// color: widget.dividerColor,
// width: double.infinity,// Line color
// height: 1, // Line thickness
// ),
// )
// : null,
actions: widget.actions ?? actions: widget.actions ??
[ [
// IconButton( // IconButton(
@ -755,7 +769,7 @@ class _BaseScaffoldState extends ConsumerState<BaseScaffold> {
), ),
], ],
), ),
Divider(), Divider(thickness: 1, color: Colors.grey),
InkWell( InkWell(
onTap: () { onTap: () {
if (userId != 'guest') context.go('/editProfile'); if (userId != 'guest') context.go('/editProfile');
@ -813,7 +827,7 @@ class _BaseScaffoldState extends ConsumerState<BaseScaffold> {
ListTile( ListTile(
leading: Icon(Icons.notifications_none), leading: Icon(Icons.notifications_none),
title: const Text('Notification'), title: const Text('Notification'),
onTap: () => context.go('/notification'), onTap: () => _navigateTo(context, '/notification'),
), ),
ListTile( ListTile(
leading: Icon(Icons.message_outlined), leading: Icon(Icons.message_outlined),
@ -825,7 +839,7 @@ class _BaseScaffoldState extends ConsumerState<BaseScaffold> {
// ), // ),
// title: const Text('Feedback'), // title: const Text('Feedback'),
title: Text(AppLocalizations.of(context)!.feedback_title), title: Text(AppLocalizations.of(context)!.feedback_title),
onTap: () => context.go('/feedback', extra: userName), onTap: () => _navigateTo(context, '/feedback', extra: userName),
), ),
if (role == 'admin') if (role == 'admin')
ListTile( ListTile(
@ -840,7 +854,7 @@ class _BaseScaffoldState extends ConsumerState<BaseScaffold> {
title: Text( title: Text(
AppLocalizations.of(context)!.manage_user, AppLocalizations.of(context)!.manage_user,
), ),
onTap: () => context.go('/manageuser'), onTap: () => _navigateTo(context, '/manageuser'),
), ),
ListTile( ListTile(
leading: Icon(Icons.bookmarks_outlined), leading: Icon(Icons.bookmarks_outlined),
@ -848,7 +862,7 @@ class _BaseScaffoldState extends ConsumerState<BaseScaffold> {
title: Text( title: Text(
AppLocalizations.of(context)!.bookmark_title, AppLocalizations.of(context)!.bookmark_title,
), ),
onTap: () => context.go('/bookmark'), onTap: () => _navigateTo(context, '/bookmark'),
), ),
ListTile( ListTile(
leading: Icon(Icons.menu_book_outlined), leading: Icon(Icons.menu_book_outlined),
@ -860,7 +874,7 @@ class _BaseScaffoldState extends ConsumerState<BaseScaffold> {
// ), // ),
// title: const Text('User Guide'), // title: const Text('User Guide'),
title: Text(AppLocalizations.of(context)!.guide_title), title: Text(AppLocalizations.of(context)!.guide_title),
onTap: () => context.go('/user-guide'), onTap: () => _navigateTo(context, '/user-guide'),
), ),
if (userId != 'guest') if (userId != 'guest')
ListTile( ListTile(
@ -1000,6 +1014,11 @@ class _BaseScaffoldState extends ConsumerState<BaseScaffold> {
body: widget.body, body: widget.body,
); );
} }
//drawer close code
void _navigateTo(BuildContext context, String route, {Object? extra}) {
Navigator.pop(context); // Close the drawer
context.go(route, extra: extra); // Navigate with extra data
}
int _getSelectedIndex(String route) { int _getSelectedIndex(String route) {
switch (route) { switch (route) {

View File

@ -1002,7 +1002,7 @@ packages:
source: hosted source: hosted
version: "1.1.0" version: "1.1.0"
path_provider: path_provider:
dependency: transitive dependency: "direct main"
description: description:
name: path_provider name: path_provider
sha256: "50c5dd5b6e1aaf6fb3a78b33f6aa3afca52bf903a8a5298f53101fdaee55bbcd" sha256: "50c5dd5b6e1aaf6fb3a78b33f6aa3afca52bf903a8a5298f53101fdaee55bbcd"

View File

@ -25,6 +25,7 @@ dependencies:
iconify_design: ^1.0.1 iconify_design: ^1.0.1
marquee: ^2.2.3 marquee: ^2.2.3
url_launcher: ^6.3.1 url_launcher: ^6.3.1
path_provider: ^2.1.5
# dynamic_layouts: # dynamic_layouts:
# git: # git:
# url: https://github.com/flutter/packages.git # url: https://github.com/flutter/packages.git