93 lines
2.1 KiB
Dart
93 lines
2.1 KiB
Dart
import 'package:equatable/equatable.dart';
|
|
import 'package:maibu_satabot_v2/features/v2/my/domain/entities/my_entities.dart';
|
|
|
|
/// 用户信息数据模型
|
|
class UserProfileModel extends Equatable {
|
|
const UserProfileModel({
|
|
required this.name,
|
|
required this.role,
|
|
required this.avatar,
|
|
required this.userId,
|
|
});
|
|
|
|
final String name;
|
|
final String role;
|
|
final String avatar;
|
|
final String userId;
|
|
|
|
/// 转换为实体
|
|
UserProfileEntity toEntity() {
|
|
return UserProfileEntity(
|
|
name: name,
|
|
role: role,
|
|
avatar: avatar,
|
|
userId: userId,
|
|
);
|
|
}
|
|
|
|
@override
|
|
List<Object?> get props => [name, role, avatar, userId];
|
|
}
|
|
|
|
/// 菜单项数据模型
|
|
class MenuItemModel extends Equatable {
|
|
const MenuItemModel({
|
|
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;
|
|
|
|
/// 转换为实体
|
|
MenuItemEntity toEntity() {
|
|
return MenuItemEntity(
|
|
id: id,
|
|
title: title,
|
|
icon: icon,
|
|
subTitle: subTitle,
|
|
hasSwitch: hasSwitch,
|
|
switchValue: switchValue,
|
|
hasBadge: hasBadge,
|
|
badgeCount: badgeCount,
|
|
);
|
|
}
|
|
|
|
MenuItemModel copyWith({
|
|
String? id,
|
|
String? title,
|
|
String? icon,
|
|
String? subTitle,
|
|
bool? hasSwitch,
|
|
bool? switchValue,
|
|
bool? hasBadge,
|
|
int? badgeCount,
|
|
}) {
|
|
return MenuItemModel(
|
|
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,
|
|
);
|
|
}
|
|
|
|
@override
|
|
List<Object?> get props => [id, title, icon, subTitle, hasSwitch, switchValue, hasBadge, badgeCount];
|
|
}
|