Skip to content

Commit f57ad41

Browse files
committed
toggle button
1 parent 13a146a commit f57ad41

File tree

1 file changed

+31
-30
lines changed

1 file changed

+31
-30
lines changed

lib/app/modules/home/views/filter_drawer_home_page.dart

Lines changed: 31 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -420,44 +420,45 @@ class FilterDrawer extends StatelessWidget {
420420
),
421421
),
422422
const SizedBox(width: 12),
423-
// Toggle switch with + and - labels
424-
Row(
425-
children: [
426-
Text(
427-
'+',
428-
style: TextStyle(
429-
fontFamily: FontFamily.poppins,
430-
fontSize: TaskWarriorFonts.fontSizeMedium,
431-
fontWeight: FontWeight.bold,
432-
color: tColors.primaryTextColor,
433-
),
434-
),
435-
Switch(
436-
value: !isAscending,
437-
onChanged: selectedCategory != null
438-
? (bool value) {
439-
if (value) {
440-
// Switch to descending (-)
441-
homeController
442-
.selectSort('$selectedCategory-');
443-
} else {
444-
// Switch to ascending (+)
445-
homeController
446-
.selectSort('$selectedCategory+');
447-
}
423+
// Toggle button with + and - text
424+
SizedBox(
425+
width: 48,
426+
height: 48,
427+
child: ElevatedButton(
428+
onPressed: selectedCategory != null
429+
? () {
430+
if (isAscending) {
431+
// Switch to descending (-)
432+
homeController
433+
.selectSort('$selectedCategory-');
434+
} else {
435+
// Switch to ascending (+)
436+
homeController
437+
.selectSort('$selectedCategory+');
448438
}
449-
: null,
439+
}
440+
: null,
441+
style: ElevatedButton.styleFrom(
442+
padding: EdgeInsets.zero,
443+
backgroundColor: tColors.primaryBackgroundColor,
444+
foregroundColor: tColors.primaryTextColor,
445+
shape: RoundedRectangleBorder(
446+
borderRadius: BorderRadius.circular(8),
447+
side: BorderSide(
448+
color: TaskWarriorColors.borderColor,
449+
),
450+
),
450451
),
451-
Text(
452-
'-',
452+
child: Text(
453+
isAscending ? '+' : '-',
453454
style: TextStyle(
454455
fontFamily: FontFamily.poppins,
455-
fontSize: TaskWarriorFonts.fontSizeMedium,
456+
fontSize: TaskWarriorFonts.fontSizeExtraLarge,
456457
fontWeight: FontWeight.bold,
457458
color: tColors.primaryTextColor,
458459
),
459460
),
460-
],
461+
),
461462
),
462463
],
463464
);

0 commit comments

Comments
 (0)