This commit is contained in:
208
lib/presentation/welcome/widgets/initial_prompt.dart
Normal file
208
lib/presentation/welcome/widgets/initial_prompt.dart
Normal file
@@ -0,0 +1,208 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:trainhub_flutter/core/constants/ui_constants.dart';
|
||||
import 'package:trainhub_flutter/core/theme/app_colors.dart';
|
||||
import 'package:trainhub_flutter/presentation/welcome/widgets/welcome_buttons.dart';
|
||||
|
||||
class InitialPrompt extends StatelessWidget {
|
||||
const InitialPrompt({
|
||||
super.key,
|
||||
required this.onDownload,
|
||||
required this.onSkip,
|
||||
});
|
||||
|
||||
final VoidCallback onDownload;
|
||||
final VoidCallback onSkip;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
_buildLogoRow(),
|
||||
const SizedBox(height: UIConstants.spacing32),
|
||||
_buildHeadline(),
|
||||
const SizedBox(height: UIConstants.spacing16),
|
||||
_buildDescription(),
|
||||
const SizedBox(height: UIConstants.spacing24),
|
||||
_buildFeatureList(),
|
||||
const SizedBox(height: UIConstants.spacing32),
|
||||
_buildDownloadNotice(),
|
||||
const SizedBox(height: UIConstants.spacing32),
|
||||
_buildActionButtons(),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildLogoRow() {
|
||||
return Row(
|
||||
children: [
|
||||
Container(
|
||||
width: 48,
|
||||
height: 48,
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.accentMuted,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
child: const Icon(
|
||||
Icons.fitness_center,
|
||||
color: AppColors.accent,
|
||||
size: 24,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: UIConstants.spacing12),
|
||||
Text(
|
||||
'TrainHub',
|
||||
style: GoogleFonts.inter(
|
||||
fontSize: 26,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: AppColors.textPrimary,
|
||||
letterSpacing: -0.5,
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildHeadline() {
|
||||
return Text(
|
||||
'AI-powered coaching,\nright on your device.',
|
||||
style: GoogleFonts.inter(
|
||||
fontSize: 28,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: AppColors.textPrimary,
|
||||
height: 1.25,
|
||||
letterSpacing: -0.5,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildDescription() {
|
||||
return Text(
|
||||
'TrainHub uses on-device AI models to give you intelligent '
|
||||
'training advice, exercise analysis, and personalised chat — '
|
||||
'with zero data sent to the cloud.',
|
||||
style: GoogleFonts.inter(
|
||||
fontSize: 14,
|
||||
color: AppColors.textSecondary,
|
||||
height: 1.6,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildFeatureList() {
|
||||
return const Column(
|
||||
children: [
|
||||
FeatureRow(
|
||||
icon: Icons.lock_outline_rounded,
|
||||
label: '100 % local — your data never leaves this machine.',
|
||||
),
|
||||
SizedBox(height: UIConstants.spacing12),
|
||||
FeatureRow(
|
||||
icon: Icons.psychology_outlined,
|
||||
label: 'Qwen 2.5 7B chat model for training advice.',
|
||||
),
|
||||
SizedBox(height: UIConstants.spacing12),
|
||||
FeatureRow(
|
||||
icon: Icons.search_rounded,
|
||||
label: 'Nomic embedding model for semantic exercise search.',
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildDownloadNotice() {
|
||||
return Container(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: UIConstants.spacing16,
|
||||
vertical: UIConstants.spacing12,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.accentMuted,
|
||||
borderRadius: BorderRadius.circular(UIConstants.smallBorderRadius),
|
||||
border: Border.all(
|
||||
color: AppColors.accent.withValues(alpha: 0.3),
|
||||
),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
const Icon(
|
||||
Icons.download_outlined,
|
||||
color: AppColors.accent,
|
||||
size: 18,
|
||||
),
|
||||
const SizedBox(width: UIConstants.spacing12),
|
||||
Expanded(
|
||||
child: Text(
|
||||
'The download is ~5 GB and only needs to happen once. '
|
||||
'You can skip now and download later from Settings.',
|
||||
style: GoogleFonts.inter(
|
||||
fontSize: 13,
|
||||
color: AppColors.accent,
|
||||
height: 1.5,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildActionButtons() {
|
||||
return Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: WelcomePrimaryButton(
|
||||
label: 'Download Now',
|
||||
icon: Icons.download_rounded,
|
||||
onPressed: onDownload,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: UIConstants.spacing12),
|
||||
Expanded(
|
||||
child: WelcomeSecondaryButton(
|
||||
label: 'Skip for Now',
|
||||
onPressed: onSkip,
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class FeatureRow extends StatelessWidget {
|
||||
const FeatureRow({super.key, required this.icon, required this.label});
|
||||
|
||||
final IconData icon;
|
||||
final String label;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Container(
|
||||
width: 28,
|
||||
height: 28,
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.surfaceContainerHigh,
|
||||
borderRadius: BorderRadius.circular(6),
|
||||
),
|
||||
child: Icon(icon, size: 14, color: AppColors.accent),
|
||||
),
|
||||
const SizedBox(width: UIConstants.spacing12),
|
||||
Expanded(
|
||||
child: Text(
|
||||
label,
|
||||
style: GoogleFonts.inter(
|
||||
fontSize: 13,
|
||||
color: AppColors.textSecondary,
|
||||
height: 1.5,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user