From 8253c05c2868658c910c97112bdb1b8f72b1eb14 Mon Sep 17 00:00:00 2001 From: Vincent Velociter Date: Thu, 19 Dec 2024 23:18:14 +0100 Subject: [PATCH] Watch tab style fixes --- .../view/watch/live_tv_channels_screen.dart | 11 ++++- lib/src/view/watch/streamer_screen.dart | 49 +++++++++---------- lib/src/view/watch/watch_tab_screen.dart | 14 +++++- 3 files changed, 45 insertions(+), 29 deletions(-) diff --git a/lib/src/view/watch/live_tv_channels_screen.dart b/lib/src/view/watch/live_tv_channels_screen.dart index fdb96f412f..7afd2ddc54 100644 --- a/lib/src/view/watch/live_tv_channels_screen.dart +++ b/lib/src/view/watch/live_tv_channels_screen.dart @@ -1,3 +1,4 @@ +import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:lichess_mobile/src/constants.dart'; @@ -68,7 +69,15 @@ class _Body extends ConsumerWidget { mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ Text(game.channel.label, style: Styles.boardPreviewTitle), - Icon(game.channel.icon, color: context.lichessColors.brag, size: 30), + Icon( + game.channel.icon, + + color: + Theme.of(context).platform == TargetPlatform.iOS + ? CupertinoTheme.of(context).primaryColor + : Theme.of(context).colorScheme.primary, + size: 30, + ), UserFullNameWidget.player( user: game.player.asPlayer.user, aiLevel: game.player.asPlayer.aiLevel, diff --git a/lib/src/view/watch/streamer_screen.dart b/lib/src/view/watch/streamer_screen.dart index 4ab5b4ebbf..ac6d76c0f0 100644 --- a/lib/src/view/watch/streamer_screen.dart +++ b/lib/src/view/watch/streamer_screen.dart @@ -22,15 +22,14 @@ class StreamerScreen extends StatelessWidget { Widget _buildAndroid(BuildContext context) { return Scaffold( appBar: AppBar(title: Text(context.l10n.mobileLiveStreamers)), - body: ListView( - children: [ - ListSection( - showDividerBetweenTiles: true, - children: streamers - .map((e) => StreamerListTile(streamer: e, showSubtitle: true, maxSubtitleLines: 4)) - .toList(growable: false), - ), - ], + body: ListView.builder( + itemCount: streamers.length, + itemBuilder: + (context, index) => StreamerListTile( + streamer: streamers[index], + showSubtitle: true, + maxSubtitleLines: 4, + ), ), ); } @@ -41,22 +40,16 @@ class StreamerScreen extends StatelessWidget { child: CustomScrollView( slivers: [ SliverSafeArea( - sliver: SliverList( - delegate: SliverChildListDelegate([ - ListSection( - hasLeading: true, - children: - streamers - .map( - (e) => StreamerListTile( - streamer: e, - showSubtitle: true, - maxSubtitleLines: 4, - ), - ) - .toList(), - ), - ]), + sliver: SliverList.separated( + separatorBuilder: + (context, index) => const PlatformDivider(height: 1, cupertinoHasLeading: true), + itemCount: streamers.length, + itemBuilder: + (context, index) => StreamerListTile( + streamer: streamers[index], + showSubtitle: true, + maxSubtitleLines: 4, + ), ), ), ], @@ -79,6 +72,10 @@ class StreamerListTile extends StatelessWidget { @override Widget build(BuildContext context) { return PlatformListTile( + padding: + Theme.of(context).platform == TargetPlatform.iOS + ? const EdgeInsets.symmetric(horizontal: 14.0, vertical: 12.0) + : null, onTap: () async { final url = streamer.platform == 'twitch' ? streamer.twitch : streamer.youTube; if (!await launchUrl(Uri.parse(url!), mode: LaunchMode.externalApplication)) { @@ -90,7 +87,7 @@ class StreamerListTile extends StatelessWidget { Theme.of(context).platform == TargetPlatform.android ? const EdgeInsets.all(5.0) : EdgeInsets.zero, - child: Image.network(streamer.image), + child: Image.network(streamer.image, width: 50, height: 50, fit: BoxFit.cover), ), title: Padding( padding: const EdgeInsets.only(right: 5.0), diff --git a/lib/src/view/watch/watch_tab_screen.dart b/lib/src/view/watch/watch_tab_screen.dart index 10d6988069..1e6f6a39f1 100644 --- a/lib/src/view/watch/watch_tab_screen.dart +++ b/lib/src/view/watch/watch_tab_screen.dart @@ -219,6 +219,7 @@ class _BroadcastWidget extends ConsumerWidget { return broadcastList.when( data: (data) { return ListSection( + hasLeading: true, header: Text(context.l10n.broadcastBroadcasts), headerTrailing: NoPaddingTextButton( onPressed: () { @@ -268,7 +269,16 @@ class _BroadcastTile extends ConsumerWidget { builder: (context) => BroadcastRoundScreen(broadcast: broadcast), ); }, - leading: const Icon(LichessIcons.radio_tower_lichess), + leading: + broadcast.tour.imageUrl != null + ? Image.network( + broadcast.tour.imageUrl!, + width: 50.0, + height: 50.0, + fit: BoxFit.cover, + errorBuilder: (context, _, __) => const Icon(LichessIcons.radio_tower_lichess), + ) + : const Image(image: kDefaultBroadcastImage), subtitle: Row( children: [ Text(broadcast.round.name), @@ -369,7 +379,7 @@ class _StreamerWidget extends ConsumerWidget { return const SizedBox.shrink(); } return ListSection( - header: Text(context.l10n.streamerLichessStreamers), + header: Text(context.l10n.streamersMenu), hasLeading: true, headerTrailing: NoPaddingTextButton( onPressed: