Skip to content

Commit

Permalink
feat: add shimmer loading to online friends widget
Browse files Browse the repository at this point in the history
  • Loading branch information
papo1011 committed Oct 10, 2023
1 parent 601eff7 commit 98c993f
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions lib/src/view/relation/relation_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import 'package:lichess_mobile/src/widgets/list.dart';
import 'package:lichess_mobile/src/widgets/platform.dart';
import 'package:lichess_mobile/src/utils/l10n_context.dart';
import 'package:lichess_mobile/src/widgets/buttons.dart';
import 'package:lichess_mobile/src/widgets/shimmer.dart';
import 'package:lichess_mobile/src/styles/styles.dart';

class RelationScreen extends ConsumerStatefulWidget {
const RelationScreen({super.key});
Expand Down Expand Up @@ -90,16 +92,24 @@ class _OnlineFriendsWidget extends ConsumerWidget {
],
);
},
loading: () {
return const Center(
child: CircularProgressIndicator(),
);
},
error: (error, stackTrace) {
return Center(
child: Text('$error'),
debugPrint(
'SEVERE: [OnlineFriendsWidget] could not lead leaderboard data; $error\n $stackTrace',
);
return Padding(
padding: Styles.bodySectionPadding,
child: const Text('Could not load online friends'),
);
},
loading: () => Shimmer(
child: ShimmerLoading(
isLoading: true,
child: ListSection.loading(
itemsNumber: 3,
header: true,
),
),
),
);
}
}

0 comments on commit 98c993f

Please sign in to comment.