After improving the design for the web part6
This commit is contained in:
parent
85aaa03491
commit
2efc1d0d20
@ -387,12 +387,15 @@ class _HomeScreenState extends State<HomeScreen> {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
const SizedBox(height: 12),
|
if ((_adsLoading && _heroAds.isEmpty) ||
|
||||||
HomeAdCarousel(
|
_heroAds.isNotEmpty) ...[
|
||||||
ads: _heroAds,
|
const SizedBox(height: 12),
|
||||||
loading: _adsLoading && _heroAds.isEmpty,
|
HomeAdCarousel(
|
||||||
),
|
ads: _heroAds,
|
||||||
const SizedBox(height: 22),
|
loading: _adsLoading && _heroAds.isEmpty,
|
||||||
|
),
|
||||||
|
const SizedBox(height: 22),
|
||||||
|
],
|
||||||
_SectionTitle(
|
_SectionTitle(
|
||||||
title: s.playNow,
|
title: s.playNow,
|
||||||
subtitle: s.playNowSubtitle,
|
subtitle: s.playNowSubtitle,
|
||||||
|
|||||||
@ -2,7 +2,6 @@ import 'dart:async';
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import '../../../../core/theme/app_colors.dart';
|
import '../../../../core/theme/app_colors.dart';
|
||||||
import '../../../../data/models/advertisement_models.dart';
|
import '../../../../data/models/advertisement_models.dart';
|
||||||
import '../../../../l10n/app_strings.dart';
|
|
||||||
import '../../../../shared/widgets/pred_skeleton.dart';
|
import '../../../../shared/widgets/pred_skeleton.dart';
|
||||||
import '../../utils/home_navigation.dart';
|
import '../../utils/home_navigation.dart';
|
||||||
|
|
||||||
@ -67,43 +66,14 @@ class _HomeAdCarouselState extends State<HomeAdCarousel> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final s = context.strings;
|
|
||||||
if (widget.ads.isNotEmpty) {
|
if (widget.ads.isNotEmpty) {
|
||||||
return _buildCarousel();
|
return _buildCarousel();
|
||||||
}
|
}
|
||||||
if (widget.loading) {
|
if (widget.loading) {
|
||||||
return const PredSkeletonCarousel(height: 168);
|
return const PredSkeletonCarousel(height: 168);
|
||||||
}
|
}
|
||||||
|
// No campaigns published → reclaim vertical space (no placeholder card).
|
||||||
final isDark = Theme.of(context).brightness == Brightness.dark;
|
return const SizedBox.shrink();
|
||||||
return Container(
|
|
||||||
height: 168,
|
|
||||||
padding: const EdgeInsets.all(24),
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
borderRadius: BorderRadius.circular(22),
|
|
||||||
gradient: LinearGradient(
|
|
||||||
begin: Alignment.topLeft,
|
|
||||||
end: Alignment.bottomRight,
|
|
||||||
colors: [
|
|
||||||
AppColors.primary.withValues(alpha: isDark ? 0.22 : 0.14),
|
|
||||||
isDark ? AppColors.surfaceCard : Colors.white,
|
|
||||||
],
|
|
||||||
),
|
|
||||||
border: Border.all(
|
|
||||||
color: isDark ? AppColors.border : const Color(0xFFE2E8F0),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
alignment: Alignment.center,
|
|
||||||
child: Text(
|
|
||||||
s.promotionsComingSoon,
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
|
|
||||||
color: isDark
|
|
||||||
? AppColors.textSecondary
|
|
||||||
: const Color(0xFF475569),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildCarousel() {
|
Widget _buildCarousel() {
|
||||||
|
|||||||
@ -522,14 +522,21 @@ class _WelcomeScreenState extends State<WelcomeScreen> {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
).animate().fadeIn(duration: 400.ms).slideY(begin: 0.04, end: 0),
|
).animate().fadeIn(duration: 400.ms).slideY(begin: 0.04, end: 0),
|
||||||
const SizedBox(height: 18),
|
if ((_adsLoading &&
|
||||||
// Soft-fail ads: empty/placeholder carousel, never a connection banner.
|
_heroAds.isEmpty &&
|
||||||
HomeAdCarousel(
|
_adsError == null) ||
|
||||||
ads: _heroAds,
|
_heroAds.isNotEmpty) ...[
|
||||||
loading: _adsLoading && _heroAds.isEmpty && _adsError == null,
|
const SizedBox(height: 18),
|
||||||
onAdTap: (_) => _goLogin(),
|
// Soft-fail ads: never a connection banner; hide when none published.
|
||||||
),
|
HomeAdCarousel(
|
||||||
const SizedBox(height: 22),
|
ads: _heroAds,
|
||||||
|
loading: _adsLoading &&
|
||||||
|
_heroAds.isEmpty &&
|
||||||
|
_adsError == null,
|
||||||
|
onAdTap: (_) => _goLogin(),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 22),
|
||||||
|
],
|
||||||
Text(
|
Text(
|
||||||
s.welcomeGamesTitle,
|
s.welcomeGamesTitle,
|
||||||
style: Theme.of(context).textTheme.titleMedium?.copyWith(
|
style: Theme.of(context).textTheme.titleMedium?.copyWith(
|
||||||
|
|||||||
@ -251,8 +251,8 @@ void main() {
|
|||||||
await tester.pump();
|
await tester.pump();
|
||||||
await tester.pump(const Duration(milliseconds: 500));
|
await tester.pump(const Duration(milliseconds: 500));
|
||||||
|
|
||||||
// Soft-fail: empty promo placeholder, games remain; no ads SectionError.
|
// Soft-fail: ads band hidden (no placeholder), games remain; no ads SectionError.
|
||||||
expect(find.textContaining('promotions coming soon'), findsOneWidget);
|
expect(find.textContaining('promotions coming soon'), findsNothing);
|
||||||
expect(find.text('Candle Predict'), findsOneWidget);
|
expect(find.text('Candle Predict'), findsOneWidget);
|
||||||
expect(find.byKey(const Key('home_deposit_shortcut')), findsOneWidget);
|
expect(find.byKey(const Key('home_deposit_shortcut')), findsOneWidget);
|
||||||
});
|
});
|
||||||
|
|||||||
@ -58,14 +58,17 @@ export function LandingPage() {
|
|||||||
|
|
||||||
useScrollReveal();
|
useScrollReveal();
|
||||||
|
|
||||||
|
const hasCampaigns = (heroQ.data?.length ?? 0) > 0;
|
||||||
|
const showCampaigns = heroQ.isLoading || hasCampaigns;
|
||||||
|
|
||||||
const navItems = useMemo(
|
const navItems = useMemo(
|
||||||
() => [
|
() => [
|
||||||
{ id: 'offers', label: t('landing.nav.offers') },
|
...(hasCampaigns ? [{ id: 'offers', label: t('landing.nav.offers') }] : []),
|
||||||
{ id: 'games', label: t('landing.nav.games') },
|
{ id: 'games', label: t('landing.nav.games') },
|
||||||
{ id: 'live', label: t('landing.nav.live') },
|
{ id: 'live', label: t('landing.nav.live') },
|
||||||
{ id: 'why', label: t('landing.nav.why') },
|
{ id: 'why', label: t('landing.nav.why') },
|
||||||
],
|
],
|
||||||
[t]
|
[t, hasCampaigns]
|
||||||
);
|
);
|
||||||
|
|
||||||
const whyItems = [
|
const whyItems = [
|
||||||
@ -99,10 +102,12 @@ export function LandingPage() {
|
|||||||
|
|
||||||
<LandingHero />
|
<LandingHero />
|
||||||
|
|
||||||
{/* Campaigns — carousel of all hero ads (parity with mobile) */}
|
{/* Campaigns — hidden entirely when none are published */}
|
||||||
<section id="offers" className="tl-offers tl-reveal" style={{ scrollMarginTop: 96 }}>
|
{showCampaigns && (
|
||||||
<LandingOffersCarousel ads={heroQ.data ?? []} loading={heroQ.isLoading} />
|
<section id="offers" className="tl-offers tl-reveal" style={{ scrollMarginTop: 96 }}>
|
||||||
</section>
|
<LandingOffersCarousel ads={heroQ.data ?? []} loading={heroQ.isLoading} />
|
||||||
|
</section>
|
||||||
|
)}
|
||||||
|
|
||||||
<LandingGamePeek games={gamesQ.data ?? []} loading={gamesQ.isLoading} />
|
<LandingGamePeek games={gamesQ.data ?? []} loading={gamesQ.isLoading} />
|
||||||
|
|
||||||
|
|||||||
@ -56,7 +56,7 @@ export function LandingOffersCarousel({ ads, loading }: LandingOffersCarouselPro
|
|||||||
[count]
|
[count]
|
||||||
);
|
);
|
||||||
|
|
||||||
if (loading) {
|
if (loading && count === 0) {
|
||||||
return (
|
return (
|
||||||
<div className="tl-offers-carousel tl-offers-carousel--loading" aria-busy>
|
<div className="tl-offers-carousel tl-offers-carousel--loading" aria-busy>
|
||||||
<div className="tl-offers-carousel__skeleton" />
|
<div className="tl-offers-carousel__skeleton" />
|
||||||
@ -65,14 +65,8 @@ export function LandingOffersCarousel({ ads, loading }: LandingOffersCarouselPro
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (count === 0) {
|
if (count === 0) {
|
||||||
return (
|
// No campaigns → reclaim the whole band (no empty placeholder).
|
||||||
<div className="tl-offers-carousel tl-offers-carousel--empty">
|
return null;
|
||||||
<div className="tl-container tl-offers-carousel__empty-inner">
|
|
||||||
<h2 className="tl-display tl-offers__title">{t('landing.offers.title')}</h2>
|
|
||||||
<p className="tl-offers__sub">{t('landing.offers.empty')}</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const ad = ads[index];
|
const ad = ads[index];
|
||||||
|
|||||||
@ -507,22 +507,11 @@
|
|||||||
background: var(--tl-emerald-bright);
|
background: var(--tl-emerald-bright);
|
||||||
}
|
}
|
||||||
|
|
||||||
.tl-offers-carousel--loading .tl-offers-carousel__skeleton,
|
.tl-offers-carousel--loading .tl-offers-carousel__skeleton {
|
||||||
.tl-offers-carousel--empty .tl-offers-carousel__empty-inner {
|
min-height: clamp(160px, 22vh, 240px);
|
||||||
min-height: clamp(200px, 28vh, 300px);
|
|
||||||
border-radius: 28px;
|
border-radius: 28px;
|
||||||
border: 1px solid var(--tl-line);
|
border: 1px solid var(--tl-line);
|
||||||
background: rgba(255, 255, 255, 0.03);
|
background: rgba(255, 255, 255, 0.03);
|
||||||
}
|
|
||||||
|
|
||||||
.tl-offers-carousel--empty .tl-offers-carousel__empty-inner {
|
|
||||||
display: grid;
|
|
||||||
gap: 0.75rem;
|
|
||||||
align-content: center;
|
|
||||||
padding: clamp(1.5rem, 4vw, 2.5rem) 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.tl-offers-carousel__skeleton {
|
|
||||||
animation: tl-glow 2.4s ease-in-out infinite;
|
animation: tl-glow 2.4s ease-in-out infinite;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -532,14 +521,19 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.tl-offers-carousel__stage {
|
.tl-offers-carousel__stage {
|
||||||
min-height: clamp(240px, 28vh, 320px);
|
min-height: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.tl-offers-carousel__copy {
|
.tl-offers-carousel__copy {
|
||||||
max-width: 36rem;
|
max-width: 40rem;
|
||||||
min-height: clamp(240px, 28vh, 320px);
|
min-height: 0;
|
||||||
align-content: end;
|
align-content: start;
|
||||||
padding: clamp(1.75rem, 3vw, 2.75rem) clamp(1.75rem, 3vw, 2.5rem);
|
padding: 1.75rem 1.85rem 1.85rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Keep copy clear of the absolute prev/next controls (42px + gutters). */
|
||||||
|
.tl-offers-carousel__stage:has(.tl-offers-carousel__nav) .tl-offers-carousel__copy {
|
||||||
|
padding-inline: 4.25rem;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user