feat(ads): home/map banner slot (hidden when removed or unloaded)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -4,6 +4,7 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import '../../game/models/season.dart';
|
||||
import '../../state/providers.dart';
|
||||
import '../theme/palette.dart';
|
||||
import '../widgets/banner_ad_slot.dart';
|
||||
import '../widgets/map_layout.dart';
|
||||
import '../widgets/season_background.dart';
|
||||
import '../widgets/tile_painter.dart';
|
||||
@@ -74,100 +75,109 @@ class _JourneyMapState extends ConsumerState<_JourneyMap> {
|
||||
|
||||
return Scaffold(
|
||||
backgroundColor: Colors.transparent,
|
||||
body: Stack(
|
||||
fit: StackFit.expand,
|
||||
children: [
|
||||
SeasonBackground(theme: pack.theme),
|
||||
LayoutBuilder(
|
||||
builder: (context, constraints) {
|
||||
final layout = MapLayout(width: constraints.maxWidth);
|
||||
final count = pack.stages.length;
|
||||
if (!_autoScrolled) {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) =>
|
||||
_autoScrollTo(
|
||||
layout, unlocked, count, constraints.maxHeight));
|
||||
}
|
||||
return SingleChildScrollView(
|
||||
controller: _scroll,
|
||||
reverse: true,
|
||||
child: SizedBox(
|
||||
width: constraints.maxWidth,
|
||||
height: layout.heightFor(count),
|
||||
child: Stack(
|
||||
children: [
|
||||
CustomPaint(
|
||||
size: Size(
|
||||
constraints.maxWidth, layout.heightFor(count)),
|
||||
painter:
|
||||
_PathPainter(layout: layout, count: count),
|
||||
),
|
||||
for (var i = 0; i < count; i++)
|
||||
_node(
|
||||
context,
|
||||
layout,
|
||||
i,
|
||||
count,
|
||||
unlocked,
|
||||
repo.progressFor(pack.seasonId, ids[i])?.stars ?? 0,
|
||||
colors,
|
||||
seasonComplete,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
// Glass header.
|
||||
Positioned(
|
||||
top: 0,
|
||||
left: 0,
|
||||
right: 0,
|
||||
child: Container(
|
||||
padding: EdgeInsets.only(
|
||||
top: MediaQuery.of(context).padding.top + 6,
|
||||
bottom: 12,
|
||||
left: 8,
|
||||
right: 16,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
begin: Alignment.topCenter,
|
||||
end: Alignment.bottomCenter,
|
||||
colors: [
|
||||
Colors.black.withValues(alpha: 0.45),
|
||||
Colors.transparent,
|
||||
],
|
||||
),
|
||||
),
|
||||
child: Row(
|
||||
body: SafeArea(
|
||||
child: Column(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Stack(
|
||||
fit: StackFit.expand,
|
||||
children: [
|
||||
IconButton(
|
||||
icon: const Icon(Icons.arrow_back, color: Colors.white),
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
SeasonBackground(theme: pack.theme),
|
||||
LayoutBuilder(
|
||||
builder: (context, constraints) {
|
||||
final layout = MapLayout(width: constraints.maxWidth);
|
||||
final count = pack.stages.length;
|
||||
if (!_autoScrolled) {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) =>
|
||||
_autoScrollTo(
|
||||
layout, unlocked, count, constraints.maxHeight));
|
||||
}
|
||||
return SingleChildScrollView(
|
||||
controller: _scroll,
|
||||
reverse: true,
|
||||
child: SizedBox(
|
||||
width: constraints.maxWidth,
|
||||
height: layout.heightFor(count),
|
||||
child: Stack(
|
||||
children: [
|
||||
CustomPaint(
|
||||
size: Size(
|
||||
constraints.maxWidth, layout.heightFor(count)),
|
||||
painter:
|
||||
_PathPainter(layout: layout, count: count),
|
||||
),
|
||||
for (var i = 0; i < count; i++)
|
||||
_node(
|
||||
context,
|
||||
layout,
|
||||
i,
|
||||
count,
|
||||
unlocked,
|
||||
repo.progressFor(pack.seasonId, ids[i])?.stars ?? 0,
|
||||
colors,
|
||||
seasonComplete,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
Expanded(
|
||||
child: Text(
|
||||
pack.titleFor(locale),
|
||||
style: const TextStyle(
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.w800,
|
||||
color: Colors.white,
|
||||
// Glass header.
|
||||
Positioned(
|
||||
top: 0,
|
||||
left: 0,
|
||||
right: 0,
|
||||
child: Container(
|
||||
padding: const EdgeInsets.only(
|
||||
top: 6,
|
||||
bottom: 12,
|
||||
left: 8,
|
||||
right: 16,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
begin: Alignment.topCenter,
|
||||
end: Alignment.bottomCenter,
|
||||
colors: [
|
||||
Colors.black.withValues(alpha: 0.45),
|
||||
Colors.transparent,
|
||||
],
|
||||
),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
IconButton(
|
||||
icon: const Icon(Icons.arrow_back, color: Colors.white),
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
),
|
||||
Expanded(
|
||||
child: Text(
|
||||
pack.titleFor(locale),
|
||||
style: const TextStyle(
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.w800,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'★ $totalStars/${pack.stages.length * 3}',
|
||||
style: const TextStyle(
|
||||
color: Colors.amber,
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'★ $totalStars/${pack.stages.length * 3}',
|
||||
style: const TextStyle(
|
||||
color: Colors.amber,
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
const BannerAdSlot(),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user