Skip to content

Commit

Permalink
Watch tab style fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
veloce committed Dec 19, 2024
1 parent 52dcf3e commit 8253c05
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 29 deletions.
11 changes: 10 additions & 1 deletion lib/src/view/watch/live_tv_channels_screen.dart
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -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,
Expand Down
49 changes: 23 additions & 26 deletions lib/src/view/watch/streamer_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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,
),
),
);
}
Expand All @@ -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,
),
),
),
],
Expand All @@ -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)) {
Expand All @@ -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),
Expand Down
14 changes: 12 additions & 2 deletions lib/src/view/watch/watch_tab_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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: () {
Expand Down Expand Up @@ -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),
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 8253c05

Please sign in to comment.