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> {
|
||||
);
|
||||
},
|
||||
),
|
||||
if ((_adsLoading && _heroAds.isEmpty) ||
|
||||
_heroAds.isNotEmpty) ...[
|
||||
const SizedBox(height: 12),
|
||||
HomeAdCarousel(
|
||||
ads: _heroAds,
|
||||
loading: _adsLoading && _heroAds.isEmpty,
|
||||
),
|
||||
const SizedBox(height: 22),
|
||||
],
|
||||
_SectionTitle(
|
||||
title: s.playNow,
|
||||
subtitle: s.playNowSubtitle,
|
||||
|
||||
@ -2,7 +2,6 @@ import 'dart:async';
|
||||
import 'package:flutter/material.dart';
|
||||
import '../../../../core/theme/app_colors.dart';
|
||||
import '../../../../data/models/advertisement_models.dart';
|
||||
import '../../../../l10n/app_strings.dart';
|
||||
import '../../../../shared/widgets/pred_skeleton.dart';
|
||||
import '../../utils/home_navigation.dart';
|
||||
|
||||
@ -67,43 +66,14 @@ class _HomeAdCarouselState extends State<HomeAdCarousel> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final s = context.strings;
|
||||
if (widget.ads.isNotEmpty) {
|
||||
return _buildCarousel();
|
||||
}
|
||||
if (widget.loading) {
|
||||
return const PredSkeletonCarousel(height: 168);
|
||||
}
|
||||
|
||||
final isDark = Theme.of(context).brightness == Brightness.dark;
|
||||
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),
|
||||
),
|
||||
),
|
||||
);
|
||||
// No campaigns published → reclaim vertical space (no placeholder card).
|
||||
return const SizedBox.shrink();
|
||||
}
|
||||
|
||||
Widget _buildCarousel() {
|
||||
|
||||
@ -522,14 +522,21 @@ class _WelcomeScreenState extends State<WelcomeScreen> {
|
||||
],
|
||||
),
|
||||
).animate().fadeIn(duration: 400.ms).slideY(begin: 0.04, end: 0),
|
||||
if ((_adsLoading &&
|
||||
_heroAds.isEmpty &&
|
||||
_adsError == null) ||
|
||||
_heroAds.isNotEmpty) ...[
|
||||
const SizedBox(height: 18),
|
||||
// Soft-fail ads: empty/placeholder carousel, never a connection banner.
|
||||
// Soft-fail ads: never a connection banner; hide when none published.
|
||||
HomeAdCarousel(
|
||||
ads: _heroAds,
|
||||
loading: _adsLoading && _heroAds.isEmpty && _adsError == null,
|
||||
loading: _adsLoading &&
|
||||
_heroAds.isEmpty &&
|
||||
_adsError == null,
|
||||
onAdTap: (_) => _goLogin(),
|
||||
),
|
||||
const SizedBox(height: 22),
|
||||
],
|
||||
Text(
|
||||
s.welcomeGamesTitle,
|
||||
style: Theme.of(context).textTheme.titleMedium?.copyWith(
|
||||
|
||||
@ -251,8 +251,8 @@ void main() {
|
||||
await tester.pump();
|
||||
await tester.pump(const Duration(milliseconds: 500));
|
||||
|
||||
// Soft-fail: empty promo placeholder, games remain; no ads SectionError.
|
||||
expect(find.textContaining('promotions coming soon'), findsOneWidget);
|
||||
// Soft-fail: ads band hidden (no placeholder), games remain; no ads SectionError.
|
||||
expect(find.textContaining('promotions coming soon'), findsNothing);
|
||||
expect(find.text('Candle Predict'), findsOneWidget);
|
||||
expect(find.byKey(const Key('home_deposit_shortcut')), findsOneWidget);
|
||||
});
|
||||
|
||||
@ -58,14 +58,17 @@ export function LandingPage() {
|
||||
|
||||
useScrollReveal();
|
||||
|
||||
const hasCampaigns = (heroQ.data?.length ?? 0) > 0;
|
||||
const showCampaigns = heroQ.isLoading || hasCampaigns;
|
||||
|
||||
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: 'live', label: t('landing.nav.live') },
|
||||
{ id: 'why', label: t('landing.nav.why') },
|
||||
],
|
||||
[t]
|
||||
[t, hasCampaigns]
|
||||
);
|
||||
|
||||
const whyItems = [
|
||||
@ -99,10 +102,12 @@ export function LandingPage() {
|
||||
|
||||
<LandingHero />
|
||||
|
||||
{/* Campaigns — carousel of all hero ads (parity with mobile) */}
|
||||
{/* Campaigns — hidden entirely when none are published */}
|
||||
{showCampaigns && (
|
||||
<section id="offers" className="tl-offers tl-reveal" style={{ scrollMarginTop: 96 }}>
|
||||
<LandingOffersCarousel ads={heroQ.data ?? []} loading={heroQ.isLoading} />
|
||||
</section>
|
||||
)}
|
||||
|
||||
<LandingGamePeek games={gamesQ.data ?? []} loading={gamesQ.isLoading} />
|
||||
|
||||
|
||||
@ -56,7 +56,7 @@ export function LandingOffersCarousel({ ads, loading }: LandingOffersCarouselPro
|
||||
[count]
|
||||
);
|
||||
|
||||
if (loading) {
|
||||
if (loading && count === 0) {
|
||||
return (
|
||||
<div className="tl-offers-carousel tl-offers-carousel--loading" aria-busy>
|
||||
<div className="tl-offers-carousel__skeleton" />
|
||||
@ -65,14 +65,8 @@ export function LandingOffersCarousel({ ads, loading }: LandingOffersCarouselPro
|
||||
}
|
||||
|
||||
if (count === 0) {
|
||||
return (
|
||||
<div className="tl-offers-carousel tl-offers-carousel--empty">
|
||||
<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>
|
||||
);
|
||||
// No campaigns → reclaim the whole band (no empty placeholder).
|
||||
return null;
|
||||
}
|
||||
|
||||
const ad = ads[index];
|
||||
|
||||
@ -507,22 +507,11 @@
|
||||
background: var(--tl-emerald-bright);
|
||||
}
|
||||
|
||||
.tl-offers-carousel--loading .tl-offers-carousel__skeleton,
|
||||
.tl-offers-carousel--empty .tl-offers-carousel__empty-inner {
|
||||
min-height: clamp(200px, 28vh, 300px);
|
||||
.tl-offers-carousel--loading .tl-offers-carousel__skeleton {
|
||||
min-height: clamp(160px, 22vh, 240px);
|
||||
border-radius: 28px;
|
||||
border: 1px solid var(--tl-line);
|
||||
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;
|
||||
}
|
||||
|
||||
@ -532,14 +521,19 @@
|
||||
}
|
||||
|
||||
.tl-offers-carousel__stage {
|
||||
min-height: clamp(240px, 28vh, 320px);
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
.tl-offers-carousel__copy {
|
||||
max-width: 36rem;
|
||||
min-height: clamp(240px, 28vh, 320px);
|
||||
align-content: end;
|
||||
padding: clamp(1.75rem, 3vw, 2.75rem) clamp(1.75rem, 3vw, 2.5rem);
|
||||
max-width: 40rem;
|
||||
min-height: 0;
|
||||
align-content: start;
|
||||
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