OnboardingPozoAppv1/flutter_app/lib/screens/welcome_screen.dart

495 lines
17 KiB
Dart

import 'package:flutter/material.dart';
import '../theme.dart';
import 'mobile_login_screen.dart';
class WelcomeScreen extends StatelessWidget {
const WelcomeScreen({super.key});
@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
final isMobile = context.isMobile;
return Scaffold(
body: SafeArea(
child: Column(
children: [
// Top Progress bar indicator - 1st segment active
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 16.0),
child: Row(
children: List.generate(5, (index) {
return Expanded(
child: Container(
height: 4,
margin: const EdgeInsets.symmetric(horizontal: 2.0),
decoration: BoxDecoration(
color: index == 0 ? theme.colorScheme.primary : theme.colorScheme.surfaceContainerHighest,
borderRadius: BorderRadius.circular(2),
),
),
);
}),
),
),
// Scrollable / Responsive Content
Expanded(
child: LayoutBuilder(
builder: (context, constraints) {
final maxWidth = constraints.maxWidth;
if (maxWidth >= 768) {
// Desktop / Tablet Double-Column Layout
return SingleChildScrollView(
physics: const BouncingScrollPhysics(),
child: Center(
child: ConstrainedBox(
constraints: const BoxConstraints(maxWidth: 1000),
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 16.0),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
// Left column: content + button
Expanded(
flex: 5,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
_buildLogo(theme),
const SizedBox(height: 16),
Text(
'Manage your business billing in 3 clicks!',
style: theme.textTheme.headlineLarge?.copyWith(
fontWeight: FontWeight.bold,
),
),
const SizedBox(height: 16),
Text(
'The fastest, most reliable tool for Indian MSMEs to run their shop.',
style: theme.textTheme.bodyMedium?.copyWith(
color: theme.colorScheme.onSurfaceVariant,
),
),
const SizedBox(height: 16),
_buildSeal(theme),
const SizedBox(height: 16),
_buildCTAColumn(context, theme),
],
),
),
const SizedBox(width: 32),
// Right column: mock card
Expanded(
flex: 4,
child: Center(
child: _buildMockDashboard(theme),
),
),
],
),
),
),
),
);
} else {
// Mobile Single Column Layout
return SingleChildScrollView(
physics: const BouncingScrollPhysics(),
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 16.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const SizedBox(height: 16),
_buildLogo(theme),
const SizedBox(height: 16),
Text(
'Manage your business billing in 3 clicks!',
textAlign: TextAlign.left,
style: theme.textTheme.headlineLarge?.copyWith(
fontWeight: FontWeight.bold,
),
),
const SizedBox(height: 16),
Text(
'The fastest, most reliable tool for Indian MSMEs to run their shop.',
textAlign: TextAlign.left,
style: theme.textTheme.bodyMedium?.copyWith(
color: theme.colorScheme.onSurfaceVariant,
),
),
const SizedBox(height: 16),
_buildSeal(theme),
const SizedBox(height: 24),
Center(child: _buildMockDashboard(theme)),
const SizedBox(height: 24),
],
),
),
);
}
},
),
),
// Pinned Bottom Button on Mobile
if (isMobile)
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 16.0),
child: _buildCTAColumn(context, theme),
),
],
),
),
);
}
Widget _buildLogo(ThemeData theme) {
return Container(
width: 80,
height: 80,
decoration: BoxDecoration(
color: theme.colorScheme.primary,
borderRadius: BorderRadius.circular(20),
boxShadow: [
BoxShadow(
color: theme.colorScheme.primary.withOpacity(0.15),
blurRadius: 24,
offset: const Offset(0, 8),
)
],
),
alignment: Alignment.center,
child: Stack(
clipBehavior: Clip.none,
children: [
Text(
'Pozo',
style: theme.textTheme.headlineMedium?.copyWith(
color: Colors.white,
fontWeight: FontWeight.w800,
letterSpacing: -1.0,
),
),
Positioned(
top: -16,
right: -16,
child: Container(
padding: const EdgeInsets.all(4),
decoration: BoxDecoration(
color: Colors.amber[700],
shape: BoxShape.circle,
border: Border.all(color: Colors.white, width: 2),
),
child: const Text(
'IN',
style: TextStyle(
color: Colors.white,
fontSize: 8,
fontWeight: FontWeight.bold,
),
),
),
)
],
),
);
}
Widget _buildSeal(ThemeData theme) {
return Container(
padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 8),
decoration: BoxDecoration(
color: theme.colorScheme.surfaceContainerLow,
borderRadius: BorderRadius.circular(20),
border: Border.all(color: theme.colorScheme.outlineVariant),
),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Icon(
Icons.verified,
size: 16,
color: theme.colorScheme.tertiary,
),
const SizedBox(width: 6),
Text(
'Trusted by 10,000+ merchants',
style: theme.textTheme.bodySmall?.copyWith(
fontWeight: FontWeight.w600,
color: theme.colorScheme.onSurfaceVariant,
),
),
],
),
);
}
Widget _buildMockDashboard(ThemeData theme) {
return Container(
width: 280,
height: 230,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(24),
border: Border.all(color: theme.colorScheme.outlineVariant),
boxShadow: [
BoxShadow(
color: Colors.black.withOpacity(0.04),
blurRadius: 20,
offset: const Offset(0, 8),
)
],
),
child: Stack(
clipBehavior: Clip.none,
children: [
Column(
children: [
Container(
height: 44,
padding: const EdgeInsets.symmetric(horizontal: 16),
decoration: BoxDecoration(
color: Colors.grey[50],
borderRadius: const BorderRadius.vertical(top: Radius.circular(24)),
border: Border(bottom: BorderSide(color: Colors.grey[200]!)),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
children: [
Container(
width: 8,
height: 8,
decoration: BoxDecoration(
color: theme.colorScheme.primary,
shape: BoxShape.circle,
),
),
const SizedBox(width: 8),
Container(
width: 70,
height: 8,
decoration: BoxDecoration(
color: Colors.grey[300],
borderRadius: BorderRadius.circular(4),
),
),
],
),
Container(
width: 14,
height: 14,
decoration: BoxDecoration(
color: Colors.grey[300],
shape: BoxShape.circle,
),
)
],
),
),
Expanded(
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
_buildMockRow(Icons.description, Colors.red[50]!, Colors.red),
const SizedBox(height: 14),
_buildMockRow(Icons.poll, Colors.green[50]!, Colors.green),
],
),
),
)
],
),
Positioned(
top: 60,
right: -12,
child: Container(
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 8),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(14),
border: Border.all(color: Colors.grey[200]!),
boxShadow: [
BoxShadow(
color: Colors.black.withOpacity(0.06),
blurRadius: 10,
offset: const Offset(0, 4),
)
],
),
child: Row(
children: [
Container(
padding: const EdgeInsets.all(2),
decoration: const BoxDecoration(
color: Colors.green,
shape: BoxShape.circle,
),
child: const Icon(
Icons.check,
color: Colors.white,
size: 10,
),
),
const SizedBox(width: 6),
const Text(
'Saved',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 11,
color: Colors.black,
),
)
],
),
),
),
Positioned(
bottom: 30,
left: -16,
child: Container(
padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 8),
decoration: BoxDecoration(
color: theme.colorScheme.primary,
borderRadius: BorderRadius.circular(16),
boxShadow: [
BoxShadow(
color: theme.colorScheme.primary.withOpacity(0.2),
blurRadius: 12,
offset: const Offset(0, 6),
)
],
),
child: const Text(
'₹ 4,500',
style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.bold,
fontSize: 12,
),
),
),
)
],
),
);
}
Widget _buildCTAColumn(BuildContext context, ThemeData theme) {
return Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: context.isMobile ? CrossAxisAlignment.center : CrossAxisAlignment.start,
children: [
ElevatedButton(
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(builder: (context) => const MobileLoginScreen()),
);
},
style: ElevatedButton.styleFrom(
minimumSize: const Size(260, 54),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
children: const [
Text('Get Started'),
SizedBox(width: 8),
Icon(Icons.arrow_forward, size: 18),
],
),
),
const SizedBox(height: 16),
Row(
mainAxisAlignment: context.isMobile ? MainAxisAlignment.center : MainAxisAlignment.start,
children: [
Container(
width: 10,
height: 10,
decoration: BoxDecoration(
color: theme.colorScheme.primary,
shape: BoxShape.circle,
),
),
const SizedBox(width: 6),
Container(
width: 8,
height: 8,
decoration: BoxDecoration(
color: Colors.grey[300],
shape: BoxShape.circle,
),
),
const SizedBox(width: 6),
Container(
width: 8,
height: 8,
decoration: BoxDecoration(
color: Colors.grey[300],
shape: BoxShape.circle,
),
),
],
)
],
);
}
Widget _buildMockRow(IconData icon, Color bg, Color color) {
return Container(
height: 48,
padding: const EdgeInsets.all(8),
decoration: BoxDecoration(
color: bg.withOpacity(0.4),
borderRadius: BorderRadius.circular(12),
border: Border.all(color: Colors.grey[100]!),
),
child: Row(
children: [
Container(
padding: const EdgeInsets.all(6),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(8),
),
child: Icon(icon, color: color, size: 16),
),
const SizedBox(width: 12),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Container(
width: 100,
height: 6,
decoration: BoxDecoration(
color: Colors.grey[400],
borderRadius: BorderRadius.circular(3),
),
),
const SizedBox(height: 6),
Container(
width: 50,
height: 4,
decoration: BoxDecoration(
color: Colors.grey[300],
borderRadius: BorderRadius.circular(2),
),
),
],
),
),
Icon(Icons.more_vert, color: Colors.grey[400], size: 16)
],
),
);
}
}