V1 - Personal Account and Budgeting Done
Personal Account and Budgeting
This commit is contained in:
@@ -0,0 +1,139 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
import 'package:lucide_icons/lucide_icons.dart';
|
||||
import '../../dashboard/presentation/dashboard_screen.dart';
|
||||
|
||||
class OnboardingScreen extends StatefulWidget {
|
||||
const OnboardingScreen({super.key});
|
||||
|
||||
@override
|
||||
State<OnboardingScreen> createState() => _OnboardingScreenState();
|
||||
}
|
||||
|
||||
class _OnboardingScreenState extends State<OnboardingScreen> {
|
||||
final PageController _pageController = PageController();
|
||||
int _currentPage = 0;
|
||||
|
||||
final List<Map<String, dynamic>> _pages = [
|
||||
{
|
||||
'title': 'Welcome to Kifi',
|
||||
'description': 'A beautiful, intelligent way to track your personal finances.',
|
||||
'icon': LucideIcons.wallet,
|
||||
},
|
||||
{
|
||||
'title': 'Double-Entry, Simplified',
|
||||
'description': 'We track money moving from one place to another. Every expense comes from a Wallet (like Cash) and goes to a Category (like Food).',
|
||||
'icon': LucideIcons.arrowRightLeft,
|
||||
},
|
||||
{
|
||||
'title': 'Intelligent Automation',
|
||||
'description': 'Set up recurring transactions and let Kifi handle your monthly subscriptions and salary deposits automatically.',
|
||||
'icon': LucideIcons.bot,
|
||||
},
|
||||
{
|
||||
'title': 'Powerful Insights',
|
||||
'description': 'View day-by-day spending trends and strict monthly budgets to take control of your financial future.',
|
||||
'icon': LucideIcons.barChart2,
|
||||
},
|
||||
];
|
||||
|
||||
void _completeOnboarding() async {
|
||||
final prefs = await SharedPreferences.getInstance();
|
||||
await prefs.setBool('has_seen_onboarding', true);
|
||||
if (mounted) {
|
||||
Navigator.pushReplacement(
|
||||
context,
|
||||
MaterialPageRoute(builder: (context) => const DashboardScreen()),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
body: SafeArea(
|
||||
child: Column(
|
||||
children: [
|
||||
Expanded(
|
||||
child: PageView.builder(
|
||||
controller: _pageController,
|
||||
onPageChanged: (index) {
|
||||
setState(() => _currentPage = index);
|
||||
},
|
||||
itemCount: _pages.length,
|
||||
itemBuilder: (context, index) {
|
||||
final page = _pages[index];
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(40.0),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Icon(
|
||||
page['icon'],
|
||||
size: 100,
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
),
|
||||
const SizedBox(height: 60),
|
||||
Text(
|
||||
page['title'],
|
||||
style: Theme.of(context).textTheme.displayLarge?.copyWith(fontSize: 28),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
Text(
|
||||
page['description'],
|
||||
style: Theme.of(context).textTheme.bodyLarge?.copyWith(
|
||||
color: Theme.of(context).colorScheme.onSurface.withValues(alpha: 0.7),
|
||||
height: 1.5,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(40.0),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Row(
|
||||
children: List.generate(
|
||||
_pages.length,
|
||||
(index) => Container(
|
||||
margin: const EdgeInsets.only(right: 8),
|
||||
height: 8,
|
||||
width: _currentPage == index ? 24 : 8,
|
||||
decoration: BoxDecoration(
|
||||
color: _currentPage == index
|
||||
? Theme.of(context).colorScheme.primary
|
||||
: Theme.of(context).colorScheme.primary.withValues(alpha: 0.2),
|
||||
borderRadius: BorderRadius.circular(4),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
ElevatedButton(
|
||||
onPressed: () {
|
||||
if (_currentPage == _pages.length - 1) {
|
||||
_completeOnboarding();
|
||||
} else {
|
||||
_pageController.nextPage(
|
||||
duration: const Duration(milliseconds: 300),
|
||||
curve: Curves.easeInOut,
|
||||
);
|
||||
}
|
||||
},
|
||||
child: Text(_currentPage == _pages.length - 1 ? 'Get Started' : 'Next'),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user