import 'package:flutter/widgets.dart';
import 'package:vitalapp/routes/route_setting.dart';

/// 导航菜单项
///
/// [onTap] 或 [route] 或 [pageBuilder] 不可同时为空
///
/// 优先级 [onTap] > [pageBuilder] > [route]
class VSideNavMenuItem {
  /// 标题
  final String title;

  /// 路由
  final VRouteSetting? route;

  /// 描述
  final String? description;

  /// 图标
  final Widget? icon;

  /// 是否必填
  final bool? isRequired;

  /// 单击回调
  final VoidCallback? onTap;

  /// 页面构建器
  final WidgetBuilder? pageBuilder;

  /// 是否从此项开始重排
  final bool shouldRearrage;

  VSideNavMenuItem({
    required this.title,
    this.route,
    this.description,
    this.icon,
    this.onTap,
    this.shouldRearrage = false,
    this.isRequired,
    this.pageBuilder,
  }) : assert(route != null || onTap != null || pageBuilder != null);
}
