From cd198ac297fe2d62c2dfde2b72d2c0701e591b58 Mon Sep 17 00:00:00 2001 From: Divyanshu Bhargava Date: Wed, 7 Feb 2024 18:40:01 +0400 Subject: [PATCH 1/2] Add Mirai Network Widget --- packages/mirai/lib/src/framework/mirai.dart | 2 + .../mirai_align/mirai_align.freezed.dart | 42 +- .../parsers/mirai_align/mirai_align.g.dart | 6 +- .../mirai_expanded.freezed.dart | 43 +- .../mirai_expanded/mirai_expanded.g.dart | 6 +- .../mirai_network_widget.dart | 15 + .../mirai_network_widget.freezed.dart | 166 ++++++++ .../mirai_network_widget.g.dart | 19 + .../mirai_network_widget_parser.dart | 20 + .../mirai_page_view.freezed.dart | 382 +++++++++--------- .../mirai_page_view/mirai_page_view.g.dart | 76 ++-- .../mirai_tab_bar/mirai_tab_bar.freezed.dart | 42 +- .../mirai_tab_bar/mirai_tab_bar.g.dart | 6 +- .../mirai_text/mirai_text.freezed.dart | 85 ++-- .../src/parsers/mirai_text/mirai_text.g.dart | 11 +- packages/mirai/lib/src/utils/widget_type.dart | 1 + 16 files changed, 571 insertions(+), 351 deletions(-) create mode 100644 packages/mirai/lib/src/parsers/mirai_network_widget/mirai_network_widget.dart create mode 100644 packages/mirai/lib/src/parsers/mirai_network_widget/mirai_network_widget.freezed.dart create mode 100644 packages/mirai/lib/src/parsers/mirai_network_widget/mirai_network_widget.g.dart create mode 100644 packages/mirai/lib/src/parsers/mirai_network_widget/mirai_network_widget_parser.dart diff --git a/packages/mirai/lib/src/framework/mirai.dart b/packages/mirai/lib/src/framework/mirai.dart index 4a81066f..631e5de4 100644 --- a/packages/mirai/lib/src/framework/mirai.dart +++ b/packages/mirai/lib/src/framework/mirai.dart @@ -14,6 +14,7 @@ import 'package:mirai/src/parsers/mirai_check_box_widget/mirai_check_box_widget_ import 'package:mirai/src/parsers/mirai_form/mirai_form_parser.dart'; import 'package:mirai/src/parsers/mirai_form_field/mirai_form_field_parser.dart'; import 'package:mirai/src/parsers/mirai_fractionally_sized_box/mirai_fractionally_sized_box_parser.dart'; +import 'package:mirai/src/parsers/mirai_network_widget/mirai_network_widget_parser.dart'; import 'package:mirai/src/parsers/mirai_switch/mirai_switch_parser.dart'; import 'package:mirai/src/parsers/mirai_tab/mirai_tab_parser.dart'; import 'package:mirai/src/parsers/parsers.dart'; @@ -69,6 +70,7 @@ class Mirai { const MiraiSwitchParser(), const MiraiAlignParser(), const MiraiPageViewParser(), + const MiraiNetworkWidgetParser(), ]; static final _actionParsers = [ diff --git a/packages/mirai/lib/src/parsers/mirai_align/mirai_align.freezed.dart b/packages/mirai/lib/src/parsers/mirai_align/mirai_align.freezed.dart index c286282e..e5b1cd10 100644 --- a/packages/mirai/lib/src/parsers/mirai_align/mirai_align.freezed.dart +++ b/packages/mirai/lib/src/parsers/mirai_align/mirai_align.freezed.dart @@ -84,11 +84,11 @@ class _$MiraiAlignCopyWithImpl<$Res, $Val extends MiraiAlign> } /// @nodoc -abstract class _$$MiraiAlignImplCopyWith<$Res> +abstract class _$$_MiraiAlignCopyWith<$Res> implements $MiraiAlignCopyWith<$Res> { - factory _$$MiraiAlignImplCopyWith( - _$MiraiAlignImpl value, $Res Function(_$MiraiAlignImpl) then) = - __$$MiraiAlignImplCopyWithImpl<$Res>; + factory _$$_MiraiAlignCopyWith( + _$_MiraiAlign value, $Res Function(_$_MiraiAlign) then) = + __$$_MiraiAlignCopyWithImpl<$Res>; @override @useResult $Res call( @@ -99,11 +99,11 @@ abstract class _$$MiraiAlignImplCopyWith<$Res> } /// @nodoc -class __$$MiraiAlignImplCopyWithImpl<$Res> - extends _$MiraiAlignCopyWithImpl<$Res, _$MiraiAlignImpl> - implements _$$MiraiAlignImplCopyWith<$Res> { - __$$MiraiAlignImplCopyWithImpl( - _$MiraiAlignImpl _value, $Res Function(_$MiraiAlignImpl) _then) +class __$$_MiraiAlignCopyWithImpl<$Res> + extends _$MiraiAlignCopyWithImpl<$Res, _$_MiraiAlign> + implements _$$_MiraiAlignCopyWith<$Res> { + __$$_MiraiAlignCopyWithImpl( + _$_MiraiAlign _value, $Res Function(_$_MiraiAlign) _then) : super(_value, _then); @pragma('vm:prefer-inline') @@ -114,7 +114,7 @@ class __$$MiraiAlignImplCopyWithImpl<$Res> Object? heightFactor = freezed, Object? child = freezed, }) { - return _then(_$MiraiAlignImpl( + return _then(_$_MiraiAlign( alignment: null == alignment ? _value.alignment : alignment // ignore: cast_nullable_to_non_nullable @@ -137,16 +137,16 @@ class __$$MiraiAlignImplCopyWithImpl<$Res> /// @nodoc @JsonSerializable() -class _$MiraiAlignImpl implements _MiraiAlign { - const _$MiraiAlignImpl( +class _$_MiraiAlign implements _MiraiAlign { + const _$_MiraiAlign( {this.alignment = MiraiAlignmentDirectional.center, this.widthFactor, this.heightFactor, final Map? child}) : _child = child; - factory _$MiraiAlignImpl.fromJson(Map json) => - _$$MiraiAlignImplFromJson(json); + factory _$_MiraiAlign.fromJson(Map json) => + _$$_MiraiAlignFromJson(json); @override @JsonKey() @@ -174,7 +174,7 @@ class _$MiraiAlignImpl implements _MiraiAlign { bool operator ==(dynamic other) { return identical(this, other) || (other.runtimeType == runtimeType && - other is _$MiraiAlignImpl && + other is _$_MiraiAlign && (identical(other.alignment, alignment) || other.alignment == alignment) && (identical(other.widthFactor, widthFactor) || @@ -192,12 +192,12 @@ class _$MiraiAlignImpl implements _MiraiAlign { @JsonKey(ignore: true) @override @pragma('vm:prefer-inline') - _$$MiraiAlignImplCopyWith<_$MiraiAlignImpl> get copyWith => - __$$MiraiAlignImplCopyWithImpl<_$MiraiAlignImpl>(this, _$identity); + _$$_MiraiAlignCopyWith<_$_MiraiAlign> get copyWith => + __$$_MiraiAlignCopyWithImpl<_$_MiraiAlign>(this, _$identity); @override Map toJson() { - return _$$MiraiAlignImplToJson( + return _$$_MiraiAlignToJson( this, ); } @@ -208,10 +208,10 @@ abstract class _MiraiAlign implements MiraiAlign { {final MiraiAlignmentDirectional alignment, final double? widthFactor, final double? heightFactor, - final Map? child}) = _$MiraiAlignImpl; + final Map? child}) = _$_MiraiAlign; factory _MiraiAlign.fromJson(Map json) = - _$MiraiAlignImpl.fromJson; + _$_MiraiAlign.fromJson; @override MiraiAlignmentDirectional get alignment; @@ -223,6 +223,6 @@ abstract class _MiraiAlign implements MiraiAlign { Map? get child; @override @JsonKey(ignore: true) - _$$MiraiAlignImplCopyWith<_$MiraiAlignImpl> get copyWith => + _$$_MiraiAlignCopyWith<_$_MiraiAlign> get copyWith => throw _privateConstructorUsedError; } diff --git a/packages/mirai/lib/src/parsers/mirai_align/mirai_align.g.dart b/packages/mirai/lib/src/parsers/mirai_align/mirai_align.g.dart index 6b56d670..4d886f4c 100644 --- a/packages/mirai/lib/src/parsers/mirai_align/mirai_align.g.dart +++ b/packages/mirai/lib/src/parsers/mirai_align/mirai_align.g.dart @@ -6,8 +6,8 @@ part of 'mirai_align.dart'; // JsonSerializableGenerator // ************************************************************************** -_$MiraiAlignImpl _$$MiraiAlignImplFromJson(Map json) => - _$MiraiAlignImpl( +_$_MiraiAlign _$$_MiraiAlignFromJson(Map json) => + _$_MiraiAlign( alignment: $enumDecodeNullable( _$MiraiAlignmentDirectionalEnumMap, json['alignment']) ?? MiraiAlignmentDirectional.center, @@ -16,7 +16,7 @@ _$MiraiAlignImpl _$$MiraiAlignImplFromJson(Map json) => child: json['child'] as Map?, ); -Map _$$MiraiAlignImplToJson(_$MiraiAlignImpl instance) => +Map _$$_MiraiAlignToJson(_$_MiraiAlign instance) => { 'alignment': _$MiraiAlignmentDirectionalEnumMap[instance.alignment]!, 'widthFactor': instance.widthFactor, diff --git a/packages/mirai/lib/src/parsers/mirai_expanded/mirai_expanded.freezed.dart b/packages/mirai/lib/src/parsers/mirai_expanded/mirai_expanded.freezed.dart index add5e5ab..3ad30bbb 100644 --- a/packages/mirai/lib/src/parsers/mirai_expanded/mirai_expanded.freezed.dart +++ b/packages/mirai/lib/src/parsers/mirai_expanded/mirai_expanded.freezed.dart @@ -68,22 +68,22 @@ class _$MiraiExpandedCopyWithImpl<$Res, $Val extends MiraiExpanded> } /// @nodoc -abstract class _$$MiraiExpandedImplCopyWith<$Res> +abstract class _$$_MiraiExpandedCopyWith<$Res> implements $MiraiExpandedCopyWith<$Res> { - factory _$$MiraiExpandedImplCopyWith( - _$MiraiExpandedImpl value, $Res Function(_$MiraiExpandedImpl) then) = - __$$MiraiExpandedImplCopyWithImpl<$Res>; + factory _$$_MiraiExpandedCopyWith( + _$_MiraiExpanded value, $Res Function(_$_MiraiExpanded) then) = + __$$_MiraiExpandedCopyWithImpl<$Res>; @override @useResult $Res call({int flex, Map? child}); } /// @nodoc -class __$$MiraiExpandedImplCopyWithImpl<$Res> - extends _$MiraiExpandedCopyWithImpl<$Res, _$MiraiExpandedImpl> - implements _$$MiraiExpandedImplCopyWith<$Res> { - __$$MiraiExpandedImplCopyWithImpl( - _$MiraiExpandedImpl _value, $Res Function(_$MiraiExpandedImpl) _then) +class __$$_MiraiExpandedCopyWithImpl<$Res> + extends _$MiraiExpandedCopyWithImpl<$Res, _$_MiraiExpanded> + implements _$$_MiraiExpandedCopyWith<$Res> { + __$$_MiraiExpandedCopyWithImpl( + _$_MiraiExpanded _value, $Res Function(_$_MiraiExpanded) _then) : super(_value, _then); @pragma('vm:prefer-inline') @@ -92,7 +92,7 @@ class __$$MiraiExpandedImplCopyWithImpl<$Res> Object? flex = null, Object? child = freezed, }) { - return _then(_$MiraiExpandedImpl( + return _then(_$_MiraiExpanded( flex: null == flex ? _value.flex : flex // ignore: cast_nullable_to_non_nullable @@ -107,12 +107,12 @@ class __$$MiraiExpandedImplCopyWithImpl<$Res> /// @nodoc @JsonSerializable() -class _$MiraiExpandedImpl implements _MiraiExpanded { - const _$MiraiExpandedImpl({this.flex = 1, final Map? child}) +class _$_MiraiExpanded implements _MiraiExpanded { + const _$_MiraiExpanded({this.flex = 1, final Map? child}) : _child = child; - factory _$MiraiExpandedImpl.fromJson(Map json) => - _$$MiraiExpandedImplFromJson(json); + factory _$_MiraiExpanded.fromJson(Map json) => + _$$_MiraiExpandedFromJson(json); @override @JsonKey() @@ -136,7 +136,7 @@ class _$MiraiExpandedImpl implements _MiraiExpanded { bool operator ==(dynamic other) { return identical(this, other) || (other.runtimeType == runtimeType && - other is _$MiraiExpandedImpl && + other is _$_MiraiExpanded && (identical(other.flex, flex) || other.flex == flex) && const DeepCollectionEquality().equals(other._child, _child)); } @@ -149,12 +149,12 @@ class _$MiraiExpandedImpl implements _MiraiExpanded { @JsonKey(ignore: true) @override @pragma('vm:prefer-inline') - _$$MiraiExpandedImplCopyWith<_$MiraiExpandedImpl> get copyWith => - __$$MiraiExpandedImplCopyWithImpl<_$MiraiExpandedImpl>(this, _$identity); + _$$_MiraiExpandedCopyWith<_$_MiraiExpanded> get copyWith => + __$$_MiraiExpandedCopyWithImpl<_$_MiraiExpanded>(this, _$identity); @override Map toJson() { - return _$$MiraiExpandedImplToJson( + return _$$_MiraiExpandedToJson( this, ); } @@ -162,11 +162,10 @@ class _$MiraiExpandedImpl implements _MiraiExpanded { abstract class _MiraiExpanded implements MiraiExpanded { const factory _MiraiExpanded( - {final int flex, - final Map? child}) = _$MiraiExpandedImpl; + {final int flex, final Map? child}) = _$_MiraiExpanded; factory _MiraiExpanded.fromJson(Map json) = - _$MiraiExpandedImpl.fromJson; + _$_MiraiExpanded.fromJson; @override int get flex; @@ -174,6 +173,6 @@ abstract class _MiraiExpanded implements MiraiExpanded { Map? get child; @override @JsonKey(ignore: true) - _$$MiraiExpandedImplCopyWith<_$MiraiExpandedImpl> get copyWith => + _$$_MiraiExpandedCopyWith<_$_MiraiExpanded> get copyWith => throw _privateConstructorUsedError; } diff --git a/packages/mirai/lib/src/parsers/mirai_expanded/mirai_expanded.g.dart b/packages/mirai/lib/src/parsers/mirai_expanded/mirai_expanded.g.dart index c891d62b..afc4551e 100644 --- a/packages/mirai/lib/src/parsers/mirai_expanded/mirai_expanded.g.dart +++ b/packages/mirai/lib/src/parsers/mirai_expanded/mirai_expanded.g.dart @@ -6,13 +6,13 @@ part of 'mirai_expanded.dart'; // JsonSerializableGenerator // ************************************************************************** -_$MiraiExpandedImpl _$$MiraiExpandedImplFromJson(Map json) => - _$MiraiExpandedImpl( +_$_MiraiExpanded _$$_MiraiExpandedFromJson(Map json) => + _$_MiraiExpanded( flex: json['flex'] as int? ?? 1, child: json['child'] as Map?, ); -Map _$$MiraiExpandedImplToJson(_$MiraiExpandedImpl instance) => +Map _$$_MiraiExpandedToJson(_$_MiraiExpanded instance) => { 'flex': instance.flex, 'child': instance.child, diff --git a/packages/mirai/lib/src/parsers/mirai_network_widget/mirai_network_widget.dart b/packages/mirai/lib/src/parsers/mirai_network_widget/mirai_network_widget.dart new file mode 100644 index 00000000..8362db7a --- /dev/null +++ b/packages/mirai/lib/src/parsers/mirai_network_widget/mirai_network_widget.dart @@ -0,0 +1,15 @@ +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:mirai/mirai.dart'; + +part 'mirai_network_widget.freezed.dart'; +part 'mirai_network_widget.g.dart'; + +@freezed +class MiraiNetworkWidget with _$MiraiNetworkWidget { + const factory MiraiNetworkWidget({ + required MiraiRequest request, + }) = _MiraiNetworkWidget; + + factory MiraiNetworkWidget.fromJson(Map json) => + _$MiraiNetworkWidgetFromJson(json); +} diff --git a/packages/mirai/lib/src/parsers/mirai_network_widget/mirai_network_widget.freezed.dart b/packages/mirai/lib/src/parsers/mirai_network_widget/mirai_network_widget.freezed.dart new file mode 100644 index 00000000..54e86174 --- /dev/null +++ b/packages/mirai/lib/src/parsers/mirai_network_widget/mirai_network_widget.freezed.dart @@ -0,0 +1,166 @@ +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'mirai_network_widget.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +final _privateConstructorUsedError = UnsupportedError( + 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods'); + +MiraiNetworkWidget _$MiraiNetworkWidgetFromJson(Map json) { + return _MiraiNetworkWidget.fromJson(json); +} + +/// @nodoc +mixin _$MiraiNetworkWidget { + MiraiRequest get request => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $MiraiNetworkWidgetCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $MiraiNetworkWidgetCopyWith<$Res> { + factory $MiraiNetworkWidgetCopyWith( + MiraiNetworkWidget value, $Res Function(MiraiNetworkWidget) then) = + _$MiraiNetworkWidgetCopyWithImpl<$Res, MiraiNetworkWidget>; + @useResult + $Res call({MiraiRequest request}); + + $MiraiRequestCopyWith<$Res> get request; +} + +/// @nodoc +class _$MiraiNetworkWidgetCopyWithImpl<$Res, $Val extends MiraiNetworkWidget> + implements $MiraiNetworkWidgetCopyWith<$Res> { + _$MiraiNetworkWidgetCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? request = null, + }) { + return _then(_value.copyWith( + request: null == request + ? _value.request + : request // ignore: cast_nullable_to_non_nullable + as MiraiRequest, + ) as $Val); + } + + @override + @pragma('vm:prefer-inline') + $MiraiRequestCopyWith<$Res> get request { + return $MiraiRequestCopyWith<$Res>(_value.request, (value) { + return _then(_value.copyWith(request: value) as $Val); + }); + } +} + +/// @nodoc +abstract class _$$_MiraiNetworkWidgetCopyWith<$Res> + implements $MiraiNetworkWidgetCopyWith<$Res> { + factory _$$_MiraiNetworkWidgetCopyWith(_$_MiraiNetworkWidget value, + $Res Function(_$_MiraiNetworkWidget) then) = + __$$_MiraiNetworkWidgetCopyWithImpl<$Res>; + @override + @useResult + $Res call({MiraiRequest request}); + + @override + $MiraiRequestCopyWith<$Res> get request; +} + +/// @nodoc +class __$$_MiraiNetworkWidgetCopyWithImpl<$Res> + extends _$MiraiNetworkWidgetCopyWithImpl<$Res, _$_MiraiNetworkWidget> + implements _$$_MiraiNetworkWidgetCopyWith<$Res> { + __$$_MiraiNetworkWidgetCopyWithImpl( + _$_MiraiNetworkWidget _value, $Res Function(_$_MiraiNetworkWidget) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? request = null, + }) { + return _then(_$_MiraiNetworkWidget( + request: null == request + ? _value.request + : request // ignore: cast_nullable_to_non_nullable + as MiraiRequest, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$_MiraiNetworkWidget implements _MiraiNetworkWidget { + const _$_MiraiNetworkWidget({required this.request}); + + factory _$_MiraiNetworkWidget.fromJson(Map json) => + _$$_MiraiNetworkWidgetFromJson(json); + + @override + final MiraiRequest request; + + @override + String toString() { + return 'MiraiNetworkWidget(request: $request)'; + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$_MiraiNetworkWidget && + (identical(other.request, request) || other.request == request)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash(runtimeType, request); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$_MiraiNetworkWidgetCopyWith<_$_MiraiNetworkWidget> get copyWith => + __$$_MiraiNetworkWidgetCopyWithImpl<_$_MiraiNetworkWidget>( + this, _$identity); + + @override + Map toJson() { + return _$$_MiraiNetworkWidgetToJson( + this, + ); + } +} + +abstract class _MiraiNetworkWidget implements MiraiNetworkWidget { + const factory _MiraiNetworkWidget({required final MiraiRequest request}) = + _$_MiraiNetworkWidget; + + factory _MiraiNetworkWidget.fromJson(Map json) = + _$_MiraiNetworkWidget.fromJson; + + @override + MiraiRequest get request; + @override + @JsonKey(ignore: true) + _$$_MiraiNetworkWidgetCopyWith<_$_MiraiNetworkWidget> get copyWith => + throw _privateConstructorUsedError; +} diff --git a/packages/mirai/lib/src/parsers/mirai_network_widget/mirai_network_widget.g.dart b/packages/mirai/lib/src/parsers/mirai_network_widget/mirai_network_widget.g.dart new file mode 100644 index 00000000..3dd42415 --- /dev/null +++ b/packages/mirai/lib/src/parsers/mirai_network_widget/mirai_network_widget.g.dart @@ -0,0 +1,19 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'mirai_network_widget.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_$_MiraiNetworkWidget _$$_MiraiNetworkWidgetFromJson( + Map json) => + _$_MiraiNetworkWidget( + request: MiraiRequest.fromJson(json['request'] as Map), + ); + +Map _$$_MiraiNetworkWidgetToJson( + _$_MiraiNetworkWidget instance) => + { + 'request': instance.request, + }; diff --git a/packages/mirai/lib/src/parsers/mirai_network_widget/mirai_network_widget_parser.dart b/packages/mirai/lib/src/parsers/mirai_network_widget/mirai_network_widget_parser.dart new file mode 100644 index 00000000..22209983 --- /dev/null +++ b/packages/mirai/lib/src/parsers/mirai_network_widget/mirai_network_widget_parser.dart @@ -0,0 +1,20 @@ +import 'package:flutter/cupertino.dart'; +import 'package:mirai/mirai.dart'; +import 'package:mirai/src/parsers/mirai_network_widget/mirai_network_widget.dart'; +import 'package:mirai/src/utils/widget_type.dart'; + +class MiraiNetworkWidgetParser extends MiraiParser { + const MiraiNetworkWidgetParser(); + + @override + String get type => WidgetType.networkWidget.name; + + @override + MiraiNetworkWidget getModel(Map json) => + MiraiNetworkWidget.fromJson(json); + + @override + Widget parse(BuildContext context, MiraiNetworkWidget model) { + return Mirai.fromNetwork(model.request); + } +} diff --git a/packages/mirai/lib/src/parsers/mirai_page_view/mirai_page_view.freezed.dart b/packages/mirai/lib/src/parsers/mirai_page_view/mirai_page_view.freezed.dart index a7e503b2..73e08e1c 100644 --- a/packages/mirai/lib/src/parsers/mirai_page_view/mirai_page_view.freezed.dart +++ b/packages/mirai/lib/src/parsers/mirai_page_view/mirai_page_view.freezed.dart @@ -20,18 +20,18 @@ MiraiPageView _$MiraiPageViewFromJson(Map json) { /// @nodoc mixin _$MiraiPageView { + Axis get scrollDirection => throw _privateConstructorUsedError; + bool get reverse => throw _privateConstructorUsedError; + MiraiScrollPhysics? get physics => throw _privateConstructorUsedError; + bool get pageSnapping => throw _privateConstructorUsedError; + Map? get onPageChanged => throw _privateConstructorUsedError; + DragStartBehavior get dragStartBehavior => throw _privateConstructorUsedError; bool get allowImplicitScrolling => throw _privateConstructorUsedError; + String? get restorationId => throw _privateConstructorUsedError; Clip get clipBehavior => throw _privateConstructorUsedError; - DragStartBehavior get dragStartBehavior => throw _privateConstructorUsedError; + bool get padEnds => throw _privateConstructorUsedError; int get initialPage => throw _privateConstructorUsedError; dynamic get keepPage => throw _privateConstructorUsedError; - Map? get onPageChanged => throw _privateConstructorUsedError; - MiraiScrollPhysics? get physics => throw _privateConstructorUsedError; - bool get pageSnapping => throw _privateConstructorUsedError; - bool get padEnds => throw _privateConstructorUsedError; - String? get restorationId => throw _privateConstructorUsedError; - bool get reverse => throw _privateConstructorUsedError; - Axis get scrollDirection => throw _privateConstructorUsedError; double get viewportFraction => throw _privateConstructorUsedError; List> get children => throw _privateConstructorUsedError; @@ -48,18 +48,18 @@ abstract class $MiraiPageViewCopyWith<$Res> { _$MiraiPageViewCopyWithImpl<$Res, MiraiPageView>; @useResult $Res call( - {bool allowImplicitScrolling, - Clip clipBehavior, - DragStartBehavior dragStartBehavior, - int initialPage, - dynamic keepPage, - Map? onPageChanged, + {Axis scrollDirection, + bool reverse, MiraiScrollPhysics? physics, bool pageSnapping, - bool padEnds, + Map? onPageChanged, + DragStartBehavior dragStartBehavior, + bool allowImplicitScrolling, String? restorationId, - bool reverse, - Axis scrollDirection, + Clip clipBehavior, + bool padEnds, + int initialPage, + dynamic keepPage, double viewportFraction, List> children}); } @@ -77,34 +77,62 @@ class _$MiraiPageViewCopyWithImpl<$Res, $Val extends MiraiPageView> @pragma('vm:prefer-inline') @override $Res call({ + Object? scrollDirection = null, + Object? reverse = null, + Object? physics = freezed, + Object? pageSnapping = null, + Object? onPageChanged = freezed, + Object? dragStartBehavior = null, Object? allowImplicitScrolling = null, + Object? restorationId = freezed, Object? clipBehavior = null, - Object? dragStartBehavior = null, + Object? padEnds = null, Object? initialPage = null, Object? keepPage = freezed, - Object? onPageChanged = freezed, - Object? physics = freezed, - Object? pageSnapping = null, - Object? padEnds = null, - Object? restorationId = freezed, - Object? reverse = null, - Object? scrollDirection = null, Object? viewportFraction = null, Object? children = null, }) { return _then(_value.copyWith( + scrollDirection: null == scrollDirection + ? _value.scrollDirection + : scrollDirection // ignore: cast_nullable_to_non_nullable + as Axis, + reverse: null == reverse + ? _value.reverse + : reverse // ignore: cast_nullable_to_non_nullable + as bool, + physics: freezed == physics + ? _value.physics + : physics // ignore: cast_nullable_to_non_nullable + as MiraiScrollPhysics?, + pageSnapping: null == pageSnapping + ? _value.pageSnapping + : pageSnapping // ignore: cast_nullable_to_non_nullable + as bool, + onPageChanged: freezed == onPageChanged + ? _value.onPageChanged + : onPageChanged // ignore: cast_nullable_to_non_nullable + as Map?, + dragStartBehavior: null == dragStartBehavior + ? _value.dragStartBehavior + : dragStartBehavior // ignore: cast_nullable_to_non_nullable + as DragStartBehavior, allowImplicitScrolling: null == allowImplicitScrolling ? _value.allowImplicitScrolling : allowImplicitScrolling // ignore: cast_nullable_to_non_nullable as bool, + restorationId: freezed == restorationId + ? _value.restorationId + : restorationId // ignore: cast_nullable_to_non_nullable + as String?, clipBehavior: null == clipBehavior ? _value.clipBehavior : clipBehavior // ignore: cast_nullable_to_non_nullable as Clip, - dragStartBehavior: null == dragStartBehavior - ? _value.dragStartBehavior - : dragStartBehavior // ignore: cast_nullable_to_non_nullable - as DragStartBehavior, + padEnds: null == padEnds + ? _value.padEnds + : padEnds // ignore: cast_nullable_to_non_nullable + as bool, initialPage: null == initialPage ? _value.initialPage : initialPage // ignore: cast_nullable_to_non_nullable @@ -113,34 +141,6 @@ class _$MiraiPageViewCopyWithImpl<$Res, $Val extends MiraiPageView> ? _value.keepPage : keepPage // ignore: cast_nullable_to_non_nullable as dynamic, - onPageChanged: freezed == onPageChanged - ? _value.onPageChanged - : onPageChanged // ignore: cast_nullable_to_non_nullable - as Map?, - physics: freezed == physics - ? _value.physics - : physics // ignore: cast_nullable_to_non_nullable - as MiraiScrollPhysics?, - pageSnapping: null == pageSnapping - ? _value.pageSnapping - : pageSnapping // ignore: cast_nullable_to_non_nullable - as bool, - padEnds: null == padEnds - ? _value.padEnds - : padEnds // ignore: cast_nullable_to_non_nullable - as bool, - restorationId: freezed == restorationId - ? _value.restorationId - : restorationId // ignore: cast_nullable_to_non_nullable - as String?, - reverse: null == reverse - ? _value.reverse - : reverse // ignore: cast_nullable_to_non_nullable - as bool, - scrollDirection: null == scrollDirection - ? _value.scrollDirection - : scrollDirection // ignore: cast_nullable_to_non_nullable - as Axis, viewportFraction: null == viewportFraction ? _value.viewportFraction : viewportFraction // ignore: cast_nullable_to_non_nullable @@ -154,78 +154,65 @@ class _$MiraiPageViewCopyWithImpl<$Res, $Val extends MiraiPageView> } /// @nodoc -abstract class _$$MiraiPageViewImplCopyWith<$Res> +abstract class _$$_MiraiPageViewCopyWith<$Res> implements $MiraiPageViewCopyWith<$Res> { - factory _$$MiraiPageViewImplCopyWith( - _$MiraiPageViewImpl value, $Res Function(_$MiraiPageViewImpl) then) = - __$$MiraiPageViewImplCopyWithImpl<$Res>; + factory _$$_MiraiPageViewCopyWith( + _$_MiraiPageView value, $Res Function(_$_MiraiPageView) then) = + __$$_MiraiPageViewCopyWithImpl<$Res>; @override @useResult $Res call( - {bool allowImplicitScrolling, - Clip clipBehavior, - DragStartBehavior dragStartBehavior, - int initialPage, - dynamic keepPage, - Map? onPageChanged, + {Axis scrollDirection, + bool reverse, MiraiScrollPhysics? physics, bool pageSnapping, - bool padEnds, + Map? onPageChanged, + DragStartBehavior dragStartBehavior, + bool allowImplicitScrolling, String? restorationId, - bool reverse, - Axis scrollDirection, + Clip clipBehavior, + bool padEnds, + int initialPage, + dynamic keepPage, double viewportFraction, List> children}); } /// @nodoc -class __$$MiraiPageViewImplCopyWithImpl<$Res> - extends _$MiraiPageViewCopyWithImpl<$Res, _$MiraiPageViewImpl> - implements _$$MiraiPageViewImplCopyWith<$Res> { - __$$MiraiPageViewImplCopyWithImpl( - _$MiraiPageViewImpl _value, $Res Function(_$MiraiPageViewImpl) _then) +class __$$_MiraiPageViewCopyWithImpl<$Res> + extends _$MiraiPageViewCopyWithImpl<$Res, _$_MiraiPageView> + implements _$$_MiraiPageViewCopyWith<$Res> { + __$$_MiraiPageViewCopyWithImpl( + _$_MiraiPageView _value, $Res Function(_$_MiraiPageView) _then) : super(_value, _then); @pragma('vm:prefer-inline') @override $Res call({ + Object? scrollDirection = null, + Object? reverse = null, + Object? physics = freezed, + Object? pageSnapping = null, + Object? onPageChanged = freezed, + Object? dragStartBehavior = null, Object? allowImplicitScrolling = null, + Object? restorationId = freezed, Object? clipBehavior = null, - Object? dragStartBehavior = null, + Object? padEnds = null, Object? initialPage = null, Object? keepPage = freezed, - Object? onPageChanged = freezed, - Object? physics = freezed, - Object? pageSnapping = null, - Object? padEnds = null, - Object? restorationId = freezed, - Object? reverse = null, - Object? scrollDirection = null, Object? viewportFraction = null, Object? children = null, }) { - return _then(_$MiraiPageViewImpl( - allowImplicitScrolling: null == allowImplicitScrolling - ? _value.allowImplicitScrolling - : allowImplicitScrolling // ignore: cast_nullable_to_non_nullable + return _then(_$_MiraiPageView( + scrollDirection: null == scrollDirection + ? _value.scrollDirection + : scrollDirection // ignore: cast_nullable_to_non_nullable + as Axis, + reverse: null == reverse + ? _value.reverse + : reverse // ignore: cast_nullable_to_non_nullable as bool, - clipBehavior: null == clipBehavior - ? _value.clipBehavior - : clipBehavior // ignore: cast_nullable_to_non_nullable - as Clip, - dragStartBehavior: null == dragStartBehavior - ? _value.dragStartBehavior - : dragStartBehavior // ignore: cast_nullable_to_non_nullable - as DragStartBehavior, - initialPage: null == initialPage - ? _value.initialPage - : initialPage // ignore: cast_nullable_to_non_nullable - as int, - keepPage: freezed == keepPage ? _value.keepPage! : keepPage, - onPageChanged: freezed == onPageChanged - ? _value._onPageChanged - : onPageChanged // ignore: cast_nullable_to_non_nullable - as Map?, physics: freezed == physics ? _value.physics : physics // ignore: cast_nullable_to_non_nullable @@ -234,22 +221,35 @@ class __$$MiraiPageViewImplCopyWithImpl<$Res> ? _value.pageSnapping : pageSnapping // ignore: cast_nullable_to_non_nullable as bool, - padEnds: null == padEnds - ? _value.padEnds - : padEnds // ignore: cast_nullable_to_non_nullable + onPageChanged: freezed == onPageChanged + ? _value._onPageChanged + : onPageChanged // ignore: cast_nullable_to_non_nullable + as Map?, + dragStartBehavior: null == dragStartBehavior + ? _value.dragStartBehavior + : dragStartBehavior // ignore: cast_nullable_to_non_nullable + as DragStartBehavior, + allowImplicitScrolling: null == allowImplicitScrolling + ? _value.allowImplicitScrolling + : allowImplicitScrolling // ignore: cast_nullable_to_non_nullable as bool, restorationId: freezed == restorationId ? _value.restorationId : restorationId // ignore: cast_nullable_to_non_nullable as String?, - reverse: null == reverse - ? _value.reverse - : reverse // ignore: cast_nullable_to_non_nullable + clipBehavior: null == clipBehavior + ? _value.clipBehavior + : clipBehavior // ignore: cast_nullable_to_non_nullable + as Clip, + padEnds: null == padEnds + ? _value.padEnds + : padEnds // ignore: cast_nullable_to_non_nullable as bool, - scrollDirection: null == scrollDirection - ? _value.scrollDirection - : scrollDirection // ignore: cast_nullable_to_non_nullable - as Axis, + initialPage: null == initialPage + ? _value.initialPage + : initialPage // ignore: cast_nullable_to_non_nullable + as int, + keepPage: freezed == keepPage ? _value.keepPage! : keepPage, viewportFraction: null == viewportFraction ? _value.viewportFraction : viewportFraction // ignore: cast_nullable_to_non_nullable @@ -264,43 +264,39 @@ class __$$MiraiPageViewImplCopyWithImpl<$Res> /// @nodoc @JsonSerializable() -class _$MiraiPageViewImpl implements _MiraiPageView { - const _$MiraiPageViewImpl( - {this.allowImplicitScrolling = false, - this.clipBehavior = Clip.hardEdge, - this.dragStartBehavior = DragStartBehavior.start, - this.initialPage = 0, - this.keepPage = true, - final Map? onPageChanged, +class _$_MiraiPageView implements _MiraiPageView { + const _$_MiraiPageView( + {this.scrollDirection = Axis.horizontal, + this.reverse = false, this.physics, this.pageSnapping = true, - this.padEnds = true, + final Map? onPageChanged, + this.dragStartBehavior = DragStartBehavior.start, + this.allowImplicitScrolling = false, this.restorationId, - this.reverse = false, - this.scrollDirection = Axis.horizontal, + this.clipBehavior = Clip.hardEdge, + this.padEnds = true, + this.initialPage = 0, + this.keepPage = true, this.viewportFraction = 1.0, final List> children = const []}) : _onPageChanged = onPageChanged, _children = children; - factory _$MiraiPageViewImpl.fromJson(Map json) => - _$$MiraiPageViewImplFromJson(json); + factory _$_MiraiPageView.fromJson(Map json) => + _$$_MiraiPageViewFromJson(json); @override @JsonKey() - final bool allowImplicitScrolling; - @override - @JsonKey() - final Clip clipBehavior; + final Axis scrollDirection; @override @JsonKey() - final DragStartBehavior dragStartBehavior; + final bool reverse; @override - @JsonKey() - final int initialPage; + final MiraiScrollPhysics? physics; @override @JsonKey() - final dynamic keepPage; + final bool pageSnapping; final Map? _onPageChanged; @override Map? get onPageChanged { @@ -311,22 +307,26 @@ class _$MiraiPageViewImpl implements _MiraiPageView { return EqualUnmodifiableMapView(value); } - @override - final MiraiScrollPhysics? physics; @override @JsonKey() - final bool pageSnapping; + final DragStartBehavior dragStartBehavior; @override @JsonKey() - final bool padEnds; + final bool allowImplicitScrolling; @override final String? restorationId; @override @JsonKey() - final bool reverse; + final Clip clipBehavior; @override @JsonKey() - final Axis scrollDirection; + final bool padEnds; + @override + @JsonKey() + final int initialPage; + @override + @JsonKey() + final dynamic keepPage; @override @JsonKey() final double viewportFraction; @@ -341,34 +341,34 @@ class _$MiraiPageViewImpl implements _MiraiPageView { @override String toString() { - return 'MiraiPageView(allowImplicitScrolling: $allowImplicitScrolling, clipBehavior: $clipBehavior, dragStartBehavior: $dragStartBehavior, initialPage: $initialPage, keepPage: $keepPage, onPageChanged: $onPageChanged, physics: $physics, pageSnapping: $pageSnapping, padEnds: $padEnds, restorationId: $restorationId, reverse: $reverse, scrollDirection: $scrollDirection, viewportFraction: $viewportFraction, children: $children)'; + return 'MiraiPageView(scrollDirection: $scrollDirection, reverse: $reverse, physics: $physics, pageSnapping: $pageSnapping, onPageChanged: $onPageChanged, dragStartBehavior: $dragStartBehavior, allowImplicitScrolling: $allowImplicitScrolling, restorationId: $restorationId, clipBehavior: $clipBehavior, padEnds: $padEnds, initialPage: $initialPage, keepPage: $keepPage, viewportFraction: $viewportFraction, children: $children)'; } @override bool operator ==(dynamic other) { return identical(this, other) || (other.runtimeType == runtimeType && - other is _$MiraiPageViewImpl && + other is _$_MiraiPageView && + (identical(other.scrollDirection, scrollDirection) || + other.scrollDirection == scrollDirection) && + (identical(other.reverse, reverse) || other.reverse == reverse) && + (identical(other.physics, physics) || other.physics == physics) && + (identical(other.pageSnapping, pageSnapping) || + other.pageSnapping == pageSnapping) && + const DeepCollectionEquality() + .equals(other._onPageChanged, _onPageChanged) && + (identical(other.dragStartBehavior, dragStartBehavior) || + other.dragStartBehavior == dragStartBehavior) && (identical(other.allowImplicitScrolling, allowImplicitScrolling) || other.allowImplicitScrolling == allowImplicitScrolling) && + (identical(other.restorationId, restorationId) || + other.restorationId == restorationId) && (identical(other.clipBehavior, clipBehavior) || other.clipBehavior == clipBehavior) && - (identical(other.dragStartBehavior, dragStartBehavior) || - other.dragStartBehavior == dragStartBehavior) && + (identical(other.padEnds, padEnds) || other.padEnds == padEnds) && (identical(other.initialPage, initialPage) || other.initialPage == initialPage) && const DeepCollectionEquality().equals(other.keepPage, keepPage) && - const DeepCollectionEquality() - .equals(other._onPageChanged, _onPageChanged) && - (identical(other.physics, physics) || other.physics == physics) && - (identical(other.pageSnapping, pageSnapping) || - other.pageSnapping == pageSnapping) && - (identical(other.padEnds, padEnds) || other.padEnds == padEnds) && - (identical(other.restorationId, restorationId) || - other.restorationId == restorationId) && - (identical(other.reverse, reverse) || other.reverse == reverse) && - (identical(other.scrollDirection, scrollDirection) || - other.scrollDirection == scrollDirection) && (identical(other.viewportFraction, viewportFraction) || other.viewportFraction == viewportFraction) && const DeepCollectionEquality().equals(other._children, _children)); @@ -378,30 +378,30 @@ class _$MiraiPageViewImpl implements _MiraiPageView { @override int get hashCode => Object.hash( runtimeType, + scrollDirection, + reverse, + physics, + pageSnapping, + const DeepCollectionEquality().hash(_onPageChanged), + dragStartBehavior, allowImplicitScrolling, + restorationId, clipBehavior, - dragStartBehavior, + padEnds, initialPage, const DeepCollectionEquality().hash(keepPage), - const DeepCollectionEquality().hash(_onPageChanged), - physics, - pageSnapping, - padEnds, - restorationId, - reverse, - scrollDirection, viewportFraction, const DeepCollectionEquality().hash(_children)); @JsonKey(ignore: true) @override @pragma('vm:prefer-inline') - _$$MiraiPageViewImplCopyWith<_$MiraiPageViewImpl> get copyWith => - __$$MiraiPageViewImplCopyWithImpl<_$MiraiPageViewImpl>(this, _$identity); + _$$_MiraiPageViewCopyWith<_$_MiraiPageView> get copyWith => + __$$_MiraiPageViewCopyWithImpl<_$_MiraiPageView>(this, _$identity); @override Map toJson() { - return _$$MiraiPageViewImplToJson( + return _$$_MiraiPageViewToJson( this, ); } @@ -409,54 +409,54 @@ class _$MiraiPageViewImpl implements _MiraiPageView { abstract class _MiraiPageView implements MiraiPageView { const factory _MiraiPageView( - {final bool allowImplicitScrolling, - final Clip clipBehavior, - final DragStartBehavior dragStartBehavior, - final int initialPage, - final dynamic keepPage, - final Map? onPageChanged, + {final Axis scrollDirection, + final bool reverse, final MiraiScrollPhysics? physics, final bool pageSnapping, - final bool padEnds, + final Map? onPageChanged, + final DragStartBehavior dragStartBehavior, + final bool allowImplicitScrolling, final String? restorationId, - final bool reverse, - final Axis scrollDirection, + final Clip clipBehavior, + final bool padEnds, + final int initialPage, + final dynamic keepPage, final double viewportFraction, - final List> children}) = _$MiraiPageViewImpl; + final List> children}) = _$_MiraiPageView; factory _MiraiPageView.fromJson(Map json) = - _$MiraiPageViewImpl.fromJson; + _$_MiraiPageView.fromJson; @override - bool get allowImplicitScrolling; - @override - Clip get clipBehavior; + Axis get scrollDirection; @override - DragStartBehavior get dragStartBehavior; + bool get reverse; @override - int get initialPage; + MiraiScrollPhysics? get physics; @override - dynamic get keepPage; + bool get pageSnapping; @override Map? get onPageChanged; @override - MiraiScrollPhysics? get physics; - @override - bool get pageSnapping; + DragStartBehavior get dragStartBehavior; @override - bool get padEnds; + bool get allowImplicitScrolling; @override String? get restorationId; @override - bool get reverse; + Clip get clipBehavior; @override - Axis get scrollDirection; + bool get padEnds; + @override + int get initialPage; + @override + dynamic get keepPage; @override double get viewportFraction; @override List> get children; @override @JsonKey(ignore: true) - _$$MiraiPageViewImplCopyWith<_$MiraiPageViewImpl> get copyWith => + _$$_MiraiPageViewCopyWith<_$_MiraiPageView> get copyWith => throw _privateConstructorUsedError; } diff --git a/packages/mirai/lib/src/parsers/mirai_page_view/mirai_page_view.g.dart b/packages/mirai/lib/src/parsers/mirai_page_view/mirai_page_view.g.dart index 8cae2f1d..d6d8188c 100644 --- a/packages/mirai/lib/src/parsers/mirai_page_view/mirai_page_view.g.dart +++ b/packages/mirai/lib/src/parsers/mirai_page_view/mirai_page_view.g.dart @@ -6,26 +6,26 @@ part of 'mirai_page_view.dart'; // JsonSerializableGenerator // ************************************************************************** -_$MiraiPageViewImpl _$$MiraiPageViewImplFromJson(Map json) => - _$MiraiPageViewImpl( - allowImplicitScrolling: json['allowImplicitScrolling'] as bool? ?? false, - clipBehavior: $enumDecodeNullable(_$ClipEnumMap, json['clipBehavior']) ?? - Clip.hardEdge, +_$_MiraiPageView _$$_MiraiPageViewFromJson(Map json) => + _$_MiraiPageView( + scrollDirection: + $enumDecodeNullable(_$AxisEnumMap, json['scrollDirection']) ?? + Axis.horizontal, + reverse: json['reverse'] as bool? ?? false, + physics: + $enumDecodeNullable(_$MiraiScrollPhysicsEnumMap, json['physics']), + pageSnapping: json['pageSnapping'] as bool? ?? true, + onPageChanged: json['onPageChanged'] as Map?, dragStartBehavior: $enumDecodeNullable( _$DragStartBehaviorEnumMap, json['dragStartBehavior']) ?? DragStartBehavior.start, + allowImplicitScrolling: json['allowImplicitScrolling'] as bool? ?? false, + restorationId: json['restorationId'] as String?, + clipBehavior: $enumDecodeNullable(_$ClipEnumMap, json['clipBehavior']) ?? + Clip.hardEdge, + padEnds: json['padEnds'] as bool? ?? true, initialPage: json['initialPage'] as int? ?? 0, keepPage: json['keepPage'] ?? true, - onPageChanged: json['onPageChanged'] as Map?, - physics: - $enumDecodeNullable(_$MiraiScrollPhysicsEnumMap, json['physics']), - pageSnapping: json['pageSnapping'] as bool? ?? true, - padEnds: json['padEnds'] as bool? ?? true, - restorationId: json['restorationId'] as String?, - reverse: json['reverse'] as bool? ?? false, - scrollDirection: - $enumDecodeNullable(_$AxisEnumMap, json['scrollDirection']) ?? - Axis.horizontal, viewportFraction: (json['viewportFraction'] as num?)?.toDouble() ?? 1.0, children: (json['children'] as List?) ?.map((e) => e as Map) @@ -33,35 +33,28 @@ _$MiraiPageViewImpl _$$MiraiPageViewImplFromJson(Map json) => const [], ); -Map _$$MiraiPageViewImplToJson(_$MiraiPageViewImpl instance) => +Map _$$_MiraiPageViewToJson(_$_MiraiPageView instance) => { - 'allowImplicitScrolling': instance.allowImplicitScrolling, - 'clipBehavior': _$ClipEnumMap[instance.clipBehavior]!, + 'scrollDirection': _$AxisEnumMap[instance.scrollDirection]!, + 'reverse': instance.reverse, + 'physics': _$MiraiScrollPhysicsEnumMap[instance.physics], + 'pageSnapping': instance.pageSnapping, + 'onPageChanged': instance.onPageChanged, 'dragStartBehavior': _$DragStartBehaviorEnumMap[instance.dragStartBehavior]!, + 'allowImplicitScrolling': instance.allowImplicitScrolling, + 'restorationId': instance.restorationId, + 'clipBehavior': _$ClipEnumMap[instance.clipBehavior]!, + 'padEnds': instance.padEnds, 'initialPage': instance.initialPage, 'keepPage': instance.keepPage, - 'onPageChanged': instance.onPageChanged, - 'physics': _$MiraiScrollPhysicsEnumMap[instance.physics], - 'pageSnapping': instance.pageSnapping, - 'padEnds': instance.padEnds, - 'restorationId': instance.restorationId, - 'reverse': instance.reverse, - 'scrollDirection': _$AxisEnumMap[instance.scrollDirection]!, 'viewportFraction': instance.viewportFraction, 'children': instance.children, }; -const _$ClipEnumMap = { - Clip.none: 'none', - Clip.hardEdge: 'hardEdge', - Clip.antiAlias: 'antiAlias', - Clip.antiAliasWithSaveLayer: 'antiAliasWithSaveLayer', -}; - -const _$DragStartBehaviorEnumMap = { - DragStartBehavior.down: 'down', - DragStartBehavior.start: 'start', +const _$AxisEnumMap = { + Axis.horizontal: 'horizontal', + Axis.vertical: 'vertical', }; const _$MiraiScrollPhysicsEnumMap = { @@ -72,7 +65,14 @@ const _$MiraiScrollPhysicsEnumMap = { MiraiScrollPhysics.page: 'page', }; -const _$AxisEnumMap = { - Axis.horizontal: 'horizontal', - Axis.vertical: 'vertical', +const _$DragStartBehaviorEnumMap = { + DragStartBehavior.down: 'down', + DragStartBehavior.start: 'start', +}; + +const _$ClipEnumMap = { + Clip.none: 'none', + Clip.hardEdge: 'hardEdge', + Clip.antiAlias: 'antiAlias', + Clip.antiAliasWithSaveLayer: 'antiAliasWithSaveLayer', }; diff --git a/packages/mirai/lib/src/parsers/mirai_tab_bar/mirai_tab_bar.freezed.dart b/packages/mirai/lib/src/parsers/mirai_tab_bar/mirai_tab_bar.freezed.dart index f70b1a90..3e7206fb 100644 --- a/packages/mirai/lib/src/parsers/mirai_tab_bar/mirai_tab_bar.freezed.dart +++ b/packages/mirai/lib/src/parsers/mirai_tab_bar/mirai_tab_bar.freezed.dart @@ -251,11 +251,11 @@ class _$MiraiTabBarCopyWithImpl<$Res, $Val extends MiraiTabBar> } /// @nodoc -abstract class _$$MiraiTabBarImplCopyWith<$Res> +abstract class _$$_MiraiTabBarCopyWith<$Res> implements $MiraiTabBarCopyWith<$Res> { - factory _$$MiraiTabBarImplCopyWith( - _$MiraiTabBarImpl value, $Res Function(_$MiraiTabBarImpl) then) = - __$$MiraiTabBarImplCopyWithImpl<$Res>; + factory _$$_MiraiTabBarCopyWith( + _$_MiraiTabBar value, $Res Function(_$_MiraiTabBar) then) = + __$$_MiraiTabBarCopyWithImpl<$Res>; @override @useResult $Res call( @@ -291,11 +291,11 @@ abstract class _$$MiraiTabBarImplCopyWith<$Res> } /// @nodoc -class __$$MiraiTabBarImplCopyWithImpl<$Res> - extends _$MiraiTabBarCopyWithImpl<$Res, _$MiraiTabBarImpl> - implements _$$MiraiTabBarImplCopyWith<$Res> { - __$$MiraiTabBarImplCopyWithImpl( - _$MiraiTabBarImpl _value, $Res Function(_$MiraiTabBarImpl) _then) +class __$$_MiraiTabBarCopyWithImpl<$Res> + extends _$MiraiTabBarCopyWithImpl<$Res, _$_MiraiTabBar> + implements _$$_MiraiTabBarCopyWith<$Res> { + __$$_MiraiTabBarCopyWithImpl( + _$_MiraiTabBar _value, $Res Function(_$_MiraiTabBar) _then) : super(_value, _then); @pragma('vm:prefer-inline') @@ -320,7 +320,7 @@ class __$$MiraiTabBarImplCopyWithImpl<$Res> Object? physics = freezed, Object? tabAlignment = freezed, }) { - return _then(_$MiraiTabBarImpl( + return _then(_$_MiraiTabBar( tabs: null == tabs ? _value._tabs : tabs // ignore: cast_nullable_to_non_nullable @@ -400,8 +400,8 @@ class __$$MiraiTabBarImplCopyWithImpl<$Res> /// @nodoc @JsonSerializable() -class _$MiraiTabBarImpl implements _MiraiTabBar { - const _$MiraiTabBarImpl( +class _$_MiraiTabBar implements _MiraiTabBar { + const _$_MiraiTabBar( {required final List> tabs, this.initialIndex = 0, this.isScrollable = false, @@ -422,8 +422,8 @@ class _$MiraiTabBarImpl implements _MiraiTabBar { this.tabAlignment}) : _tabs = tabs; - factory _$MiraiTabBarImpl.fromJson(Map json) => - _$$MiraiTabBarImplFromJson(json); + factory _$_MiraiTabBar.fromJson(Map json) => + _$$_MiraiTabBarFromJson(json); final List> _tabs; @override @@ -482,7 +482,7 @@ class _$MiraiTabBarImpl implements _MiraiTabBar { bool operator ==(dynamic other) { return identical(this, other) || (other.runtimeType == runtimeType && - other is _$MiraiTabBarImpl && + other is _$_MiraiTabBar && const DeepCollectionEquality().equals(other._tabs, _tabs) && (identical(other.initialIndex, initialIndex) || other.initialIndex == initialIndex) && @@ -546,12 +546,12 @@ class _$MiraiTabBarImpl implements _MiraiTabBar { @JsonKey(ignore: true) @override @pragma('vm:prefer-inline') - _$$MiraiTabBarImplCopyWith<_$MiraiTabBarImpl> get copyWith => - __$$MiraiTabBarImplCopyWithImpl<_$MiraiTabBarImpl>(this, _$identity); + _$$_MiraiTabBarCopyWith<_$_MiraiTabBar> get copyWith => + __$$_MiraiTabBarCopyWithImpl<_$_MiraiTabBar>(this, _$identity); @override Map toJson() { - return _$$MiraiTabBarImplToJson( + return _$$_MiraiTabBarToJson( this, ); } @@ -576,10 +576,10 @@ abstract class _MiraiTabBar implements MiraiTabBar { final DragStartBehavior dragStartBehavior, final bool? enableFeedback, final MiraiScrollPhysics? physics, - final TabAlignment? tabAlignment}) = _$MiraiTabBarImpl; + final TabAlignment? tabAlignment}) = _$_MiraiTabBar; factory _MiraiTabBar.fromJson(Map json) = - _$MiraiTabBarImpl.fromJson; + _$_MiraiTabBar.fromJson; @override List> get tabs; @@ -619,6 +619,6 @@ abstract class _MiraiTabBar implements MiraiTabBar { TabAlignment? get tabAlignment; @override @JsonKey(ignore: true) - _$$MiraiTabBarImplCopyWith<_$MiraiTabBarImpl> get copyWith => + _$$_MiraiTabBarCopyWith<_$_MiraiTabBar> get copyWith => throw _privateConstructorUsedError; } diff --git a/packages/mirai/lib/src/parsers/mirai_tab_bar/mirai_tab_bar.g.dart b/packages/mirai/lib/src/parsers/mirai_tab_bar/mirai_tab_bar.g.dart index 2bb48464..b88ce5c6 100644 --- a/packages/mirai/lib/src/parsers/mirai_tab_bar/mirai_tab_bar.g.dart +++ b/packages/mirai/lib/src/parsers/mirai_tab_bar/mirai_tab_bar.g.dart @@ -6,8 +6,8 @@ part of 'mirai_tab_bar.dart'; // JsonSerializableGenerator // ************************************************************************** -_$MiraiTabBarImpl _$$MiraiTabBarImplFromJson(Map json) => - _$MiraiTabBarImpl( +_$_MiraiTabBar _$$_MiraiTabBarFromJson(Map json) => + _$_MiraiTabBar( tabs: (json['tabs'] as List) .map((e) => e as Map) .toList(), @@ -49,7 +49,7 @@ _$MiraiTabBarImpl _$$MiraiTabBarImplFromJson(Map json) => $enumDecodeNullable(_$TabAlignmentEnumMap, json['tabAlignment']), ); -Map _$$MiraiTabBarImplToJson(_$MiraiTabBarImpl instance) => +Map _$$_MiraiTabBarToJson(_$_MiraiTabBar instance) => { 'tabs': instance.tabs, 'initialIndex': instance.initialIndex, diff --git a/packages/mirai/lib/src/parsers/mirai_text/mirai_text.freezed.dart b/packages/mirai/lib/src/parsers/mirai_text/mirai_text.freezed.dart index 2cf0c9fd..9aa2bd76 100644 --- a/packages/mirai/lib/src/parsers/mirai_text/mirai_text.freezed.dart +++ b/packages/mirai/lib/src/parsers/mirai_text/mirai_text.freezed.dart @@ -153,11 +153,10 @@ class _$MiraiTextCopyWithImpl<$Res, $Val extends MiraiText> } /// @nodoc -abstract class _$$MiraiTextImplCopyWith<$Res> - implements $MiraiTextCopyWith<$Res> { - factory _$$MiraiTextImplCopyWith( - _$MiraiTextImpl value, $Res Function(_$MiraiTextImpl) then) = - __$$MiraiTextImplCopyWithImpl<$Res>; +abstract class _$$_MiraiTextCopyWith<$Res> implements $MiraiTextCopyWith<$Res> { + factory _$$_MiraiTextCopyWith( + _$_MiraiText value, $Res Function(_$_MiraiText) then) = + __$$_MiraiTextCopyWithImpl<$Res>; @override @useResult $Res call( @@ -179,11 +178,11 @@ abstract class _$$MiraiTextImplCopyWith<$Res> } /// @nodoc -class __$$MiraiTextImplCopyWithImpl<$Res> - extends _$MiraiTextCopyWithImpl<$Res, _$MiraiTextImpl> - implements _$$MiraiTextImplCopyWith<$Res> { - __$$MiraiTextImplCopyWithImpl( - _$MiraiTextImpl _value, $Res Function(_$MiraiTextImpl) _then) +class __$$_MiraiTextCopyWithImpl<$Res> + extends _$MiraiTextCopyWithImpl<$Res, _$_MiraiText> + implements _$$_MiraiTextCopyWith<$Res> { + __$$_MiraiTextCopyWithImpl( + _$_MiraiText _value, $Res Function(_$_MiraiText) _then) : super(_value, _then); @pragma('vm:prefer-inline') @@ -202,7 +201,7 @@ class __$$MiraiTextImplCopyWithImpl<$Res> Object? textWidthBasis = freezed, Object? selectionColor = freezed, }) { - return _then(_$MiraiTextImpl( + return _then(_$_MiraiText( data: null == data ? _value.data : data // ignore: cast_nullable_to_non_nullable @@ -257,8 +256,8 @@ class __$$MiraiTextImplCopyWithImpl<$Res> /// @nodoc @JsonSerializable() -class _$MiraiTextImpl implements _MiraiText { - const _$MiraiTextImpl( +class _$_MiraiText implements _MiraiText { + const _$_MiraiText( {required this.data, final List children = const [], this.style, @@ -273,8 +272,8 @@ class _$MiraiTextImpl implements _MiraiText { this.selectionColor}) : _children = children; - factory _$MiraiTextImpl.fromJson(Map json) => - _$$MiraiTextImplFromJson(json); + factory _$_MiraiText.fromJson(Map json) => + _$$_MiraiTextFromJson(json); @override final String data; @@ -317,7 +316,7 @@ class _$MiraiTextImpl implements _MiraiText { bool operator ==(dynamic other) { return identical(this, other) || (other.runtimeType == runtimeType && - other is _$MiraiTextImpl && + other is _$_MiraiText && (identical(other.data, data) || other.data == data) && const DeepCollectionEquality().equals(other._children, _children) && (identical(other.style, style) || other.style == style) && @@ -361,12 +360,12 @@ class _$MiraiTextImpl implements _MiraiText { @JsonKey(ignore: true) @override @pragma('vm:prefer-inline') - _$$MiraiTextImplCopyWith<_$MiraiTextImpl> get copyWith => - __$$MiraiTextImplCopyWithImpl<_$MiraiTextImpl>(this, _$identity); + _$$_MiraiTextCopyWith<_$_MiraiText> get copyWith => + __$$_MiraiTextCopyWithImpl<_$_MiraiText>(this, _$identity); @override Map toJson() { - return _$$MiraiTextImplToJson( + return _$$_MiraiTextToJson( this, ); } @@ -385,10 +384,10 @@ abstract class _MiraiText implements MiraiText { final int? maxLines, final String? semanticsLabel, final TextWidthBasis? textWidthBasis, - final String? selectionColor}) = _$MiraiTextImpl; + final String? selectionColor}) = _$_MiraiText; factory _MiraiText.fromJson(Map json) = - _$MiraiTextImpl.fromJson; + _$_MiraiText.fromJson; @override String get data; @@ -416,7 +415,7 @@ abstract class _MiraiText implements MiraiText { String? get selectionColor; @override @JsonKey(ignore: true) - _$$MiraiTextImplCopyWith<_$MiraiTextImpl> get copyWith => + _$$_MiraiTextCopyWith<_$_MiraiText> get copyWith => throw _privateConstructorUsedError; } @@ -494,11 +493,11 @@ class _$MiraiTextSpanCopyWithImpl<$Res, $Val extends MiraiTextSpan> } /// @nodoc -abstract class _$$MiraiTextSpanImplCopyWith<$Res> +abstract class _$$_MiraiTextSpanCopyWith<$Res> implements $MiraiTextSpanCopyWith<$Res> { - factory _$$MiraiTextSpanImplCopyWith( - _$MiraiTextSpanImpl value, $Res Function(_$MiraiTextSpanImpl) then) = - __$$MiraiTextSpanImplCopyWithImpl<$Res>; + factory _$$_MiraiTextSpanCopyWith( + _$_MiraiTextSpan value, $Res Function(_$_MiraiTextSpan) then) = + __$$_MiraiTextSpanCopyWithImpl<$Res>; @override @useResult $Res call({String? data, MiraiTextStyle? style, Map? onTap}); @@ -508,11 +507,11 @@ abstract class _$$MiraiTextSpanImplCopyWith<$Res> } /// @nodoc -class __$$MiraiTextSpanImplCopyWithImpl<$Res> - extends _$MiraiTextSpanCopyWithImpl<$Res, _$MiraiTextSpanImpl> - implements _$$MiraiTextSpanImplCopyWith<$Res> { - __$$MiraiTextSpanImplCopyWithImpl( - _$MiraiTextSpanImpl _value, $Res Function(_$MiraiTextSpanImpl) _then) +class __$$_MiraiTextSpanCopyWithImpl<$Res> + extends _$MiraiTextSpanCopyWithImpl<$Res, _$_MiraiTextSpan> + implements _$$_MiraiTextSpanCopyWith<$Res> { + __$$_MiraiTextSpanCopyWithImpl( + _$_MiraiTextSpan _value, $Res Function(_$_MiraiTextSpan) _then) : super(_value, _then); @pragma('vm:prefer-inline') @@ -522,7 +521,7 @@ class __$$MiraiTextSpanImplCopyWithImpl<$Res> Object? style = freezed, Object? onTap = freezed, }) { - return _then(_$MiraiTextSpanImpl( + return _then(_$_MiraiTextSpan( data: freezed == data ? _value.data : data // ignore: cast_nullable_to_non_nullable @@ -541,13 +540,13 @@ class __$$MiraiTextSpanImplCopyWithImpl<$Res> /// @nodoc @JsonSerializable() -class _$MiraiTextSpanImpl implements _MiraiTextSpan { - const _$MiraiTextSpanImpl( +class _$_MiraiTextSpan implements _MiraiTextSpan { + const _$_MiraiTextSpan( {this.data, this.style, final Map? onTap}) : _onTap = onTap; - factory _$MiraiTextSpanImpl.fromJson(Map json) => - _$$MiraiTextSpanImplFromJson(json); + factory _$_MiraiTextSpan.fromJson(Map json) => + _$$_MiraiTextSpanFromJson(json); @override final String? data; @@ -572,7 +571,7 @@ class _$MiraiTextSpanImpl implements _MiraiTextSpan { bool operator ==(dynamic other) { return identical(this, other) || (other.runtimeType == runtimeType && - other is _$MiraiTextSpanImpl && + other is _$_MiraiTextSpan && (identical(other.data, data) || other.data == data) && (identical(other.style, style) || other.style == style) && const DeepCollectionEquality().equals(other._onTap, _onTap)); @@ -586,12 +585,12 @@ class _$MiraiTextSpanImpl implements _MiraiTextSpan { @JsonKey(ignore: true) @override @pragma('vm:prefer-inline') - _$$MiraiTextSpanImplCopyWith<_$MiraiTextSpanImpl> get copyWith => - __$$MiraiTextSpanImplCopyWithImpl<_$MiraiTextSpanImpl>(this, _$identity); + _$$_MiraiTextSpanCopyWith<_$_MiraiTextSpan> get copyWith => + __$$_MiraiTextSpanCopyWithImpl<_$_MiraiTextSpan>(this, _$identity); @override Map toJson() { - return _$$MiraiTextSpanImplToJson( + return _$$_MiraiTextSpanToJson( this, ); } @@ -601,10 +600,10 @@ abstract class _MiraiTextSpan implements MiraiTextSpan { const factory _MiraiTextSpan( {final String? data, final MiraiTextStyle? style, - final Map? onTap}) = _$MiraiTextSpanImpl; + final Map? onTap}) = _$_MiraiTextSpan; factory _MiraiTextSpan.fromJson(Map json) = - _$MiraiTextSpanImpl.fromJson; + _$_MiraiTextSpan.fromJson; @override String? get data; @@ -614,6 +613,6 @@ abstract class _MiraiTextSpan implements MiraiTextSpan { Map? get onTap; @override @JsonKey(ignore: true) - _$$MiraiTextSpanImplCopyWith<_$MiraiTextSpanImpl> get copyWith => + _$$_MiraiTextSpanCopyWith<_$_MiraiTextSpan> get copyWith => throw _privateConstructorUsedError; } diff --git a/packages/mirai/lib/src/parsers/mirai_text/mirai_text.g.dart b/packages/mirai/lib/src/parsers/mirai_text/mirai_text.g.dart index e12d4ec7..3e228c0d 100644 --- a/packages/mirai/lib/src/parsers/mirai_text/mirai_text.g.dart +++ b/packages/mirai/lib/src/parsers/mirai_text/mirai_text.g.dart @@ -6,8 +6,7 @@ part of 'mirai_text.dart'; // JsonSerializableGenerator // ************************************************************************** -_$MiraiTextImpl _$$MiraiTextImplFromJson(Map json) => - _$MiraiTextImpl( +_$_MiraiText _$$_MiraiTextFromJson(Map json) => _$_MiraiText( data: json['data'] as String, children: (json['children'] as List?) ?.map((e) => MiraiTextSpan.fromJson(e as Map)) @@ -29,7 +28,7 @@ _$MiraiTextImpl _$$MiraiTextImplFromJson(Map json) => selectionColor: json['selectionColor'] as String?, ); -Map _$$MiraiTextImplToJson(_$MiraiTextImpl instance) => +Map _$$_MiraiTextToJson(_$_MiraiText instance) => { 'data': instance.data, 'children': instance.children, @@ -71,8 +70,8 @@ const _$TextWidthBasisEnumMap = { TextWidthBasis.longestLine: 'longestLine', }; -_$MiraiTextSpanImpl _$$MiraiTextSpanImplFromJson(Map json) => - _$MiraiTextSpanImpl( +_$_MiraiTextSpan _$$_MiraiTextSpanFromJson(Map json) => + _$_MiraiTextSpan( data: json['data'] as String?, style: json['style'] == null ? null @@ -80,7 +79,7 @@ _$MiraiTextSpanImpl _$$MiraiTextSpanImplFromJson(Map json) => onTap: json['onTap'] as Map?, ); -Map _$$MiraiTextSpanImplToJson(_$MiraiTextSpanImpl instance) => +Map _$$_MiraiTextSpanToJson(_$_MiraiTextSpan instance) => { 'data': instance.data, 'style': instance.style, diff --git a/packages/mirai/lib/src/utils/widget_type.dart b/packages/mirai/lib/src/utils/widget_type.dart index b8ae6417..533cb67a 100644 --- a/packages/mirai/lib/src/utils/widget_type.dart +++ b/packages/mirai/lib/src/utils/widget_type.dart @@ -39,4 +39,5 @@ enum WidgetType { switchButton, align, pageView, + networkWidget } From b4a4cd457610b6b4edc2ad2eb81fedafce9e723c Mon Sep 17 00:00:00 2001 From: Divyanshu Bhargava Date: Wed, 7 Feb 2024 18:48:34 +0400 Subject: [PATCH 2/2] Export Mirai Network Widget Parser --- .../parsers/mirai_network_widget/mirai_network_widget.dart | 2 ++ packages/mirai/lib/src/parsers/parsers.dart | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/mirai/lib/src/parsers/mirai_network_widget/mirai_network_widget.dart b/packages/mirai/lib/src/parsers/mirai_network_widget/mirai_network_widget.dart index 8362db7a..14b85b59 100644 --- a/packages/mirai/lib/src/parsers/mirai_network_widget/mirai_network_widget.dart +++ b/packages/mirai/lib/src/parsers/mirai_network_widget/mirai_network_widget.dart @@ -1,6 +1,8 @@ import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:mirai/mirai.dart'; +export 'mirai_network_widget_parser.dart'; + part 'mirai_network_widget.freezed.dart'; part 'mirai_network_widget.g.dart'; diff --git a/packages/mirai/lib/src/parsers/parsers.dart b/packages/mirai/lib/src/parsers/parsers.dart index e9be00ea..20ccab00 100644 --- a/packages/mirai/lib/src/parsers/parsers.dart +++ b/packages/mirai/lib/src/parsers/parsers.dart @@ -1,6 +1,7 @@ library parsers; export 'package:mirai/src/parsers/mirai_alert_dialog/mirai_alert_dialog.dart'; +export 'package:mirai/src/parsers/mirai_align/mirai_align.dart'; export 'package:mirai/src/parsers/mirai_alignment/mirai_alignment.dart'; export 'package:mirai/src/parsers/mirai_alignment_directional/mirai_alignment_directional.dart'; export 'package:mirai/src/parsers/mirai_alignment_geometry/mirai_alignment_geometry.dart'; @@ -39,8 +40,10 @@ export 'package:mirai/src/parsers/mirai_list_tile_theme_data/mirai_list_tile_the export 'package:mirai/src/parsers/mirai_list_view/mirai_list_view.dart'; export 'package:mirai/src/parsers/mirai_navigation_bar_item/mirai_bottom_navigation_bar_item.dart'; export 'package:mirai/src/parsers/mirai_navigation_bar_theme_data/mirai_navigation_bar_theme_data.dart'; +export 'package:mirai/src/parsers/mirai_network_widget/mirai_network_widget.dart'; export 'package:mirai/src/parsers/mirai_outlined_button/mirai_outlined_button.dart'; export 'package:mirai/src/parsers/mirai_padding/mirai_padding.dart'; +export 'package:mirai/src/parsers/mirai_page_view/mirai_page_view.dart'; export 'package:mirai/src/parsers/mirai_positioned/mirai_positioned.dart'; export 'package:mirai/src/parsers/mirai_row/mirai_row.dart'; export 'package:mirai/src/parsers/mirai_safe_area/mirai_safe_area.dart'; @@ -58,5 +61,3 @@ export 'package:mirai/src/parsers/mirai_text_field/mirai_text_field.dart'; export 'package:mirai/src/parsers/mirai_text_form_field/mirai_text_form_field.dart'; export 'package:mirai/src/parsers/mirai_text_style/mirai_text_style.dart'; export 'package:mirai/src/parsers/mirai_theme/mirai_theme.dart'; -export 'package:mirai/src/parsers/mirai_align/mirai_align.dart'; -export 'package:mirai/src/parsers/mirai_page_view/mirai_page_view.dart';