29 lines
574 B
Dart
29 lines
574 B
Dart
|
import 'package:flutter/material.dart';
|
||
|
|
||
|
class RouteState extends ChangeNotifier {
|
||
|
String currentPathName = '';
|
||
|
Map<String, dynamic> query = {};
|
||
|
bool isVisible = true;
|
||
|
|
||
|
void changeRoute(String newPath, {Map<String, String>? newQuery}) {
|
||
|
currentPathName = newPath;
|
||
|
if (newQuery != null) {
|
||
|
query.clear();
|
||
|
query = newQuery;
|
||
|
} else {
|
||
|
query = {};
|
||
|
}
|
||
|
notifyListeners();
|
||
|
}
|
||
|
|
||
|
void changeVisibility(bool visible) {
|
||
|
isVisible = visible;
|
||
|
}
|
||
|
|
||
|
void clear() {
|
||
|
currentPathName = '';
|
||
|
isVisible = true;
|
||
|
query.clear();
|
||
|
}
|
||
|
}
|