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
child: Container(
color: widget.dividerColor, // Line color
width: MediaQuery.of(context).size.width, // Ensures full width
height: 1, // Line thickness
margin: EdgeInsets.zero, // Ensure no extra margins
padding: EdgeInsets.zero, // Remove padding if any
),
)
: 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 ??
[
// IconButton(
@ -755,7 +769,7 @@ class _BaseScaffoldState extends ConsumerState<BaseScaffold> {
),
],
),
Divider(),
Divider(thickness: 1, color: Colors.grey),
InkWell(
onTap: () {
if (userId != 'guest') context.go('/editProfile');
@ -813,7 +827,7 @@ class _BaseScaffoldState extends ConsumerState<BaseScaffold> {
ListTile(
leading: Icon(Icons.notifications_none),
title: const Text('Notification'),
onTap: () => context.go('/notification'),
onTap: () => _navigateTo(context, '/notification'),
),
ListTile(
leading: Icon(Icons.message_outlined),
@ -825,7 +839,7 @@ class _BaseScaffoldState extends ConsumerState<BaseScaffold> {
// ),
// title: const Text('Feedback'),
title: Text(AppLocalizations.of(context)!.feedback_title),
onTap: () => context.go('/feedback', extra: userName),
onTap: () => _navigateTo(context, '/feedback', extra: userName),
),
if (role == 'admin')
ListTile(
@ -840,7 +854,7 @@ class _BaseScaffoldState extends ConsumerState<BaseScaffold> {
title: Text(
AppLocalizations.of(context)!.manage_user,
),
onTap: () => context.go('/manageuser'),
onTap: () => _navigateTo(context, '/manageuser'),
),
ListTile(
leading: Icon(Icons.bookmarks_outlined),
@ -848,7 +862,7 @@ class _BaseScaffoldState extends ConsumerState<BaseScaffold> {
title: Text(
AppLocalizations.of(context)!.bookmark_title,
),
onTap: () => context.go('/bookmark'),
onTap: () => _navigateTo(context, '/bookmark'),
),
ListTile(
leading: Icon(Icons.menu_book_outlined),
@ -860,7 +874,7 @@ class _BaseScaffoldState extends ConsumerState<BaseScaffold> {
// ),
// title: const Text('User Guide'),
title: Text(AppLocalizations.of(context)!.guide_title),
onTap: () => context.go('/user-guide'),
onTap: () => _navigateTo(context, '/user-guide'),
),
if (userId != 'guest')
ListTile(
@ -1000,6 +1014,11 @@ class _BaseScaffoldState extends ConsumerState<BaseScaffold> {
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) {
switch (route) {

View File

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

View File

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