checkpoint: focus seed 1.0.1 localized dev switch
This commit is contained in:
@@ -0,0 +1,99 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../core/date_keys.dart';
|
||||
import '../../../l10n/l10n.dart';
|
||||
import '../../../models/app_state.dart';
|
||||
import '../../../models/growth_stage.dart';
|
||||
import '../../../widgets/surface_panel.dart';
|
||||
|
||||
class GrowthWeekStrip extends StatelessWidget {
|
||||
const GrowthWeekStrip({required this.state, super.key});
|
||||
|
||||
final AppState state;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final days = lastSevenDateKeys();
|
||||
final l10n = context.l10n;
|
||||
return SurfacePanel(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
l10n.sevenDayGrowth,
|
||||
style: Theme.of(context).textTheme.titleMedium,
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
l10n.sevenDayGrowthSubtitle,
|
||||
style: Theme.of(context).textTheme.bodySmall?.copyWith(
|
||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 14),
|
||||
Row(
|
||||
children: [
|
||||
for (final day in days)
|
||||
Expanded(
|
||||
child: _GrowthDay(
|
||||
day: day,
|
||||
stage: growthStageFor(state, day),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _GrowthDay extends StatelessWidget {
|
||||
const _GrowthDay({required this.day, required this.stage});
|
||||
|
||||
final String day;
|
||||
final GrowthStage stage;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final theme = Theme.of(context);
|
||||
final l10n = context.l10n;
|
||||
final icon = switch (stage) {
|
||||
GrowthStage.seed => Icons.circle_outlined,
|
||||
GrowthStage.sprout => Icons.grass_rounded,
|
||||
GrowthStage.leaves => Icons.eco_rounded,
|
||||
GrowthStage.flower => Icons.local_florist_rounded,
|
||||
};
|
||||
return Semantics(
|
||||
label: l10n.growthDaySemantic(
|
||||
day.substring(5),
|
||||
localizedGrowthStage(l10n, stage),
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
Container(
|
||||
width: 36,
|
||||
height: 36,
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color:
|
||||
stage == GrowthStage.seed
|
||||
? theme.colorScheme.surfaceContainer
|
||||
: theme.colorScheme.primary.withValues(alpha: 0.14),
|
||||
),
|
||||
child: Icon(
|
||||
icon,
|
||||
size: 19,
|
||||
color:
|
||||
stage == GrowthStage.seed
|
||||
? theme.colorScheme.onSurfaceVariant
|
||||
: theme.colorScheme.primary,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 5),
|
||||
Text(day.substring(8), style: theme.textTheme.labelSmall),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user