feat(07-02): build SortDropdown widget and integrate into HomeScreen and TaskListScreen

- Create SortDropdown ConsumerWidget using PopupMenuButton<TaskSortOption>
- Displays current sort label with sort icon in AppBar actions
- Check mark shown on active option via Opacity widget
- Add Scaffold with AppBar (title: Übersicht, actions: SortDropdown) to HomeScreen
- Add SortDropdown before edit/delete IconButtons in TaskListScreen AppBar
This commit is contained in:
2026-03-16 22:37:18 +01:00
parent 9398193c1e
commit e5eccb74e5
3 changed files with 111 additions and 31 deletions

View File

@@ -4,6 +4,7 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:household_keeper/features/home/presentation/calendar_day_list.dart';
import 'package:household_keeper/features/home/presentation/calendar_providers.dart';
import 'package:household_keeper/features/home/presentation/calendar_strip.dart';
import 'package:household_keeper/features/tasks/presentation/sort_dropdown.dart';
import 'package:household_keeper/l10n/app_localizations.dart';
/// The app's primary screen: a horizontal calendar strip at the top with a
@@ -30,40 +31,46 @@ class _HomeScreenState extends ConsumerState<HomeScreen> {
Widget build(BuildContext context) {
final l10n = AppLocalizations.of(context);
return Stack(
children: [
Column(
children: [
CalendarStrip(
controller: _stripController,
onTodayVisibilityChanged: (visible) {
setState(() => _showTodayButton = !visible);
},
),
const Expanded(child: CalendarDayList()),
],
),
if (_showTodayButton)
Positioned(
bottom: 16,
left: 0,
right: 0,
child: Center(
child: FloatingActionButton.extended(
onPressed: () {
final now = DateTime.now();
final today = DateTime(now.year, now.month, now.day);
ref
.read(selectedDateProvider.notifier)
.selectDate(today);
_stripController.scrollToToday();
return Scaffold(
appBar: AppBar(
title: Text(l10n.tabHome),
actions: const [SortDropdown()],
),
body: Stack(
children: [
Column(
children: [
CalendarStrip(
controller: _stripController,
onTodayVisibilityChanged: (visible) {
setState(() => _showTodayButton = !visible);
},
icon: const Icon(Icons.today),
label: Text(l10n.calendarTodayButton),
),
const Expanded(child: CalendarDayList()),
],
),
if (_showTodayButton)
Positioned(
bottom: 16,
left: 0,
right: 0,
child: Center(
child: FloatingActionButton.extended(
onPressed: () {
final now = DateTime.now();
final today = DateTime(now.year, now.month, now.day);
ref
.read(selectedDateProvider.notifier)
.selectDate(today);
_stripController.scrollToToday();
},
icon: const Icon(Icons.today),
label: Text(l10n.calendarTodayButton),
),
),
),
),
],
],
),
);
}
}