所有一级页面和不分二级页面
This commit is contained in:
92
lib/features/v2/my/data/models/my_models.dart
Normal file
92
lib/features/v2/my/data/models/my_models.dart
Normal file
@@ -0,0 +1,92 @@
|
||||
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];
|
||||
}
|
||||
Reference in New Issue
Block a user