madari-oss/lib/features/widgetter/plugins/stremio/containers/cast_info_shimmer.dart
2025-01-30 21:58:43 +05:30

257 lines
9.5 KiB
Dart

import 'package:flutter/material.dart';
import 'package:shimmer/shimmer.dart';
class CastInfoShimmer extends StatelessWidget {
const CastInfoShimmer({
super.key,
});
@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
final baseColor =
theme.colorScheme.surfaceContainerHighest.withValues(alpha: 0.2);
final highlightColor = theme.colorScheme.surfaceContainerHighest;
return Scaffold(
body: CustomScrollView(
slivers: [
// Profile Header Shimmer
SliverAppBar(
expandedHeight: 280,
floating: false,
pinned: true,
backgroundColor: theme.colorScheme.surface,
flexibleSpace: FlexibleSpaceBar(
background: Container(
color:
theme.colorScheme.primaryContainer.withValues(alpha: 0.8),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Shimmer.fromColors(
baseColor: baseColor,
highlightColor: highlightColor,
child: Container(
width: 120,
height: 120,
decoration: const BoxDecoration(
color: Colors.white,
shape: BoxShape.circle,
),
),
),
const SizedBox(height: 16),
Shimmer.fromColors(
baseColor: baseColor,
highlightColor: highlightColor,
child: Container(
width: 200,
height: 24,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(4),
),
),
),
const SizedBox(height: 8),
Shimmer.fromColors(
baseColor: baseColor,
highlightColor: highlightColor,
child: Container(
width: 120,
height: 16,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(4),
),
),
),
const SizedBox(height: 16),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: List.generate(
4,
(index) => Padding(
padding: const EdgeInsets.symmetric(horizontal: 8.0),
child: Shimmer.fromColors(
baseColor: baseColor,
highlightColor: highlightColor,
child: Container(
width: 40,
height: 40,
decoration: const BoxDecoration(
color: Colors.white,
shape: BoxShape.circle,
),
),
),
),
),
),
],
),
),
),
),
// Content Shimmer
SliverPadding(
padding: const EdgeInsets.symmetric(horizontal: 16.0),
sliver: SliverList(
delegate: SliverChildListDelegate([
const SizedBox(height: 16),
Shimmer.fromColors(
baseColor: baseColor,
highlightColor: highlightColor,
child: Container(
height: 48,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(12),
),
),
),
_buildSectionShimmer(
title: 'Personal Information',
content: Column(
children: List.generate(
2,
(index) => Padding(
padding: const EdgeInsets.only(bottom: 8.0),
child: Row(
children: [
Shimmer.fromColors(
baseColor: baseColor,
highlightColor: highlightColor,
child: Container(
width: 18,
height: 18,
decoration: const BoxDecoration(
color: Colors.white,
shape: BoxShape.circle,
),
),
),
const SizedBox(width: 12),
Expanded(
child: Shimmer.fromColors(
baseColor: baseColor,
highlightColor: highlightColor,
child: Container(
height: 16,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(4),
),
),
),
),
],
),
),
),
),
theme: theme,
),
_buildSectionShimmer(
title: 'Biography',
content: Column(
children: List.generate(
4,
(index) => Padding(
padding: const EdgeInsets.only(bottom: 8.0),
child: Shimmer.fromColors(
baseColor: baseColor,
highlightColor: highlightColor,
child: Container(
height: 16,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(4),
),
),
),
),
),
),
theme: theme,
),
_buildSectionShimmer(
title: 'Known For',
content: SizedBox(
height: 190,
child: ListView.builder(
scrollDirection: Axis.horizontal,
itemCount: 5,
itemBuilder: (context, index) {
return Container(
width: 100,
margin: const EdgeInsets.only(right: 12),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Shimmer.fromColors(
baseColor: baseColor,
highlightColor: highlightColor,
child: Container(
height: 150,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(8),
),
),
),
const SizedBox(height: 8),
Shimmer.fromColors(
baseColor: baseColor,
highlightColor: highlightColor,
child: Container(
height: 16,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(4),
),
),
),
],
),
);
},
),
),
theme: theme,
),
const SizedBox(height: 24),
]),
),
),
],
),
);
}
Widget _buildSectionShimmer({
required String title,
required Widget content,
required ThemeData theme,
}) {
return Padding(
padding: const EdgeInsets.symmetric(vertical: 12.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
title,
style: theme.textTheme.titleMedium?.copyWith(
fontWeight: FontWeight.bold,
color: theme.colorScheme.primary,
),
),
const SizedBox(height: 12),
content,
],
),
);
}
}