diff --git a/prediqo_mobile/lib/features/home/presentation/widgets/home_ad_carousel.dart b/prediqo_mobile/lib/features/home/presentation/widgets/home_ad_carousel.dart index 7351f6fa..00a3520a 100644 --- a/prediqo_mobile/lib/features/home/presentation/widgets/home_ad_carousel.dart +++ b/prediqo_mobile/lib/features/home/presentation/widgets/home_ad_carousel.dart @@ -72,7 +72,7 @@ class _HomeAdCarouselState extends State { return _buildCarousel(); } if (widget.loading) { - return const PredSkeletonCarousel(height: 200); + return const PredSkeletonCarousel(height: 168); } return Container( @@ -102,10 +102,11 @@ class _HomeAdCarouselState extends State { } Widget _buildCarousel() { + // Compact height: copy is top-aligned (no dead space reserved for missing art). return Column( children: [ SizedBox( - height: 210, + height: 168, child: PageView.builder( controller: _controller, itemCount: widget.ads.length, @@ -151,6 +152,8 @@ class _AdSlide extends StatelessWidget { Widget build(BuildContext context) { final accent = parseHexColor(ad.accentColor, fallback: AppColors.primary); final cta = ad.ctaLabel?.trim(); + final hasImage = ad.imageUrl != null && ad.imageUrl!.trim().isNotEmpty; + final subtitle = ad.subtitle?.trim(); return Material( color: Colors.transparent, child: InkWell( @@ -181,7 +184,7 @@ class _AdSlide extends StatelessWidget { child: Stack( fit: StackFit.expand, children: [ - if (ad.imageUrl != null && ad.imageUrl!.isNotEmpty) + if (hasImage) Image.network( ad.imageUrl!, fit: BoxFit.cover, @@ -194,23 +197,25 @@ class _AdSlide extends StatelessWidget { opacity: const AlwaysStoppedAnimation(0.38), errorBuilder: (_, __, ___) => const SizedBox.shrink(), ), - DecoratedBox( - decoration: BoxDecoration( - gradient: LinearGradient( - begin: Alignment.topCenter, - end: Alignment.bottomCenter, - colors: [ - Colors.transparent, - AppColors.bgDark.withValues(alpha: 0.85), - ], + if (hasImage) + DecoratedBox( + decoration: BoxDecoration( + gradient: LinearGradient( + begin: Alignment.topCenter, + end: Alignment.bottomCenter, + colors: [ + Colors.transparent, + AppColors.bgDark.withValues(alpha: 0.85), + ], + ), ), ), - ), Padding( - padding: const EdgeInsets.fromLTRB(20, 20, 20, 18), + padding: const EdgeInsets.fromLTRB(18, 16, 18, 14), child: Column( crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.end, + // Top-align copy so we don't leave a blank band above the title + // when the ad has no (or failed) background image. children: [ Text( ad.title, @@ -218,23 +223,24 @@ class _AdSlide extends StatelessWidget { overflow: TextOverflow.ellipsis, style: const TextStyle( fontWeight: FontWeight.w900, - fontSize: 22, + fontSize: 20, height: 1.15, ), ), - if (ad.subtitle != null && ad.subtitle!.isNotEmpty) ...[ + if (subtitle != null && subtitle.isNotEmpty) ...[ const SizedBox(height: 6), Text( - ad.subtitle!, - maxLines: 2, + subtitle, + maxLines: 3, overflow: TextOverflow.ellipsis, style: Theme.of(context).textTheme.bodyMedium?.copyWith( color: AppColors.textSecondary, + height: 1.35, ), ), ], if (cta != null && cta.isNotEmpty) ...[ - const SizedBox(height: 12), + const SizedBox(height: 10), Container( padding: const EdgeInsets.symmetric( horizontal: 14,