82 lines
1.8 KiB
Dart
82 lines
1.8 KiB
Dart
import 'package:equatable/equatable.dart';
|
|
|
|
/// 用户信息实体
|
|
class UserProfileEntity extends Equatable {
|
|
const UserProfileEntity({
|
|
required this.name,
|
|
required this.role,
|
|
required this.avatar,
|
|
required this.userId,
|
|
});
|
|
|
|
final String name;
|
|
final String role;
|
|
final String avatar;
|
|
final String userId;
|
|
|
|
@override
|
|
List<Object?> get props => [name, role, avatar, userId];
|
|
|
|
UserProfileEntity copyWith({
|
|
String? name,
|
|
String? role,
|
|
String? avatar,
|
|
String? userId,
|
|
}) {
|
|
return UserProfileEntity(
|
|
name: name ?? this.name,
|
|
role: role ?? this.role,
|
|
avatar: avatar ?? this.avatar,
|
|
userId: userId ?? this.userId,
|
|
);
|
|
}
|
|
}
|
|
|
|
/// 我的页面菜单项实体
|
|
class MenuItemEntity extends Equatable {
|
|
const MenuItemEntity({
|
|
required this.id,
|
|
required this.title,
|
|
required this.icon,
|
|
this.subTitle,
|
|
this.hasSwitch = false,
|
|
this.switchValue = false,
|
|
this.hasBadge = false,
|
|
this.badgeCount = 0,
|
|
});
|
|
|
|
final String id;
|
|
final String title;
|
|
final String icon;
|
|
final String? subTitle;
|
|
final bool hasSwitch;
|
|
final bool switchValue;
|
|
final bool hasBadge;
|
|
final int badgeCount;
|
|
|
|
@override
|
|
List<Object?> get props => [id, title, icon, subTitle, hasSwitch, switchValue, hasBadge, badgeCount];
|
|
|
|
MenuItemEntity copyWith({
|
|
String? id,
|
|
String? title,
|
|
String? icon,
|
|
String? subTitle,
|
|
bool? hasSwitch,
|
|
bool? switchValue,
|
|
bool? hasBadge,
|
|
int? badgeCount,
|
|
}) {
|
|
return MenuItemEntity(
|
|
id: id ?? this.id,
|
|
title: title ?? this.title,
|
|
icon: icon ?? this.icon,
|
|
subTitle: subTitle ?? this.subTitle,
|
|
hasSwitch: hasSwitch ?? this.hasSwitch,
|
|
switchValue: switchValue ?? this.switchValue,
|
|
hasBadge: hasBadge ?? this.hasBadge,
|
|
badgeCount: badgeCount ?? this.badgeCount,
|
|
);
|
|
}
|
|
}
|