Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import 'package:flutter_pecha/features/practice/domain/entities/practice_item.da
import 'package:flutter_pecha/features/practice/domain/entities/practice_items_tab.dart';
import 'package:flutter_pecha/features/practice/presentation/providers/practice_items_paginated_provider.dart';
import 'package:flutter_pecha/features/practice/presentation/providers/practice_recitations_paginated_provider.dart';
import 'package:flutter_pecha/features/practice/presentation/widgets/practice_chant_list_tile.dart';
import 'package:flutter_pecha/features/recitation/data/models/recitation_model.dart';
import 'package:flutter_pecha/features/recitation/presentation/widgets/recitation_list_skeleton.dart';
import 'package:flutter_pecha/features/timer/domain/entities/preset_timer.dart';
Expand Down Expand Up @@ -377,14 +378,15 @@ class _ChantsTab extends ConsumerWidget {

@override
Widget build(BuildContext context, WidgetRef ref) {
final isDark = Theme.of(context).brightness == Brightness.dark;
final recitationsState = ref.watch(practiceRecitationsPaginatedProvider);

Future<void> onRefresh() =>
ref.read(practiceRecitationsPaginatedProvider.notifier).refresh();

if (recitationsState.isLoading && recitationsState.recitations.isEmpty) {
return const RecitationListSkeleton();
return const RecitationListSkeleton(
variant: RecitationListSkeletonVariant.chantTile,
);
}

if (recitationsState.error != null &&
Expand Down Expand Up @@ -425,65 +427,17 @@ class _ChantsTab extends ConsumerWidget {
}

final recitation = recitations[index];
final description = recitation.firstSegment?.content;

return Padding(
padding: const EdgeInsets.only(bottom: 8),
child: _SessionCard(
isDark: isDark,
child: PracticeChantListTile(
recitation: recitation,
showTrailingCaret: false,
includeOuterPadding: false,
onTap:
enrollingItemId == null
? () => onRecitationSelected(recitation)
: null,
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
width: 4,
height: description != null ? null : 44,
constraints: const BoxConstraints(minHeight: 44),
decoration: BoxDecoration(
color:
isDark
? AppColors.textTertiaryDark
: AppColors.grey400,
borderRadius: BorderRadius.circular(2),
),
),
const SizedBox(width: 12),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
recitation.title,
style: const TextStyle(
fontSize: 15,
fontWeight: FontWeight.w600,
),
maxLines: 2,
overflow: TextOverflow.ellipsis,
),
if (description != null && description.isNotEmpty) ...[
const SizedBox(height: 4),
Text(
description,
style: TextStyle(
fontSize: 13,
color:
isDark
? AppColors.textTertiaryDark
: AppColors.textSecondary,
),
maxLines: 3,
overflow: TextOverflow.ellipsis,
),
],
],
),
),
],
),
),
);
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,15 @@ class PracticeChantListTile extends StatelessWidget {
const PracticeChantListTile({
super.key,
required this.recitation,
required this.onTap,
this.onTap,
this.showTrailingCaret = true,
this.includeOuterPadding = true,
});

final RecitationModel recitation;
final VoidCallback onTap;
final VoidCallback? onTap;
final bool showTrailingCaret;
final bool includeOuterPadding;

@override
Widget build(BuildContext context) {
Expand All @@ -35,54 +39,53 @@ class PracticeChantListTile extends StatelessWidget {
),
);

return Padding(
padding: const EdgeInsets.fromLTRB(16, 0, 16, 8),
child: Material(
color: isDark ? AppColors.cardBackgroundDark : Colors.white,
borderRadius: BorderRadius.circular(12),
clipBehavior: Clip.antiAlias,
child: InkWell(
onTap: onTap,
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 10),
child: IntrinsicHeight(
child: Row(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Container(
width: 4,
decoration: BoxDecoration(
color: isDark ? Colors.white : AppColors.grey800,
borderRadius: BorderRadius.circular(2),
),
final tile = Material(
color: isDark ? AppColors.cardBackgroundDark : Colors.white,
borderRadius: BorderRadius.circular(12),
clipBehavior: Clip.antiAlias,
child: InkWell(
onTap: onTap,
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 10),
child: IntrinsicHeight(
child: Row(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Container(
width: 4,
decoration: BoxDecoration(
color: isDark ? Colors.white : AppColors.grey800,
borderRadius: BorderRadius.circular(2),
),
const SizedBox(width: 12),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
),
const SizedBox(width: 12),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
Text(
recitation.title,
style: const TextStyle(
fontSize: 15,
fontWeight: FontWeight.bold,
),
maxLines: 2,
overflow: TextOverflow.ellipsis,
),
if (hasFirstSegment) ...[
const SizedBox(height: 4),
Text(
recitation.title,
style: const TextStyle(
fontSize: 15,
fontWeight: FontWeight.bold,
),
firstSegmentContent,
style: firstSegmentStyle,
maxLines: 2,
overflow: TextOverflow.ellipsis,
),
if (hasFirstSegment) ...[
const SizedBox(height: 4),
Text(
firstSegmentContent,
style: firstSegmentStyle,
maxLines: 2,
overflow: TextOverflow.ellipsis,
),
],
],
),
],
),
),
if (showTrailingCaret) ...[
const SizedBox(width: 8),
Center(
child: Container(
Expand All @@ -99,12 +102,21 @@ class PracticeChantListTile extends StatelessWidget {
),
),
],
),
],
),
),
),
),
);

if (!includeOuterPadding) {
return tile;
}

return Padding(
padding: const EdgeInsets.fromLTRB(16, 0, 16, 8),
child: tile,
);
}

bool _containsTibetan(String value) {
Expand Down
Loading