diff --git a/lib/presentation/Screens/profilepage.dart b/lib/presentation/Screens/profilepage.dart index f88960d8..27d3a3e0 100644 --- a/lib/presentation/Screens/profilepage.dart +++ b/lib/presentation/Screens/profilepage.dart @@ -183,10 +183,10 @@ class _ProfileScreenState extends State { _isLoading = true; // Start loading }); final XFile? pickedFile = - await _picker.pickImage(source: ImageSource.gallery); + await _picker.pickImage(source: ImageSource.gallery); if (pickedFile != null) { final String fileExtension = - pickedFile.path.split('.').last.toLowerCase(); + pickedFile.path.split('.').last.toLowerCase(); if (fileExtension == 'jpg' || fileExtension == 'jpeg' || fileExtension == 'png' || @@ -320,7 +320,7 @@ class _ProfileScreenState extends State { // Create a multipart request final uri = - Uri.parse('${_pb.baseUrl}/api/collections/users/records/$userID'); + Uri.parse('${_pb.baseUrl}/api/collections/users/records/$userID'); final request = http.MultipartRequest('PATCH', uri); // Add other fields @@ -531,7 +531,7 @@ class _ProfileScreenState extends State { backgroundImage: _profileImage != null ? FileImage(_profileImage!) : AssetImage("assets/edit_profile/profile.png") - as ImageProvider, + as ImageProvider, child: Align( alignment: Alignment.bottomRight, child: GestureDetector( @@ -555,7 +555,7 @@ class _ProfileScreenState extends State { child: CircularProgressIndicator( strokeWidth: 2, valueColor: - AlwaysStoppedAnimation(Colors.grey), + AlwaysStoppedAnimation(Colors.grey), ), ), ], @@ -707,7 +707,7 @@ class _ProfileScreenState extends State { width: 45, padding: EdgeInsets.only(right: 1), alignment: - Alignment.center, // Center the icon vertically + Alignment.center, // Center the icon vertically child: Icon( Icons.keyboard_arrow_down_sharp, color: _isHoveringDate ? Colors.black : Colors.grey, @@ -755,12 +755,12 @@ class _ProfileScreenState extends State { ), icon: Icon(Icons.keyboard_arrow_down_sharp, color: - _isHoveringDropdown ? Colors.black : Colors.grey), + _isHoveringDropdown ? Colors.black : Colors.grey), items: _countries .map((item) => DropdownMenuItem( - value: item, - child: Text(item), - )) + value: item, + child: Text(item), + )) .toList(), onChanged: (String? newValue) { setState(() { @@ -783,7 +783,7 @@ class _ProfileScreenState extends State { }, side: BorderSide( color: - showError ? Color(0xFFb22222) : Color(0xFF7296BE), + showError ? Color(0xFFb22222) : Color(0xFF7296BE), width: 1, ), ), @@ -909,7 +909,7 @@ class _ProfileScreenState extends State { } else { setState(() { showError = - !isChecked; // Show error if the checkbox is not checked + !isChecked; // Show error if the checkbox is not checked }); } }, @@ -922,7 +922,7 @@ class _ProfileScreenState extends State { ), child: Row( mainAxisAlignment: - MainAxisAlignment.center, // Center the content + MainAxisAlignment.center, // Center the content children: [ Text( AppLocalizations.of(context)!.save, @@ -981,7 +981,7 @@ class ConfirmationDialog extends StatelessWidget { TextSpan( text: "Name", style: - TextStyle(fontWeight: FontWeight.w700), // Bold for "name" + TextStyle(fontWeight: FontWeight.w700), // Bold for "name" ), TextSpan( text: " or ", diff --git a/lib/presentation/routes/drawer_routes/custom_drawer_routes.dart b/lib/presentation/routes/drawer_routes/custom_drawer_routes.dart index a35aeb93..a4d4de3a 100644 --- a/lib/presentation/routes/drawer_routes/custom_drawer_routes.dart +++ b/lib/presentation/routes/drawer_routes/custom_drawer_routes.dart @@ -661,13 +661,27 @@ class _BaseScaffoldState extends ConsumerState { leadingWidth: widget.showBackButton ? mywidth * 0.25 : null, bottom: widget.showDivider ? PreferredSize( - preferredSize: Size.fromHeight(1), // Height of the line - child: Container( - color: widget.dividerColor, // Line color - height: 1, // Line thickness - ), - ) + 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 { ), ], ), - Divider(), + Divider(thickness: 1, color: Colors.grey), InkWell( onTap: () { if (userId != 'guest') context.go('/editProfile'); @@ -813,7 +827,7 @@ class _BaseScaffoldState extends ConsumerState { 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 { // ), // 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 { 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 { 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 { // ), // 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 { 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) { diff --git a/pubspec.lock b/pubspec.lock index c8b9ce43..def2e2bf 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -1002,7 +1002,7 @@ packages: source: hosted version: "1.1.0" path_provider: - dependency: transitive + dependency: "direct main" description: name: path_provider sha256: "50c5dd5b6e1aaf6fb3a78b33f6aa3afca52bf903a8a5298f53101fdaee55bbcd" diff --git a/pubspec.yaml b/pubspec.yaml index 24cec09b..8b69919d 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -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