Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert shimmer changes #1345

Merged
merged 1 commit into from
Jan 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading