feat: procedural season background with drifting petals

This commit is contained in:
2026-06-11 21:17:12 +09:00
parent d283bf6959
commit 6e4d3b60df
5 changed files with 222 additions and 45 deletions
+54 -45
View File
@@ -12,6 +12,7 @@ import '../widgets/board_painter.dart';
import '../widgets/board_widget.dart';
import '../widgets/hud_widget.dart';
import '../widgets/piece_painter.dart';
import '../widgets/season_background.dart';
import '../widgets/tray_widget.dart';
/// Renders whatever session [gameSessionProvider] holds; callers start the
@@ -140,56 +141,64 @@ class _GameScreenState extends ConsumerState<GameScreen> {
final draggedTopLeft = _draggedPieceTopLeft(view);
final boardBox = _boardBox;
final theme = ref.watch(activeThemeProvider);
return Scaffold(
body: SafeArea(
child: Stack(
key: _stackKey,
children: [
Padding(
padding: const EdgeInsets.all(16),
child: Column(
children: [
HudWidget(view: view),
Expanded(
child: Center(
child: BoardWidget(
key: _boardKey,
view: view,
ghost: ghost,
backgroundColor: Colors.transparent,
body: Stack(
fit: StackFit.expand,
children: [
SeasonBackground(theme: theme),
SafeArea(
child: Stack(
key: _stackKey,
children: [
Padding(
padding: const EdgeInsets.all(16),
child: Column(
children: [
HudWidget(view: view),
Expanded(
child: Center(
child: BoardWidget(
key: _boardKey,
view: view,
ghost: ghost,
),
),
),
TrayWidget(
tray: view.tray,
draggingIndex: _dragIndex,
onDragStart: (index, global) => setState(() {
_dragIndex = index;
_dragGlobal = global;
}),
onDragUpdate: (global) =>
setState(() => _dragGlobal = global),
onDragEnd: () => _onDragEnd(view),
),
],
),
),
if (_dragIndex != null &&
draggedTopLeft != null &&
boardBox != null &&
_dragIndex! < view.tray.length)
_draggedPieceOverlay(view, draggedTopLeft, boardBox),
if (view.phase != GamePhase.playing) _resultOverlay(view),
if (Navigator.of(context).canPop())
Positioned(
top: 4,
left: 4,
child: IconButton(
icon: const Icon(Icons.close, color: Colors.white54),
onPressed: () => Navigator.of(context).pop(),
),
),
TrayWidget(
tray: view.tray,
draggingIndex: _dragIndex,
onDragStart: (index, global) => setState(() {
_dragIndex = index;
_dragGlobal = global;
}),
onDragUpdate: (global) =>
setState(() => _dragGlobal = global),
onDragEnd: () => _onDragEnd(view),
),
],
),
],
),
if (_dragIndex != null &&
draggedTopLeft != null &&
boardBox != null &&
_dragIndex! < view.tray.length)
_draggedPieceOverlay(view, draggedTopLeft, boardBox),
if (view.phase != GamePhase.playing) _resultOverlay(view),
if (Navigator.of(context).canPop())
Positioned(
top: 4,
left: 4,
child: IconButton(
icon: const Icon(Icons.close, color: Colors.white54),
onPressed: () => Navigator.of(context).pop(),
),
),
],
),
),
],
),
);
}