2023-03-03 12:48:19 +01:00
|
|
|
import 'package:flutter/material.dart';
|
2023-03-05 21:37:27 +01:00
|
|
|
import 'package:smoke_cess_app/services/pages_service.dart';
|
2023-03-03 12:48:19 +01:00
|
|
|
|
|
|
|
class PageProvider extends ChangeNotifier {
|
|
|
|
bool showForm = false;
|
2023-03-05 21:37:27 +01:00
|
|
|
Pages _currentPage = Pages.settings;
|
2023-03-03 12:48:19 +01:00
|
|
|
|
|
|
|
void swap() {
|
|
|
|
showForm = !showForm;
|
|
|
|
notifyListeners();
|
|
|
|
}
|
2023-03-05 21:37:27 +01:00
|
|
|
|
|
|
|
Map<String, dynamic> get currentPageData => pages[_currentPage]!;
|
|
|
|
|
|
|
|
int get currentPageIndex => _currentPage.index;
|
|
|
|
|
2023-03-05 21:44:51 +01:00
|
|
|
void setCurrentPage(int index) {
|
2023-03-05 21:37:27 +01:00
|
|
|
showForm = false;
|
|
|
|
_currentPage = Pages.values[index];
|
|
|
|
notifyListeners();
|
|
|
|
}
|
2023-03-03 12:48:19 +01:00
|
|
|
}
|