petsHero-AI/lib/features/generate_video/generate_progress_screen.dart
2026-03-09 11:41:49 +08:00

137 lines
3.9 KiB
Dart

import 'package:flutter/material.dart';
import 'package:flutter_lucide/flutter_lucide.dart';
import '../../core/theme/app_colors.dart';
import '../../core/theme/app_spacing.dart';
import '../../core/theme/app_typography.dart';
import '../../shared/widgets/top_nav_bar.dart';
/// Generate Video Progress screen - matches Pencil qGs6n
class GenerateProgressScreen extends StatefulWidget {
const GenerateProgressScreen({super.key});
@override
State<GenerateProgressScreen> createState() => _GenerateProgressScreenState();
}
class _GenerateProgressScreenState extends State<GenerateProgressScreen> {
double _progress = 0.45;
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: AppColors.background,
appBar: PreferredSize(
preferredSize: const Size.fromHeight(56),
child: TopNavBar(
title: 'Generating',
showBackButton: true,
onBack: () => Navigator.of(context).pop(),
),
),
body: SingleChildScrollView(
padding: const EdgeInsets.all(AppSpacing.screenPaddingLarge),
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
_VideoPreview(),
const SizedBox(height: AppSpacing.xxl),
Text(
'Video generation may take some time. Please wait patiently.',
textAlign: TextAlign.center,
style: AppTypography.bodyRegular.copyWith(
color: AppColors.textSecondary,
),
),
const SizedBox(height: AppSpacing.xxl),
_ProgressSection(progress: _progress),
],
),
),
);
}
}
class _VideoPreview extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Container(
height: 360,
decoration: BoxDecoration(
color: AppColors.textPrimary,
borderRadius: BorderRadius.circular(16),
border: Border.all(color: AppColors.border, width: 1),
),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Icon(
LucideIcons.film,
size: 64,
color: AppColors.textSecondary,
),
const SizedBox(height: AppSpacing.lg),
Text(
'Video Preview',
style: AppTypography.bodyRegular.copyWith(
color: AppColors.textSecondary,
),
),
],
),
);
}
}
class _ProgressSection extends StatelessWidget {
const _ProgressSection({required this.progress});
final double progress;
@override
Widget build(BuildContext context) {
final percentage = (progress * 100).round();
return Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Text(
'Generating... $percentage%',
style: AppTypography.bodyMedium.copyWith(
color: AppColors.textPrimary,
),
),
const SizedBox(height: AppSpacing.lg),
LayoutBuilder(
builder: (context, constraints) {
final fillWidth =
constraints.maxWidth * progress.clamp(0.0, 1.0);
return Stack(
children: [
Container(
height: 8,
decoration: BoxDecoration(
color: AppColors.border,
borderRadius: BorderRadius.circular(4),
),
),
Positioned(
left: 0,
top: 0,
bottom: 0,
child: Container(
width: fillWidth,
decoration: BoxDecoration(
color: AppColors.primary,
borderRadius: BorderRadius.circular(4),
),
),
),
],
);
},
),
],
);
}
}