Skip to content

Commit

Permalink
Merge pull request #1345 from julien4215/shimmer
Browse files Browse the repository at this point in the history
Revert shimmer changes
  • Loading branch information
veloce authored Jan 8, 2025
2 parents fa0c7b7 + 3e81af9 commit 1e92fa8
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 28 deletions.
13 changes: 5 additions & 8 deletions lib/src/view/broadcast/broadcast_boards_tab.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import 'package:lichess_mobile/src/view/broadcast/broadcast_game_screen.dart';
import 'package:lichess_mobile/src/view/broadcast/broadcast_player_widget.dart';
import 'package:lichess_mobile/src/widgets/board_thumbnail.dart';
import 'package:lichess_mobile/src/widgets/clock.dart';
import 'package:lichess_mobile/src/widgets/shimmer.dart';

// height of 1.0 is important because we need to determine the height of the text
// to calculate the height of the header and footer of the board
Expand Down Expand Up @@ -88,6 +87,7 @@ class BroadcastPreview extends StatelessWidget {
required this.roundSlug,
});

// A circular progress indicator is used instead of shimmers currently
const BroadcastPreview.loading()
: tournamentId = const BroadcastTournamentId(''),
roundId = const BroadcastRoundId(''),
Expand Down Expand Up @@ -131,13 +131,10 @@ class BroadcastPreview extends StatelessWidget {
childCount: games == null ? numberLoadingBoards : games!.length,
(context, index) {
if (games == null) {
return ShimmerLoading(
isLoading: true,
child: BoardThumbnail.loading(
size: boardWidth,
header: _PlayerWidgetLoading(width: boardWidth),
footer: _PlayerWidgetLoading(width: boardWidth),
),
return BoardThumbnail.loading(
size: boardWidth,
header: _PlayerWidgetLoading(width: boardWidth),
footer: _PlayerWidgetLoading(width: boardWidth),
);
}

Expand Down
21 changes: 9 additions & 12 deletions lib/src/view/broadcast/broadcast_round_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import 'package:lichess_mobile/src/widgets/bottom_bar.dart';
import 'package:lichess_mobile/src/widgets/buttons.dart';
import 'package:lichess_mobile/src/widgets/list.dart';
import 'package:lichess_mobile/src/widgets/platform.dart';
import 'package:lichess_mobile/src/widgets/shimmer.dart';

class BroadcastRoundScreen extends ConsumerStatefulWidget {
final Broadcast broadcast;
Expand Down Expand Up @@ -257,17 +256,15 @@ class _TabView extends StatelessWidget {

@override
Widget build(BuildContext context) {
return Shimmer(
child: CustomScrollView(
slivers: [
if (cupertinoTabSwitcher != null)
SliverPadding(
padding: Styles.bodyPadding + EdgeInsets.only(top: MediaQuery.paddingOf(context).top),
sliver: SliverToBoxAdapter(child: cupertinoTabSwitcher),
),
sliver,
],
),
return CustomScrollView(
slivers: [
if (cupertinoTabSwitcher != null)
SliverPadding(
padding: Styles.bodyPadding + EdgeInsets.only(top: MediaQuery.paddingOf(context).top),
sliver: SliverToBoxAdapter(child: cupertinoTabSwitcher),
),
sliver,
],
);
}
}
Expand Down
12 changes: 4 additions & 8 deletions lib/src/widgets/shimmer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -118,14 +118,10 @@ class _ShimmerLoadingState extends State<ShimmerLoading> {
}
final shimmerSize = shimmer.size;
final gradient = shimmer.gradient;
final renderObject = context.findRenderObject();
final offsetWithinShimmer =
renderObject != null
? shimmer.getDescendantOffset(
// ignore: cast_nullable_to_non_nullable
descendant: renderObject as RenderBox,
)
: Offset.zero;
final offsetWithinShimmer = shimmer.getDescendantOffset(
// ignore: cast_nullable_to_non_nullable
descendant: context.findRenderObject() as RenderBox,
);

return ShaderMask(
blendMode: BlendMode.srcATop,
Expand Down

0 comments on commit 1e92fa8

Please sign in to comment.