controller.dart 631 B

12345678910111213141516171819202122232425262728
  1. import 'package:fis_common/event/event_type.dart';
  2. import 'package:flutter/material.dart';
  3. class VSideNavViewController {
  4. String? _currentTitle;
  5. /// 当前title
  6. String? get currentTitle => _currentTitle;
  7. /// 路由变更事件
  8. final titleChangedEvent = FEventHandler<String?>();
  9. /// 页面变更事件
  10. final pageChangedEvent = FEventHandler<WidgetBuilder?>();
  11. VSideNavViewController() {
  12. titleChangedEvent.addListener(_onTitleChanged);
  13. }
  14. /// 释放资源
  15. void dispose() {
  16. titleChangedEvent.removeListener(_onTitleChanged);
  17. }
  18. void _onTitleChanged(_, String? e) {
  19. _currentTitle = e;
  20. }
  21. }