drawer update
This commit is contained in:
parent
9768e4c882
commit
a90782a48b
@ -183,10 +183,10 @@ class _ProfileScreenState extends State<ProfileScreen> {
|
|||||||
_isLoading = true; // Start loading
|
_isLoading = true; // Start loading
|
||||||
});
|
});
|
||||||
final XFile? pickedFile =
|
final XFile? pickedFile =
|
||||||
await _picker.pickImage(source: ImageSource.gallery);
|
await _picker.pickImage(source: ImageSource.gallery);
|
||||||
if (pickedFile != null) {
|
if (pickedFile != null) {
|
||||||
final String fileExtension =
|
final String fileExtension =
|
||||||
pickedFile.path.split('.').last.toLowerCase();
|
pickedFile.path.split('.').last.toLowerCase();
|
||||||
if (fileExtension == 'jpg' ||
|
if (fileExtension == 'jpg' ||
|
||||||
fileExtension == 'jpeg' ||
|
fileExtension == 'jpeg' ||
|
||||||
fileExtension == 'png' ||
|
fileExtension == 'png' ||
|
||||||
@ -320,7 +320,7 @@ class _ProfileScreenState extends State<ProfileScreen> {
|
|||||||
|
|
||||||
// Create a multipart request
|
// Create a multipart request
|
||||||
final uri =
|
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);
|
final request = http.MultipartRequest('PATCH', uri);
|
||||||
|
|
||||||
// Add other fields
|
// Add other fields
|
||||||
@ -531,7 +531,7 @@ class _ProfileScreenState extends State<ProfileScreen> {
|
|||||||
backgroundImage: _profileImage != null
|
backgroundImage: _profileImage != null
|
||||||
? FileImage(_profileImage!)
|
? FileImage(_profileImage!)
|
||||||
: AssetImage("assets/edit_profile/profile.png")
|
: AssetImage("assets/edit_profile/profile.png")
|
||||||
as ImageProvider,
|
as ImageProvider,
|
||||||
child: Align(
|
child: Align(
|
||||||
alignment: Alignment.bottomRight,
|
alignment: Alignment.bottomRight,
|
||||||
child: GestureDetector(
|
child: GestureDetector(
|
||||||
@ -555,7 +555,7 @@ class _ProfileScreenState extends State<ProfileScreen> {
|
|||||||
child: CircularProgressIndicator(
|
child: CircularProgressIndicator(
|
||||||
strokeWidth: 2,
|
strokeWidth: 2,
|
||||||
valueColor:
|
valueColor:
|
||||||
AlwaysStoppedAnimation<Color>(Colors.grey),
|
AlwaysStoppedAnimation<Color>(Colors.grey),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@ -707,7 +707,7 @@ class _ProfileScreenState extends State<ProfileScreen> {
|
|||||||
width: 45,
|
width: 45,
|
||||||
padding: EdgeInsets.only(right: 1),
|
padding: EdgeInsets.only(right: 1),
|
||||||
alignment:
|
alignment:
|
||||||
Alignment.center, // Center the icon vertically
|
Alignment.center, // Center the icon vertically
|
||||||
child: Icon(
|
child: Icon(
|
||||||
Icons.keyboard_arrow_down_sharp,
|
Icons.keyboard_arrow_down_sharp,
|
||||||
color: _isHoveringDate ? Colors.black : Colors.grey,
|
color: _isHoveringDate ? Colors.black : Colors.grey,
|
||||||
@ -755,12 +755,12 @@ class _ProfileScreenState extends State<ProfileScreen> {
|
|||||||
),
|
),
|
||||||
icon: Icon(Icons.keyboard_arrow_down_sharp,
|
icon: Icon(Icons.keyboard_arrow_down_sharp,
|
||||||
color:
|
color:
|
||||||
_isHoveringDropdown ? Colors.black : Colors.grey),
|
_isHoveringDropdown ? Colors.black : Colors.grey),
|
||||||
items: _countries
|
items: _countries
|
||||||
.map((item) => DropdownMenuItem<String>(
|
.map((item) => DropdownMenuItem<String>(
|
||||||
value: item,
|
value: item,
|
||||||
child: Text(item),
|
child: Text(item),
|
||||||
))
|
))
|
||||||
.toList(),
|
.toList(),
|
||||||
onChanged: (String? newValue) {
|
onChanged: (String? newValue) {
|
||||||
setState(() {
|
setState(() {
|
||||||
@ -783,7 +783,7 @@ class _ProfileScreenState extends State<ProfileScreen> {
|
|||||||
},
|
},
|
||||||
side: BorderSide(
|
side: BorderSide(
|
||||||
color:
|
color:
|
||||||
showError ? Color(0xFFb22222) : Color(0xFF7296BE),
|
showError ? Color(0xFFb22222) : Color(0xFF7296BE),
|
||||||
width: 1,
|
width: 1,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -909,7 +909,7 @@ class _ProfileScreenState extends State<ProfileScreen> {
|
|||||||
} else {
|
} else {
|
||||||
setState(() {
|
setState(() {
|
||||||
showError =
|
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<ProfileScreen> {
|
|||||||
),
|
),
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment:
|
mainAxisAlignment:
|
||||||
MainAxisAlignment.center, // Center the content
|
MainAxisAlignment.center, // Center the content
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
AppLocalizations.of(context)!.save,
|
AppLocalizations.of(context)!.save,
|
||||||
@ -981,7 +981,7 @@ class ConfirmationDialog extends StatelessWidget {
|
|||||||
TextSpan(
|
TextSpan(
|
||||||
text: "Name",
|
text: "Name",
|
||||||
style:
|
style:
|
||||||
TextStyle(fontWeight: FontWeight.w700), // Bold for "name"
|
TextStyle(fontWeight: FontWeight.w700), // Bold for "name"
|
||||||
),
|
),
|
||||||
TextSpan(
|
TextSpan(
|
||||||
text: " or ",
|
text: " or ",
|
||||||
|
|||||||
@ -661,13 +661,27 @@ class _BaseScaffoldState extends ConsumerState<BaseScaffold> {
|
|||||||
leadingWidth: widget.showBackButton ? mywidth * 0.25 : null,
|
leadingWidth: widget.showBackButton ? mywidth * 0.25 : null,
|
||||||
bottom: widget.showDivider
|
bottom: widget.showDivider
|
||||||
? PreferredSize(
|
? PreferredSize(
|
||||||
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
|
||||||
height: 1, // Line thickness
|
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,
|
: 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) {
|
||||||
|
|||||||
@ -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"
|
||||||
|
|||||||
@ -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
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user