2026-02-25 11:10:32 +08:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:lucide_icons/lucide_icons.dart';
|
2026-03-27 19:07:39 +08:00
|
|
|
|
|
|
|
|
import '../../core/theme/design_tokens.dart';
|
2026-02-25 11:10:32 +08:00
|
|
|
|
|
|
|
|
enum DockTab { todo, calendar }
|
|
|
|
|
|
|
|
|
|
class BottomDock extends StatelessWidget {
|
|
|
|
|
final DockTab activeTab;
|
|
|
|
|
final VoidCallback? onTodoTap;
|
|
|
|
|
final VoidCallback? onCalendarTap;
|
|
|
|
|
final VoidCallback? onHomeTap;
|
|
|
|
|
|
|
|
|
|
const BottomDock({
|
|
|
|
|
super.key,
|
|
|
|
|
required this.activeTab,
|
|
|
|
|
this.onTodoTap,
|
|
|
|
|
this.onCalendarTap,
|
|
|
|
|
this.onHomeTap,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
2026-03-27 19:07:39 +08:00
|
|
|
final colorScheme = Theme.of(context).colorScheme;
|
2026-02-25 11:10:32 +08:00
|
|
|
return Container(
|
2026-02-27 18:36:21 +08:00
|
|
|
height: 72,
|
|
|
|
|
padding: const EdgeInsets.only(
|
|
|
|
|
left: AppSpacing.xl,
|
|
|
|
|
right: AppSpacing.xl,
|
|
|
|
|
top: AppSpacing.md,
|
2026-03-20 19:00:24 +08:00
|
|
|
bottom: AppSpacing.sm,
|
2026-02-27 18:36:21 +08:00
|
|
|
),
|
2026-02-25 11:10:32 +08:00
|
|
|
child: Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
2026-03-16 16:11:28 +08:00
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
2026-03-27 19:07:39 +08:00
|
|
|
children: [
|
|
|
|
|
_buildToggle(context, colorScheme),
|
|
|
|
|
_buildHomeBtn(context, colorScheme),
|
|
|
|
|
],
|
2026-02-25 11:10:32 +08:00
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-27 19:07:39 +08:00
|
|
|
Widget _buildToggle(BuildContext context, ColorScheme colorScheme) {
|
2026-02-25 11:10:32 +08:00
|
|
|
return Container(
|
|
|
|
|
padding: const EdgeInsets.symmetric(horizontal: 5, vertical: 4),
|
|
|
|
|
decoration: BoxDecoration(
|
2026-03-27 19:07:39 +08:00
|
|
|
color: colorScheme.surfaceContainerLow,
|
2026-02-27 18:36:21 +08:00
|
|
|
borderRadius: BorderRadius.circular(AppRadius.xxl),
|
2026-03-27 19:07:39 +08:00
|
|
|
border: Border.all(color: colorScheme.outlineVariant),
|
2026-03-16 16:11:28 +08:00
|
|
|
boxShadow: [
|
|
|
|
|
BoxShadow(
|
2026-03-27 19:07:39 +08:00
|
|
|
color: colorScheme.shadow.withValues(alpha: 0.12),
|
2026-03-16 16:11:28 +08:00
|
|
|
blurRadius: AppRadius.sm,
|
|
|
|
|
offset: const Offset(0, AppSpacing.xs / 2),
|
|
|
|
|
),
|
|
|
|
|
],
|
2026-02-25 11:10:32 +08:00
|
|
|
),
|
|
|
|
|
child: Row(
|
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
2026-03-16 16:11:28 +08:00
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
2026-02-25 11:10:32 +08:00
|
|
|
children: [
|
|
|
|
|
_buildToggleItem(
|
|
|
|
|
icon: LucideIcons.listTodo,
|
|
|
|
|
isActive: activeTab == DockTab.todo,
|
|
|
|
|
onTap: onTodoTap,
|
2026-03-27 19:07:39 +08:00
|
|
|
colorScheme: colorScheme,
|
2026-02-25 11:10:32 +08:00
|
|
|
),
|
|
|
|
|
const SizedBox(width: 4),
|
|
|
|
|
_buildToggleItem(
|
|
|
|
|
icon: LucideIcons.calendar,
|
|
|
|
|
isActive: activeTab == DockTab.calendar,
|
|
|
|
|
onTap: onCalendarTap,
|
2026-03-27 19:07:39 +08:00
|
|
|
colorScheme: colorScheme,
|
2026-02-25 11:10:32 +08:00
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Widget _buildToggleItem({
|
|
|
|
|
required IconData icon,
|
|
|
|
|
required bool isActive,
|
2026-03-27 19:07:39 +08:00
|
|
|
required ColorScheme colorScheme,
|
2026-02-25 11:10:32 +08:00
|
|
|
VoidCallback? onTap,
|
|
|
|
|
}) {
|
2026-03-16 16:11:28 +08:00
|
|
|
return Material(
|
2026-03-27 19:07:39 +08:00
|
|
|
color: colorScheme.surface.withValues(alpha: 0),
|
2026-03-16 16:11:28 +08:00
|
|
|
child: InkWell(
|
|
|
|
|
onTap: onTap,
|
|
|
|
|
borderRadius: BorderRadius.circular(AppRadius.xl),
|
|
|
|
|
child: AnimatedContainer(
|
|
|
|
|
duration: const Duration(milliseconds: 140),
|
|
|
|
|
curve: Curves.easeOut,
|
|
|
|
|
width: 44,
|
|
|
|
|
height: 44,
|
|
|
|
|
decoration: BoxDecoration(
|
2026-03-27 19:07:39 +08:00
|
|
|
color: isActive
|
|
|
|
|
? colorScheme.secondaryContainer
|
|
|
|
|
: colorScheme.surface.withValues(alpha: 0),
|
2026-03-16 16:11:28 +08:00
|
|
|
borderRadius: BorderRadius.circular(AppRadius.xl),
|
|
|
|
|
border: Border.all(
|
|
|
|
|
color: isActive
|
2026-03-27 19:07:39 +08:00
|
|
|
? colorScheme.primary.withValues(alpha: 0.35)
|
|
|
|
|
: colorScheme.surface.withValues(alpha: 0),
|
2026-03-16 16:11:28 +08:00
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
child: Icon(
|
|
|
|
|
icon,
|
|
|
|
|
size: 20,
|
2026-03-27 19:07:39 +08:00
|
|
|
color: isActive
|
|
|
|
|
? colorScheme.primary
|
|
|
|
|
: colorScheme.onSurfaceVariant,
|
2026-02-25 11:10:32 +08:00
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-27 19:07:39 +08:00
|
|
|
Widget _buildHomeBtn(BuildContext context, ColorScheme colorScheme) {
|
2026-03-16 16:11:28 +08:00
|
|
|
return Material(
|
2026-03-27 19:07:39 +08:00
|
|
|
color: colorScheme.surface.withValues(alpha: 0),
|
2026-03-16 16:11:28 +08:00
|
|
|
child: InkWell(
|
2026-03-20 15:31:08 +08:00
|
|
|
key: const ValueKey('bottom_dock_home_button'),
|
2026-03-16 16:11:28 +08:00
|
|
|
onTap: onHomeTap,
|
|
|
|
|
borderRadius: BorderRadius.circular(AppRadius.xl),
|
|
|
|
|
child: Container(
|
|
|
|
|
width: 44,
|
|
|
|
|
height: 44,
|
|
|
|
|
decoration: BoxDecoration(
|
2026-03-27 19:07:39 +08:00
|
|
|
color: colorScheme.surfaceContainerLow,
|
2026-03-16 16:11:28 +08:00
|
|
|
borderRadius: BorderRadius.circular(AppRadius.xl),
|
2026-03-27 19:07:39 +08:00
|
|
|
border: Border.all(color: colorScheme.outlineVariant),
|
2026-03-16 16:11:28 +08:00
|
|
|
boxShadow: [
|
|
|
|
|
BoxShadow(
|
2026-03-27 19:07:39 +08:00
|
|
|
color: colorScheme.shadow.withValues(alpha: 0.12),
|
2026-03-16 16:11:28 +08:00
|
|
|
blurRadius: AppRadius.sm,
|
|
|
|
|
offset: const Offset(0, AppSpacing.xs / 2),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
2026-03-27 19:07:39 +08:00
|
|
|
child: Icon(
|
2026-03-16 16:11:28 +08:00
|
|
|
LucideIcons.home,
|
|
|
|
|
size: 20,
|
2026-03-27 19:07:39 +08:00
|
|
|
color: colorScheme.onSurfaceVariant,
|
2026-03-16 16:11:28 +08:00
|
|
|
),
|
2026-02-25 11:10:32 +08:00
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|