import 'package:stacked/stacked.dart'; import 'package:stacked_services/stacked_services.dart'; import '../../../app/app.locator.dart'; import 'onboarding_view.form.dart'; class OnboardingViewModel extends FormViewModel { final _navigationService = locator(); int _currentStep = 0; int get currentStep => _currentStep; // Full name bool _focusFullName = false; bool get focusFullName => _focusFullName; // Educational background final List _educationalBackgrounds = [ 'No formal education', 'Primary school', 'Secondary /High school', 'College / Diploma', 'Bachelor’s and above' ]; List get educationalBackgrounds => _educationalBackgrounds; String? _selectedEducationalBackground; String? get selectedEducationalBackground => _selectedEducationalBackground; // Age group final List _ageGroups = [ '8-14', '15-18', '19-26', '26+', ]; List get ageGroups => _ageGroups; String? _selectedAgeGroup; String? get selectedAgeGroup => _selectedAgeGroup; // Occupation bool _focusOccupation = false; bool get focusOccupation => _focusOccupation; // Learning goal String? _selectedLearningGoal; String? get selectedLearningGoal => _selectedLearningGoal; final List> _learningGoals = [ { 'icon': 0, 'title': 'Learn to Speak English', 'subtitle': 'I know some English, but i want to learn to speak it', }, { 'icon': 1, 'title': 'Practice Speaking English', 'subtitle': 'I already speak English, but I want more practice.', }, { 'icon': 2, 'title': 'Skill-based Courses', 'subtitle': 'I want courses for IELTS, TOEFL, Duolingo, or work.', }, ]; List> get learningGoals => _learningGoals; // Learning reason bool _showTextBox = false; bool get showTextBox => _showTextBox; bool _focusLearningReason = false; bool get focusLearningReason => _focusLearningReason; String? _selectedLearningReason; String? get selectedLearningReason => _selectedLearningReason; final List _learningReasons = [ 'Speak confidently at work or school', 'Travel or handle daily situations', 'Connect with family or friends', 'General skills expansion', 'Other' ]; List get learningReasons => _learningReasons; // Full name void setFullNameFocus() { _focusFullName = true; rebuildUi(); } // Education background void setSelectedEducationalBackground(String title) { _selectedEducationalBackground = title; rebuildUi(); } bool isSelectedEducationalBackground(String title) => _selectedEducationalBackground == title; // Age group void setSelectedAgeGroup(String title) { _selectedAgeGroup = title; rebuildUi(); } bool isSelectedAgeGroup(String title) => _selectedAgeGroup == title; // Occupation void setOccupationFocus() { _focusOccupation = true; rebuildUi(); } // Country Future> getCountries() async => ['Ethiopia', 'Djibouti']; // Region Future> getRegions(String country) async => ['Addis Ababa', 'Oromia']; // Learning goal void setSelectedLearningGoal(String title) { _selectedLearningGoal = title; rebuildUi(); } bool isSelectedLearningGoal(String title) => _selectedLearningGoal == title; // Learning reason void setLearningReasonFocus() { _focusLearningReason = true; rebuildUi(); } void setSelectedLearningReason(String title) { _selectedLearningReason = title; if (title.toLowerCase() == 'other') { _showTextBox = true; } else { if (_showTextBox) { _showTextBox = false; _focusLearningReason = false; } } rebuildUi(); } bool isSelectedLearningReason(String title) => _selectedLearningReason == title; void next() { _currentStep++; rebuildUi(); } void pop() { _currentStep--; rebuildUi(); } }