import 'package:stacked/stacked.dart'; import 'package:stacked_services/stacked_services.dart'; import '../../../app/app.locator.dart'; class LearnPracticeViewModel extends BaseViewModel { final _navigationService = locator(); // In-app navigation int _currentIndex = 0; int get currentIndex => _currentIndex; // Practice results final List> _practiceResults = [ {'question': 'What is your name?'}, {'question': 'Where are you from?'}, {'question': 'Where are you from?'} ]; List> get practiceResults => _practiceResults; // In-app navigation void goTo(int page) { _currentIndex = page; rebuildUi(); } void goBack() { if (_currentIndex == 0) { pop(); } else { _currentIndex--; rebuildUi(); } } // Navigation void pop() => _navigationService.back(); }