feat : module page
This commit is contained in:
@@ -1,16 +1,18 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
import 'package:rasadyar_core/data/model/local/user_local/user_local_model.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
part 'module_model.freezed.dart';
|
||||
|
||||
|
||||
@freezed
|
||||
abstract class ModuleModel with _$ModuleModel{
|
||||
const factory ModuleModel({
|
||||
factory ModuleModel({
|
||||
required String title,
|
||||
required String icon,
|
||||
required Module module,
|
||||
required Color borderColor,
|
||||
required Color backgroundColor,
|
||||
required Color titleColor,
|
||||
Module? module,
|
||||
}) = _ModuleModel;
|
||||
|
||||
}
|
||||
@@ -14,7 +14,7 @@ T _$identity<T>(T value) => value;
|
||||
/// @nodoc
|
||||
mixin _$ModuleModel {
|
||||
|
||||
String get title; String get icon; Module get module;
|
||||
String get title; String get icon; Color get borderColor; Color get backgroundColor; Color get titleColor; Module? get module;
|
||||
/// Create a copy of ModuleModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@@ -25,16 +25,16 @@ $ModuleModelCopyWith<ModuleModel> get copyWith => _$ModuleModelCopyWithImpl<Modu
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is ModuleModel&&(identical(other.title, title) || other.title == title)&&(identical(other.icon, icon) || other.icon == icon)&&(identical(other.module, module) || other.module == module));
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is ModuleModel&&(identical(other.title, title) || other.title == title)&&(identical(other.icon, icon) || other.icon == icon)&&(identical(other.borderColor, borderColor) || other.borderColor == borderColor)&&(identical(other.backgroundColor, backgroundColor) || other.backgroundColor == backgroundColor)&&(identical(other.titleColor, titleColor) || other.titleColor == titleColor)&&(identical(other.module, module) || other.module == module));
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,title,icon,module);
|
||||
int get hashCode => Object.hash(runtimeType,title,icon,borderColor,backgroundColor,titleColor,module);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'ModuleModel(title: $title, icon: $icon, module: $module)';
|
||||
return 'ModuleModel(title: $title, icon: $icon, borderColor: $borderColor, backgroundColor: $backgroundColor, titleColor: $titleColor, module: $module)';
|
||||
}
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ abstract mixin class $ModuleModelCopyWith<$Res> {
|
||||
factory $ModuleModelCopyWith(ModuleModel value, $Res Function(ModuleModel) _then) = _$ModuleModelCopyWithImpl;
|
||||
@useResult
|
||||
$Res call({
|
||||
String title, String icon, Module module
|
||||
String title, String icon, Color borderColor, Color backgroundColor, Color titleColor, Module? module
|
||||
});
|
||||
|
||||
|
||||
@@ -62,12 +62,15 @@ class _$ModuleModelCopyWithImpl<$Res>
|
||||
|
||||
/// Create a copy of ModuleModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline') @override $Res call({Object? title = null,Object? icon = null,Object? module = null,}) {
|
||||
@pragma('vm:prefer-inline') @override $Res call({Object? title = null,Object? icon = null,Object? borderColor = null,Object? backgroundColor = null,Object? titleColor = null,Object? module = freezed,}) {
|
||||
return _then(_self.copyWith(
|
||||
title: null == title ? _self.title : title // ignore: cast_nullable_to_non_nullable
|
||||
as String,icon: null == icon ? _self.icon : icon // ignore: cast_nullable_to_non_nullable
|
||||
as String,module: null == module ? _self.module : module // ignore: cast_nullable_to_non_nullable
|
||||
as Module,
|
||||
as String,borderColor: null == borderColor ? _self.borderColor : borderColor // ignore: cast_nullable_to_non_nullable
|
||||
as Color,backgroundColor: null == backgroundColor ? _self.backgroundColor : backgroundColor // ignore: cast_nullable_to_non_nullable
|
||||
as Color,titleColor: null == titleColor ? _self.titleColor : titleColor // ignore: cast_nullable_to_non_nullable
|
||||
as Color,module: freezed == module ? _self.module : module // ignore: cast_nullable_to_non_nullable
|
||||
as Module?,
|
||||
));
|
||||
}
|
||||
|
||||
@@ -152,10 +155,10 @@ return $default(_that);case _:
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String title, String icon, Module module)? $default,{required TResult orElse(),}) {final _that = this;
|
||||
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String title, String icon, Color borderColor, Color backgroundColor, Color titleColor, Module? module)? $default,{required TResult orElse(),}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _ModuleModel() when $default != null:
|
||||
return $default(_that.title,_that.icon,_that.module);case _:
|
||||
return $default(_that.title,_that.icon,_that.borderColor,_that.backgroundColor,_that.titleColor,_that.module);case _:
|
||||
return orElse();
|
||||
|
||||
}
|
||||
@@ -173,10 +176,10 @@ return $default(_that.title,_that.icon,_that.module);case _:
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String title, String icon, Module module) $default,) {final _that = this;
|
||||
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String title, String icon, Color borderColor, Color backgroundColor, Color titleColor, Module? module) $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _ModuleModel():
|
||||
return $default(_that.title,_that.icon,_that.module);case _:
|
||||
return $default(_that.title,_that.icon,_that.borderColor,_that.backgroundColor,_that.titleColor,_that.module);case _:
|
||||
throw StateError('Unexpected subclass');
|
||||
|
||||
}
|
||||
@@ -193,10 +196,10 @@ return $default(_that.title,_that.icon,_that.module);case _:
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String title, String icon, Module module)? $default,) {final _that = this;
|
||||
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String title, String icon, Color borderColor, Color backgroundColor, Color titleColor, Module? module)? $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _ModuleModel() when $default != null:
|
||||
return $default(_that.title,_that.icon,_that.module);case _:
|
||||
return $default(_that.title,_that.icon,_that.borderColor,_that.backgroundColor,_that.titleColor,_that.module);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
@@ -208,12 +211,15 @@ return $default(_that.title,_that.icon,_that.module);case _:
|
||||
|
||||
|
||||
class _ModuleModel implements ModuleModel {
|
||||
const _ModuleModel({required this.title, required this.icon, required this.module});
|
||||
_ModuleModel({required this.title, required this.icon, required this.borderColor, required this.backgroundColor, required this.titleColor, this.module});
|
||||
|
||||
|
||||
@override final String title;
|
||||
@override final String icon;
|
||||
@override final Module module;
|
||||
@override final Color borderColor;
|
||||
@override final Color backgroundColor;
|
||||
@override final Color titleColor;
|
||||
@override final Module? module;
|
||||
|
||||
/// Create a copy of ModuleModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@@ -225,16 +231,16 @@ _$ModuleModelCopyWith<_ModuleModel> get copyWith => __$ModuleModelCopyWithImpl<_
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _ModuleModel&&(identical(other.title, title) || other.title == title)&&(identical(other.icon, icon) || other.icon == icon)&&(identical(other.module, module) || other.module == module));
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _ModuleModel&&(identical(other.title, title) || other.title == title)&&(identical(other.icon, icon) || other.icon == icon)&&(identical(other.borderColor, borderColor) || other.borderColor == borderColor)&&(identical(other.backgroundColor, backgroundColor) || other.backgroundColor == backgroundColor)&&(identical(other.titleColor, titleColor) || other.titleColor == titleColor)&&(identical(other.module, module) || other.module == module));
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,title,icon,module);
|
||||
int get hashCode => Object.hash(runtimeType,title,icon,borderColor,backgroundColor,titleColor,module);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'ModuleModel(title: $title, icon: $icon, module: $module)';
|
||||
return 'ModuleModel(title: $title, icon: $icon, borderColor: $borderColor, backgroundColor: $backgroundColor, titleColor: $titleColor, module: $module)';
|
||||
}
|
||||
|
||||
|
||||
@@ -245,7 +251,7 @@ abstract mixin class _$ModuleModelCopyWith<$Res> implements $ModuleModelCopyWith
|
||||
factory _$ModuleModelCopyWith(_ModuleModel value, $Res Function(_ModuleModel) _then) = __$ModuleModelCopyWithImpl;
|
||||
@override @useResult
|
||||
$Res call({
|
||||
String title, String icon, Module module
|
||||
String title, String icon, Color borderColor, Color backgroundColor, Color titleColor, Module? module
|
||||
});
|
||||
|
||||
|
||||
@@ -262,12 +268,15 @@ class __$ModuleModelCopyWithImpl<$Res>
|
||||
|
||||
/// Create a copy of ModuleModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @pragma('vm:prefer-inline') $Res call({Object? title = null,Object? icon = null,Object? module = null,}) {
|
||||
@override @pragma('vm:prefer-inline') $Res call({Object? title = null,Object? icon = null,Object? borderColor = null,Object? backgroundColor = null,Object? titleColor = null,Object? module = freezed,}) {
|
||||
return _then(_ModuleModel(
|
||||
title: null == title ? _self.title : title // ignore: cast_nullable_to_non_nullable
|
||||
as String,icon: null == icon ? _self.icon : icon // ignore: cast_nullable_to_non_nullable
|
||||
as String,module: null == module ? _self.module : module // ignore: cast_nullable_to_non_nullable
|
||||
as Module,
|
||||
as String,borderColor: null == borderColor ? _self.borderColor : borderColor // ignore: cast_nullable_to_non_nullable
|
||||
as Color,backgroundColor: null == backgroundColor ? _self.backgroundColor : backgroundColor // ignore: cast_nullable_to_non_nullable
|
||||
as Color,titleColor: null == titleColor ? _self.titleColor : titleColor // ignore: cast_nullable_to_non_nullable
|
||||
as Color,module: freezed == module ? _self.module : module // ignore: cast_nullable_to_non_nullable
|
||||
as Module?,
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user