Skip to content

Commit

Permalink
Merge pull request #186 from Securrency-OSS/dv/code-formatting
Browse files Browse the repository at this point in the history
fix: Code refactoring
  • Loading branch information
i-asimkhan authored Aug 23, 2023
2 parents f6c4851 + 16233be commit dd9bba1
Show file tree
Hide file tree
Showing 12 changed files with 57 additions and 69 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ part 'mirai_check_box_widget.g.dart';
@freezed
class MiraiCheckBoxWidget with _$MiraiCheckBoxWidget {
const factory MiraiCheckBoxWidget({
required String id,
String? id,
bool? value,
String? activeColor,
MiraiMaterialColor? fillColor,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ MiraiCheckBoxWidget _$MiraiCheckBoxWidgetFromJson(Map<String, dynamic> json) {

/// @nodoc
mixin _$MiraiCheckBoxWidget {
String get id => throw _privateConstructorUsedError;
String? get id => throw _privateConstructorUsedError;
bool? get value => throw _privateConstructorUsedError;
String? get activeColor => throw _privateConstructorUsedError;
MiraiMaterialColor? get fillColor => throw _privateConstructorUsedError;
Expand All @@ -46,7 +46,7 @@ abstract class $MiraiCheckBoxWidgetCopyWith<$Res> {
_$MiraiCheckBoxWidgetCopyWithImpl<$Res, MiraiCheckBoxWidget>;
@useResult
$Res call(
{String id,
{String? id,
bool? value,
String? activeColor,
MiraiMaterialColor? fillColor,
Expand Down Expand Up @@ -76,7 +76,7 @@ class _$MiraiCheckBoxWidgetCopyWithImpl<$Res, $Val extends MiraiCheckBoxWidget>
@pragma('vm:prefer-inline')
@override
$Res call({
Object? id = null,
Object? id = freezed,
Object? value = freezed,
Object? activeColor = freezed,
Object? fillColor = freezed,
Expand All @@ -90,10 +90,10 @@ class _$MiraiCheckBoxWidgetCopyWithImpl<$Res, $Val extends MiraiCheckBoxWidget>
Object? isError = null,
}) {
return _then(_value.copyWith(
id: null == id
id: freezed == id
? _value.id
: id // ignore: cast_nullable_to_non_nullable
as String,
as String?,
value: freezed == value
? _value.value
: value // ignore: cast_nullable_to_non_nullable
Expand Down Expand Up @@ -175,7 +175,7 @@ abstract class _$$_MiraiCheckBoxWidgetCopyWith<$Res>
@override
@useResult
$Res call(
{String id,
{String? id,
bool? value,
String? activeColor,
MiraiMaterialColor? fillColor,
Expand Down Expand Up @@ -205,7 +205,7 @@ class __$$_MiraiCheckBoxWidgetCopyWithImpl<$Res>
@pragma('vm:prefer-inline')
@override
$Res call({
Object? id = null,
Object? id = freezed,
Object? value = freezed,
Object? activeColor = freezed,
Object? fillColor = freezed,
Expand All @@ -219,10 +219,10 @@ class __$$_MiraiCheckBoxWidgetCopyWithImpl<$Res>
Object? isError = null,
}) {
return _then(_$_MiraiCheckBoxWidget(
id: null == id
id: freezed == id
? _value.id
: id // ignore: cast_nullable_to_non_nullable
as String,
as String?,
value: freezed == value
? _value.value
: value // ignore: cast_nullable_to_non_nullable
Expand Down Expand Up @@ -275,7 +275,7 @@ class __$$_MiraiCheckBoxWidgetCopyWithImpl<$Res>
@JsonSerializable()
class _$_MiraiCheckBoxWidget implements _MiraiCheckBoxWidget {
const _$_MiraiCheckBoxWidget(
{required this.id,
{this.id,
this.value,
this.activeColor,
this.fillColor,
Expand All @@ -292,7 +292,7 @@ class _$_MiraiCheckBoxWidget implements _MiraiCheckBoxWidget {
_$$_MiraiCheckBoxWidgetFromJson(json);

@override
final String id;
final String? id;
@override
final bool? value;
@override
Expand Down Expand Up @@ -386,7 +386,7 @@ class _$_MiraiCheckBoxWidget implements _MiraiCheckBoxWidget {

abstract class _MiraiCheckBoxWidget implements MiraiCheckBoxWidget {
const factory _MiraiCheckBoxWidget(
{required final String id,
{final String? id,
final bool? value,
final String? activeColor,
final MiraiMaterialColor? fillColor,
Expand All @@ -403,7 +403,7 @@ abstract class _MiraiCheckBoxWidget implements MiraiCheckBoxWidget {
_$_MiraiCheckBoxWidget.fromJson;

@override
String get id;
String? get id;
@override
bool? get value;
@override
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import 'package:mirai/src/parsers/mirai_check_box_widget/mirai_check_box_widget.
import 'package:mirai/src/parsers/mirai_form/cubit/mirai_form_cubit.dart';
import 'package:mirai/src/parsers/mirai_material_color/mirai_material_color.dart';
import 'package:mirai/src/utils/color_utils.dart';
import 'package:mirai/src/utils/log.dart';
import 'package:mirai/src/utils/widget_type.dart';

class MiraiCheckBoxWidgetParser extends MiraiParser<MiraiCheckBoxWidget> {
Expand Down Expand Up @@ -40,12 +39,10 @@ class __MiraiCheckBoxWidgetState extends State<_MiraiCheckBoxWidget> {

@override
void initState() {
try {
if (widget.model.id != null) {
context
.read<MiraiFormCubit>()
.registerValue(widget.model.id, widget.model.value);
} catch (e) {
Log.d(e);
.registerValue(widget.model.id!, widget.model.value);
}

super.initState();
Expand All @@ -59,16 +56,13 @@ class __MiraiCheckBoxWidgetState extends State<_MiraiCheckBoxWidget> {
setState(() {
isMarkChecked = !isMarkChecked;
});

try {
if (widget.model.id != null) {
context
.read<MiraiFormCubit>()
.updateValue(widget.model.id, isMarkChecked);
.updateValue(widget.model.id!, isMarkChecked);
context
.read<MiraiFormCubit>()
.updateValidation(widget.model.id, isMarkChecked);
} catch (e) {
Log.d(e);
.updateValidation(widget.model.id!, isMarkChecked);
}
},
activeColor: widget.model.activeColor.toColor,
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class MiraiInputDecoration with _$MiraiInputDecoration {
Map<String, dynamic>? counter,
String? counterText,
MiraiTextStyle? counterStyle,
@Default(false) bool filled,
bool? filled,
String? fillColor,
String? hoverColor,
String? focusColor,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ mixin _$MiraiInputDecoration {
Map<String, dynamic>? get counter => throw _privateConstructorUsedError;
String? get counterText => throw _privateConstructorUsedError;
MiraiTextStyle? get counterStyle => throw _privateConstructorUsedError;
bool get filled => throw _privateConstructorUsedError;
bool? get filled => throw _privateConstructorUsedError;
String? get fillColor => throw _privateConstructorUsedError;
String? get hoverColor => throw _privateConstructorUsedError;
String? get focusColor => throw _privateConstructorUsedError;
Expand Down Expand Up @@ -125,7 +125,7 @@ abstract class $MiraiInputDecorationCopyWith<$Res> {
Map<String, dynamic>? counter,
String? counterText,
MiraiTextStyle? counterStyle,
bool filled,
bool? filled,
String? fillColor,
String? hoverColor,
String? focusColor,
Expand Down Expand Up @@ -210,7 +210,7 @@ class _$MiraiInputDecorationCopyWithImpl<$Res,
Object? counter = freezed,
Object? counterText = freezed,
Object? counterStyle = freezed,
Object? filled = null,
Object? filled = freezed,
Object? fillColor = freezed,
Object? hoverColor = freezed,
Object? focusColor = freezed,
Expand Down Expand Up @@ -370,10 +370,10 @@ class _$MiraiInputDecorationCopyWithImpl<$Res,
? _value.counterStyle
: counterStyle // ignore: cast_nullable_to_non_nullable
as MiraiTextStyle?,
filled: null == filled
filled: freezed == filled
? _value.filled
: filled // ignore: cast_nullable_to_non_nullable
as bool,
as bool?,
fillColor: freezed == fillColor
? _value.fillColor
: fillColor // ignore: cast_nullable_to_non_nullable
Expand Down Expand Up @@ -693,7 +693,7 @@ abstract class _$$_MiraiInputDecorationCopyWith<$Res>
Map<String, dynamic>? counter,
String? counterText,
MiraiTextStyle? counterStyle,
bool filled,
bool? filled,
String? fillColor,
String? hoverColor,
String? focusColor,
Expand Down Expand Up @@ -793,7 +793,7 @@ class __$$_MiraiInputDecorationCopyWithImpl<$Res>
Object? counter = freezed,
Object? counterText = freezed,
Object? counterStyle = freezed,
Object? filled = null,
Object? filled = freezed,
Object? fillColor = freezed,
Object? hoverColor = freezed,
Object? focusColor = freezed,
Expand Down Expand Up @@ -953,10 +953,10 @@ class __$$_MiraiInputDecorationCopyWithImpl<$Res>
? _value.counterStyle
: counterStyle // ignore: cast_nullable_to_non_nullable
as MiraiTextStyle?,
filled: null == filled
filled: freezed == filled
? _value.filled
: filled // ignore: cast_nullable_to_non_nullable
as bool,
as bool?,
fillColor: freezed == fillColor
? _value.fillColor
: fillColor // ignore: cast_nullable_to_non_nullable
Expand Down Expand Up @@ -1053,7 +1053,7 @@ class _$_MiraiInputDecoration implements _MiraiInputDecoration {
final Map<String, dynamic>? counter,
this.counterText,
this.counterStyle,
this.filled = false,
this.filled,
this.fillColor,
this.hoverColor,
this.focusColor,
Expand Down Expand Up @@ -1209,8 +1209,7 @@ class _$_MiraiInputDecoration implements _MiraiInputDecoration {
@override
final MiraiTextStyle? counterStyle;
@override
@JsonKey()
final bool filled;
final bool? filled;
@override
final String? fillColor;
@override
Expand Down Expand Up @@ -1452,7 +1451,7 @@ abstract class _MiraiInputDecoration implements MiraiInputDecoration {
final Map<String, dynamic>? counter,
final String? counterText,
final MiraiTextStyle? counterStyle,
final bool filled,
final bool? filled,
final String? fillColor,
final String? hoverColor,
final String? focusColor,
Expand Down Expand Up @@ -1543,7 +1542,7 @@ abstract class _MiraiInputDecoration implements MiraiInputDecoration {
@override
MiraiTextStyle? get counterStyle;
@override
bool get filled;
bool? get filled;
@override
String? get fillColor;
@override
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ part 'mirai_text_form_field.g.dart';
@freezed
class MiraiTextFormField with _$MiraiTextFormField {
const factory MiraiTextFormField({
required String id,
String? id,
String? compareId,
MiraiInputDecoration? decoration,
String? initialValue,
Expand Down
Loading

0 comments on commit dd9bba1

Please sign in to comment.