import 'package:fis_common/event/event_type.dart';
import 'package:flutter/material.dart';

class VSideNavViewController {
  String? _currentRoute;

  /// 当前路由
  String? get currentRoute => _currentRoute;

  /// 路由变更事件
  final routeChangedEvent = FEventHandler<String?>();

  /// 页面变更事件
  final pageChangedEvent = FEventHandler<WidgetBuilder?>();

  VSideNavViewController() {
    routeChangedEvent.addListener(_onRouteChanged);
  }

  /// 释放资源
  void dispose() {
    routeChangedEvent.removeListener(_onRouteChanged);
  }

  void _onRouteChanged(_, String? e) {
    _currentRoute = e;
  }
}
