mangayomi-mirror/lib/modules/manga/reader/widgets/chapter_transition_page.dart
Moustapha Kodjo Amadou 80efee40d1 dart format
2025-05-30 17:43:42 +01:00

218 lines
8.2 KiB
Dart

import 'package:flutter/material.dart';
import 'package:mangayomi/models/chapter.dart';
import 'package:mangayomi/providers/l10n_providers.dart';
class ChapterTransitionPage extends StatelessWidget {
final Chapter currentChapter;
final Chapter? nextChapter;
final String mangaName;
const ChapterTransitionPage({
super.key,
required this.currentChapter,
required this.nextChapter,
required this.mangaName,
});
@override
Widget build(BuildContext context) {
final screenHeight = MediaQuery.of(context).size.height;
final screenWidth = MediaQuery.of(context).size.width;
final l10n = context.l10n;
return Container(
constraints: BoxConstraints(minHeight: screenHeight * 0.5),
color: Theme.of(context).scaffoldBackgroundColor,
child: Center(
child: Padding(
padding: EdgeInsets.all(screenWidth * 0.08),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
// Icône de transition
Icon(
Icons.auto_stories_outlined,
size: screenWidth * 0.16,
color: Theme.of(context).colorScheme.primary,
),
SizedBox(height: screenHeight * 0.04),
// Titre
Text(
l10n.end_of_chapter,
style: Theme.of(context).textTheme.headlineMedium?.copyWith(
fontWeight: FontWeight.bold,
),
textAlign: TextAlign.center,
),
SizedBox(height: screenHeight * 0.03),
Container(
padding: EdgeInsets.all(screenWidth * 0.04),
decoration: BoxDecoration(
color: Theme.of(context).colorScheme.surface,
borderRadius: BorderRadius.circular(12),
border: Border.all(
color: Theme.of(
context,
).colorScheme.outline.withValues(alpha: 0.2),
),
),
child: Column(
children: [
Text(
l10n.chapter_completed,
style: Theme.of(context).textTheme.labelMedium?.copyWith(
color: Theme.of(
context,
).colorScheme.onSurface.withValues(alpha: 0.7),
),
),
SizedBox(height: screenHeight * 0.01),
Text(
currentChapter.name ?? 'Chapitre ${currentChapter.id}',
style: Theme.of(context).textTheme.titleMedium?.copyWith(
fontWeight: FontWeight.w600,
),
textAlign: TextAlign.center,
maxLines: 2,
overflow: TextOverflow.ellipsis,
),
],
),
),
SizedBox(height: screenHeight * 0.03),
Icon(
nextChapter != null
? Icons.keyboard_arrow_down
: Icons.check_circle_outline,
size: screenWidth * 0.08,
color: nextChapter != null
? Theme.of(context).colorScheme.primary
: Theme.of(
context,
).colorScheme.onSurface.withValues(alpha: 0.6),
),
SizedBox(height: screenHeight * 0.03),
if (nextChapter != null) ...[
Container(
padding: EdgeInsets.all(screenWidth * 0.04),
decoration: BoxDecoration(
color: Theme.of(context).colorScheme.primaryContainer,
borderRadius: BorderRadius.circular(12),
border: Border.all(
color: Theme.of(
context,
).colorScheme.primary.withValues(alpha: 0.3),
),
),
child: Column(
children: [
Text(
l10n.next_chapter,
style: Theme.of(context).textTheme.labelMedium
?.copyWith(
color: Theme.of(context)
.colorScheme
.onPrimaryContainer
.withValues(alpha: 0.8),
),
),
SizedBox(height: screenHeight * 0.01),
Text(
nextChapter!.name ?? 'Chapitre ${nextChapter!.id}',
style: Theme.of(context).textTheme.titleMedium
?.copyWith(
fontWeight: FontWeight.w600,
color: Theme.of(
context,
).colorScheme.onPrimaryContainer,
),
textAlign: TextAlign.center,
maxLines: 2,
overflow: TextOverflow.ellipsis,
),
],
),
),
SizedBox(height: screenHeight * 0.04),
Text(
l10n.continue_to_next_chapter,
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
color: Theme.of(
context,
).colorScheme.onSurface.withValues(alpha: 0.6),
),
textAlign: TextAlign.center,
),
] else ...[
Container(
padding: EdgeInsets.all(screenWidth * 0.04),
decoration: BoxDecoration(
color: Theme.of(
context,
).colorScheme.surfaceContainerHighest,
borderRadius: BorderRadius.circular(12),
border: Border.all(
color: Theme.of(
context,
).colorScheme.outline.withValues(alpha: 0.3),
),
),
child: Column(
children: [
Icon(
Icons.last_page,
size: screenWidth * 0.06,
color: Theme.of(
context,
).colorScheme.onSurface.withValues(alpha: 0.7),
),
SizedBox(height: screenHeight * 0.01),
Text(
l10n.no_next_chapter,
style: Theme.of(context).textTheme.titleMedium
?.copyWith(
fontWeight: FontWeight.w600,
color: Theme.of(
context,
).colorScheme.onSurface.withValues(alpha: 0.8),
),
textAlign: TextAlign.center,
),
SizedBox(height: screenHeight * 0.005),
Text(
l10n.you_have_finished_reading,
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
color: Theme.of(
context,
).colorScheme.onSurface.withValues(alpha: 0.6),
),
textAlign: TextAlign.center,
),
],
),
),
SizedBox(height: screenHeight * 0.04),
Text(
l10n.return_to_the_list_of_chapters,
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
color: Theme.of(
context,
).colorScheme.onSurface.withValues(alpha: 0.6),
),
textAlign: TextAlign.center,
),
],
],
),
),
),
);
}
}