feat: redesigned home with adventure/classic entries and endless best
Add adventure/classic l10n keys; rewrite HomeScreen with SeasonBackground, 2×2 glossy logo mark, Adventure→SeasonMap + Classic→endless GameScreen buttons, and conditional best-score caption. Update widget_test assertions accordingly. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+3
-1
@@ -52,5 +52,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"newBest": "NEW BEST!"
|
"newBest": "NEW BEST!",
|
||||||
|
"adventure": "Adventure",
|
||||||
|
"classic": "Classic"
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-1
@@ -24,5 +24,7 @@
|
|||||||
"tutorialHud": "이동 횟수가 끝나기 전에 목표를 달성하세요. 이제 직접!",
|
"tutorialHud": "이동 횟수가 끝나기 전에 목표를 달성하세요. 이제 직접!",
|
||||||
"gameOver": "게임 오버",
|
"gameOver": "게임 오버",
|
||||||
"bestScore": "최고 {score}",
|
"bestScore": "최고 {score}",
|
||||||
"newBest": "신기록!"
|
"newBest": "신기록!",
|
||||||
|
"adventure": "어드벤처",
|
||||||
|
"classic": "클래식"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,31 +1,52 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
|
|
||||||
|
import '../../game/models/season.dart';
|
||||||
|
import '../../game/models/stage.dart';
|
||||||
import '../../l10n/gen/app_localizations.dart';
|
import '../../l10n/gen/app_localizations.dart';
|
||||||
import '../../state/providers.dart';
|
import '../../state/providers.dart';
|
||||||
|
import '../widgets/season_background.dart';
|
||||||
|
import 'game_screen.dart';
|
||||||
import 'season_map_screen.dart';
|
import 'season_map_screen.dart';
|
||||||
|
|
||||||
class HomeScreen extends ConsumerWidget {
|
class HomeScreen extends ConsumerWidget {
|
||||||
const HomeScreen({super.key});
|
const HomeScreen({super.key});
|
||||||
|
|
||||||
|
static const _logoColors = [
|
||||||
|
Color(0xFFFF7EB3),
|
||||||
|
Color(0xFFFFD166),
|
||||||
|
Color(0xFF6FCDF5),
|
||||||
|
Color(0xFF7EDB9C),
|
||||||
|
];
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context, WidgetRef ref) {
|
Widget build(BuildContext context, WidgetRef ref) {
|
||||||
final l10n = AppLocalizations.of(context)!;
|
final l10n = AppLocalizations.of(context)!;
|
||||||
final streak = ref.watch(streakProvider);
|
final streak = ref.watch(streakProvider);
|
||||||
|
final best = ref.watch(endlessBestProvider);
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
body: SafeArea(
|
backgroundColor: Colors.transparent,
|
||||||
|
body: Stack(
|
||||||
|
fit: StackFit.expand,
|
||||||
|
children: [
|
||||||
|
const SeasonBackground(theme: SeasonTheme.fallback),
|
||||||
|
SafeArea(
|
||||||
child: Center(
|
child: Center(
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
|
_logoMark(),
|
||||||
|
const SizedBox(height: 18),
|
||||||
Text(
|
Text(
|
||||||
l10n.appTitle,
|
l10n.appTitle,
|
||||||
style: Theme.of(context).textTheme.displaySmall?.copyWith(
|
style: Theme.of(context)
|
||||||
fontWeight: FontWeight.bold,
|
.textTheme
|
||||||
),
|
.displaySmall
|
||||||
|
?.copyWith(fontWeight: FontWeight.w900),
|
||||||
),
|
),
|
||||||
if (streak.current > 0) ...[
|
if (streak.current > 0) ...[
|
||||||
const SizedBox(height: 12),
|
const SizedBox(height: 10),
|
||||||
Chip(
|
Chip(
|
||||||
avatar: const Icon(
|
avatar: const Icon(
|
||||||
Icons.local_fire_department,
|
Icons.local_fire_department,
|
||||||
@@ -38,28 +59,90 @@ class HomeScreen extends ConsumerWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
const SizedBox(height: 48),
|
const SizedBox(height: 44),
|
||||||
FilledButton(
|
FilledButton(
|
||||||
style: FilledButton.styleFrom(
|
style: FilledButton.styleFrom(
|
||||||
padding: const EdgeInsets.symmetric(
|
padding: const EdgeInsets.symmetric(
|
||||||
horizontal: 48,
|
horizontal: 56, vertical: 18),
|
||||||
vertical: 16,
|
|
||||||
),
|
|
||||||
textStyle: Theme.of(context).textTheme.titleLarge,
|
textStyle: Theme.of(context).textTheme.titleLarge,
|
||||||
),
|
),
|
||||||
onPressed: () {
|
onPressed: () => Navigator.of(context).push(
|
||||||
Navigator.of(context).push(
|
|
||||||
MaterialPageRoute(
|
MaterialPageRoute(
|
||||||
builder: (_) => const SeasonMapScreen(),
|
builder: (_) => const SeasonMapScreen()),
|
||||||
|
),
|
||||||
|
child: Text(l10n.adventure),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 14),
|
||||||
|
OutlinedButton(
|
||||||
|
style: OutlinedButton.styleFrom(
|
||||||
|
padding: const EdgeInsets.symmetric(
|
||||||
|
horizontal: 40, vertical: 14),
|
||||||
|
textStyle: Theme.of(context).textTheme.titleMedium,
|
||||||
|
),
|
||||||
|
onPressed: () {
|
||||||
|
ref.read(gameSessionProvider.notifier).startStage(
|
||||||
|
StageConfig.endless(
|
||||||
|
seed: DateTime.now().millisecondsSinceEpoch,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
Navigator.of(context).push(
|
||||||
|
MaterialPageRoute(
|
||||||
|
builder: (_) => const GameScreen()),
|
||||||
|
);
|
||||||
},
|
},
|
||||||
child: Text(l10n.play),
|
child: Text(l10n.classic),
|
||||||
),
|
),
|
||||||
|
if (best > 0) ...[
|
||||||
|
const SizedBox(height: 10),
|
||||||
|
Text(
|
||||||
|
l10n.bestScore(best),
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors.white.withValues(alpha: 0.55),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _logoMark() {
|
||||||
|
return SizedBox(
|
||||||
|
width: 96,
|
||||||
|
height: 96,
|
||||||
|
child: GridView.count(
|
||||||
|
crossAxisCount: 2,
|
||||||
|
mainAxisSpacing: 5,
|
||||||
|
crossAxisSpacing: 5,
|
||||||
|
physics: const NeverScrollableScrollPhysics(),
|
||||||
|
children: [
|
||||||
|
for (final color in _logoColors)
|
||||||
|
DecoratedBox(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
borderRadius: BorderRadius.circular(11),
|
||||||
|
gradient: LinearGradient(
|
||||||
|
begin: Alignment.topLeft,
|
||||||
|
end: Alignment.bottomRight,
|
||||||
|
colors: [
|
||||||
|
Color.lerp(color, Colors.white, 0.28)!,
|
||||||
|
color,
|
||||||
|
Color.lerp(color, Colors.black, 0.22)!,
|
||||||
|
],
|
||||||
|
),
|
||||||
|
boxShadow: [
|
||||||
|
BoxShadow(
|
||||||
|
color: color.withValues(alpha: 0.45),
|
||||||
|
blurRadius: 14,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ void main() {
|
|||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
|
|
||||||
expect(find.text('Block Seasons'), findsOneWidget);
|
expect(find.text('Block Seasons'), findsOneWidget);
|
||||||
expect(find.text('Play'), findsOneWidget);
|
expect(find.text('Adventure'), findsOneWidget);
|
||||||
|
expect(find.text('Classic'), findsOneWidget);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user