Adds sleep/energy/positivity/self-worth tracking columns to the database (schema v2 migration), a new 5-option StepScale widget, per-answer chips at the top of the screen, a 2×2 activity grid chip, and a full step-by-step wizard flow: mood → sleep (first entry today only) → energy → positivity → self-worth → activities → review+save.
42 lines
1.4 KiB
Dart
42 lines
1.4 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|
import '../../core/providers/activity_provider.dart';
|
|
|
|
class ActivityGrid extends ConsumerWidget {
|
|
const ActivityGrid({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context, WidgetRef ref) {
|
|
final activitiesAsync = ref.watch(activitiesProvider);
|
|
final selected = ref.watch(selectedActivitiesProvider);
|
|
|
|
return activitiesAsync.when(
|
|
data: (activities) => Wrap(
|
|
spacing: 8,
|
|
runSpacing: 8,
|
|
children: activities.map((a) {
|
|
final isSelected = selected.contains(a.id);
|
|
return FilterChip(
|
|
avatar: Text(
|
|
String.fromCharCode(a.iconCodepoint),
|
|
style: const TextStyle(fontFamily: 'MaterialIcons'),
|
|
),
|
|
label: Text(a.name),
|
|
selected: isSelected,
|
|
onSelected: (_) =>
|
|
ref.read(selectedActivitiesProvider.notifier).toggle(a.id),
|
|
selectedColor: Color(
|
|
int.parse(a.colourHex.replaceFirst('#', '0xFF')),
|
|
).withOpacity(0.2),
|
|
checkmarkColor: Color(
|
|
int.parse(a.colourHex.replaceFirst('#', '0xFF')),
|
|
),
|
|
);
|
|
}).toList(),
|
|
),
|
|
loading: () => const Center(child: CircularProgressIndicator()),
|
|
error: (e, _) => Text('Error loading activities: $e'),
|
|
);
|
|
}
|
|
}
|