UI changes in sidemenu.
This commit is contained in:
parent
fe49bdf9af
commit
064e753fb9
@ -1,3 +1,7 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
ValueNotifier<String> selectedRoute = ValueNotifier<String>("/dashboard");
|
||||||
|
|
||||||
class AppRoutePaths {
|
class AppRoutePaths {
|
||||||
///Auth
|
///Auth
|
||||||
static const auth = '/auth';
|
static const auth = '/auth';
|
||||||
|
|||||||
@ -22,7 +22,7 @@ class SideMenu extends ConsumerWidget {
|
|||||||
children: [
|
children: [
|
||||||
// Header
|
// Header
|
||||||
DrawerHeader(
|
DrawerHeader(
|
||||||
decoration: BoxDecoration(color: Color(0xFF00BFFF)),
|
decoration: const BoxDecoration(color: Color(0xFF00BFFF)),
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
child: Row(
|
child: Row(
|
||||||
@ -112,8 +112,10 @@ class SideMenu extends ConsumerWidget {
|
|||||||
// Section title widget
|
// Section title widget
|
||||||
Widget _sectionHeader(String title) {
|
Widget _sectionHeader(String title) {
|
||||||
return Container(
|
return Container(
|
||||||
padding: EdgeInsets.symmetric(vertical: 8),
|
padding: const EdgeInsets.symmetric(vertical: 8),
|
||||||
decoration: BoxDecoration(color: Color.fromARGB(255, 225, 236, 255)),
|
decoration: const BoxDecoration(
|
||||||
|
color: Color.fromARGB(255, 225, 236, 255),
|
||||||
|
),
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.only(left: 8.0),
|
padding: const EdgeInsets.only(left: 8.0),
|
||||||
child: Text(
|
child: Text(
|
||||||
@ -130,51 +132,74 @@ class SideMenu extends ConsumerWidget {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Menu item widget
|
// Menu item widget with persistent left indicator
|
||||||
Widget _menuItem(
|
Widget _menuItem(
|
||||||
BuildContext context,
|
BuildContext context,
|
||||||
String emoji,
|
String emoji,
|
||||||
String title,
|
String title,
|
||||||
String route,
|
String route,
|
||||||
) {
|
) {
|
||||||
final bool isSelected = selected == route;
|
return ValueListenableBuilder(
|
||||||
|
valueListenable: selectedRoute,
|
||||||
|
builder: (_, current, __) {
|
||||||
|
final bool isSelected = current == route;
|
||||||
|
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 3),
|
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 3),
|
||||||
child: InkWell(
|
child: InkWell(
|
||||||
borderRadius: BorderRadius.circular(10),
|
|
||||||
onTap: () {
|
|
||||||
Navigator.pop(context); // close drawer
|
|
||||||
|
|
||||||
if (isSelected) return; // avoid duplicate navigation
|
|
||||||
|
|
||||||
onItemSelected(route);
|
|
||||||
|
|
||||||
Navigator.pushReplacementNamed(context, route);
|
|
||||||
},
|
|
||||||
child: Container(
|
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 10),
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: isSelected ? const Color(0x143B81F9) : Colors.transparent,
|
|
||||||
borderRadius: BorderRadius.circular(10),
|
borderRadius: BorderRadius.circular(10),
|
||||||
),
|
onTap: () async {
|
||||||
child: Row(
|
Navigator.pop(context);
|
||||||
children: [
|
|
||||||
Text(emoji, style: const TextStyle(fontSize: 18)),
|
selectedRoute.value = route; // ⭐ indicator ALWAYS updates
|
||||||
const SizedBox(width: 10),
|
|
||||||
Text(
|
if (ModalRoute.of(context)?.settings.name != route) {
|
||||||
title,
|
Navigator.pushReplacementNamed(context, route);
|
||||||
style: TextStyle(
|
}
|
||||||
fontWeight: isSelected ? FontWeight.w600 : FontWeight.normal,
|
},
|
||||||
color: isSelected ? const Color(0xFF3B81F9) : Colors.black87,
|
child: Container(
|
||||||
fontSize: 16,
|
decoration: BoxDecoration(
|
||||||
),
|
color: isSelected
|
||||||
|
? const Color(0x143B81F9)
|
||||||
|
: Colors.transparent,
|
||||||
|
borderRadius: BorderRadius.circular(10),
|
||||||
),
|
),
|
||||||
],
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
width: 4,
|
||||||
|
height: 48,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: isSelected
|
||||||
|
? const Color(0xFF3B81F9)
|
||||||
|
: Colors.transparent,
|
||||||
|
borderRadius: const BorderRadius.only(
|
||||||
|
topLeft: Radius.circular(10),
|
||||||
|
bottomLeft: Radius.circular(10),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(width: 8),
|
||||||
|
Text(emoji, style: const TextStyle(fontSize: 18)),
|
||||||
|
const SizedBox(width: 10),
|
||||||
|
Text(
|
||||||
|
title,
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: isSelected
|
||||||
|
? FontWeight.w600
|
||||||
|
: FontWeight.normal,
|
||||||
|
color: isSelected
|
||||||
|
? const Color(0xFF3B81F9)
|
||||||
|
: Colors.black87,
|
||||||
|
fontSize: 16,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
);
|
||||||
),
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -141,14 +141,28 @@ class _AccountScreenState extends ConsumerState<AccountScreen> {
|
|||||||
_row("Subscription", "growth_monthly"),
|
_row("Subscription", "growth_monthly"),
|
||||||
_row("Period", "24 Nov 2025 - 24 Dec 2025"),
|
_row("Period", "24 Nov 2025 - 24 Dec 2025"),
|
||||||
const SizedBox(height: 20),
|
const SizedBox(height: 20),
|
||||||
OutlinedButton(
|
ElevatedButton(
|
||||||
onPressed: () {},
|
onPressed: () {},
|
||||||
style: OutlinedButton.styleFrom(
|
style: ElevatedButton.styleFrom(
|
||||||
foregroundColor: Colors.red,
|
backgroundColor: const Color(
|
||||||
side: const BorderSide(color: Colors.red),
|
0xFFFF4C4C,
|
||||||
|
), // override global primary color
|
||||||
|
foregroundColor: Colors.white, // text color
|
||||||
|
elevation: 6,
|
||||||
|
shadowColor: Colors.black.withValues(alpha: 0.2),
|
||||||
|
shape: RoundedRectangleBorder(
|
||||||
|
borderRadius: BorderRadius.circular(12),
|
||||||
|
),
|
||||||
padding: const EdgeInsets.symmetric(vertical: 14),
|
padding: const EdgeInsets.symmetric(vertical: 14),
|
||||||
|
textStyle: const TextStyle(
|
||||||
|
fontSize: 15,
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 8),
|
||||||
|
child: const Text("Cancel Subscription"),
|
||||||
),
|
),
|
||||||
child: const Text("Cancel Subscription"),
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@ -233,9 +247,10 @@ class _AccountScreenState extends ConsumerState<AccountScreen> {
|
|||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Text(title,
|
Text(
|
||||||
style:
|
title,
|
||||||
const TextStyle(fontSize: 18, fontWeight: FontWeight.bold)),
|
style: const TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
|
||||||
|
),
|
||||||
const SizedBox(height: 16),
|
const SizedBox(height: 16),
|
||||||
child,
|
child,
|
||||||
],
|
],
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user