Skip to content

Commit

Permalink
feat: Added tabAlignment in mirai tab bar
Browse files Browse the repository at this point in the history
  • Loading branch information
i-asimkhan committed Nov 28, 2023
1 parent 87c0d79 commit f3c98fb
Show file tree
Hide file tree
Showing 7 changed files with 66 additions and 31 deletions.
42 changes: 21 additions & 21 deletions packages/mirai/lib/src/parsers/mirai_align/mirai_align.freezed.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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')
Expand All @@ -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
Expand All @@ -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<String, dynamic>? child})
: _child = child;

factory _$MiraiAlignImpl.fromJson(Map<String, dynamic> json) =>
_$$MiraiAlignImplFromJson(json);
factory _$_MiraiAlign.fromJson(Map<String, dynamic> json) =>
_$$_MiraiAlignFromJson(json);

@override
@JsonKey()
Expand Down Expand Up @@ -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) ||
Expand All @@ -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<String, dynamic> toJson() {
return _$$MiraiAlignImplToJson(
return _$$_MiraiAlignToJson(
this,
);
}
Expand All @@ -208,10 +208,10 @@ abstract class _MiraiAlign implements MiraiAlign {
{final MiraiAlignmentDirectional alignment,
final double? widthFactor,
final double? heightFactor,
final Map<String, dynamic>? child}) = _$MiraiAlignImpl;
final Map<String, dynamic>? child}) = _$_MiraiAlign;

factory _MiraiAlign.fromJson(Map<String, dynamic> json) =
_$MiraiAlignImpl.fromJson;
_$_MiraiAlign.fromJson;

@override
MiraiAlignmentDirectional get alignment;
Expand All @@ -223,6 +223,6 @@ abstract class _MiraiAlign implements MiraiAlign {
Map<String, dynamic>? get child;
@override
@JsonKey(ignore: true)
_$$MiraiAlignImplCopyWith<_$MiraiAlignImpl> get copyWith =>
_$$_MiraiAlignCopyWith<_$_MiraiAlign> get copyWith =>
throw _privateConstructorUsedError;
}
6 changes: 3 additions & 3 deletions packages/mirai/lib/src/parsers/mirai_align/mirai_align.g.dart

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 @@ -30,6 +30,7 @@ class MiraiTabBar with _$MiraiTabBar {
@Default(DragStartBehavior.start) DragStartBehavior dragStartBehavior,
bool? enableFeedback,
MiraiScrollPhysics? physics,
TabAlignment? tabAlignment,
}) = _MiraiTabBar;

factory MiraiTabBar.fromJson(Map<String, dynamic> json) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ mixin _$MiraiTabBar {
DragStartBehavior get dragStartBehavior => throw _privateConstructorUsedError;
bool? get enableFeedback => throw _privateConstructorUsedError;
MiraiScrollPhysics? get physics => throw _privateConstructorUsedError;
TabAlignment? get tabAlignment => throw _privateConstructorUsedError;

Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
@JsonKey(ignore: true)
Expand Down Expand Up @@ -69,7 +70,8 @@ abstract class $MiraiTabBarCopyWith<$Res> {
MiraiTextStyle? unselectedLabelStyle,
DragStartBehavior dragStartBehavior,
bool? enableFeedback,
MiraiScrollPhysics? physics});
MiraiScrollPhysics? physics,
TabAlignment? tabAlignment});

$MiraiEdgeInsetsCopyWith<$Res>? get padding;
$MiraiEdgeInsetsCopyWith<$Res>? get indicatorPadding;
Expand Down Expand Up @@ -108,6 +110,7 @@ class _$MiraiTabBarCopyWithImpl<$Res, $Val extends MiraiTabBar>
Object? dragStartBehavior = null,
Object? enableFeedback = freezed,
Object? physics = freezed,
Object? tabAlignment = freezed,
}) {
return _then(_value.copyWith(
tabs: null == tabs
Expand Down Expand Up @@ -179,6 +182,10 @@ class _$MiraiTabBarCopyWithImpl<$Res, $Val extends MiraiTabBar>
? _value.physics
: physics // ignore: cast_nullable_to_non_nullable
as MiraiScrollPhysics?,
tabAlignment: freezed == tabAlignment
? _value.tabAlignment
: tabAlignment // ignore: cast_nullable_to_non_nullable
as TabAlignment?,
) as $Val);
}

Expand Down Expand Up @@ -268,7 +275,8 @@ abstract class _$$_MiraiTabBarCopyWith<$Res>
MiraiTextStyle? unselectedLabelStyle,
DragStartBehavior dragStartBehavior,
bool? enableFeedback,
MiraiScrollPhysics? physics});
MiraiScrollPhysics? physics,
TabAlignment? tabAlignment});

@override
$MiraiEdgeInsetsCopyWith<$Res>? get padding;
Expand Down Expand Up @@ -310,6 +318,7 @@ class __$$_MiraiTabBarCopyWithImpl<$Res>
Object? dragStartBehavior = null,
Object? enableFeedback = freezed,
Object? physics = freezed,
Object? tabAlignment = freezed,
}) {
return _then(_$_MiraiTabBar(
tabs: null == tabs
Expand Down Expand Up @@ -381,6 +390,10 @@ class __$$_MiraiTabBarCopyWithImpl<$Res>
? _value.physics
: physics // ignore: cast_nullable_to_non_nullable
as MiraiScrollPhysics?,
tabAlignment: freezed == tabAlignment
? _value.tabAlignment
: tabAlignment // ignore: cast_nullable_to_non_nullable
as TabAlignment?,
));
}
}
Expand All @@ -405,7 +418,8 @@ class _$_MiraiTabBar implements _MiraiTabBar {
this.unselectedLabelStyle,
this.dragStartBehavior = DragStartBehavior.start,
this.enableFeedback,
this.physics})
this.physics,
this.tabAlignment})
: _tabs = tabs;

factory _$_MiraiTabBar.fromJson(Map<String, dynamic> json) =>
Expand Down Expand Up @@ -456,10 +470,12 @@ class _$_MiraiTabBar implements _MiraiTabBar {
final bool? enableFeedback;
@override
final MiraiScrollPhysics? physics;
@override
final TabAlignment? tabAlignment;

@override
String toString() {
return 'MiraiTabBar(tabs: $tabs, initialIndex: $initialIndex, isScrollable: $isScrollable, padding: $padding, indicatorColor: $indicatorColor, automaticIndicatorColorAdjustment: $automaticIndicatorColorAdjustment, indicatorWeight: $indicatorWeight, indicatorPadding: $indicatorPadding, indicatorSize: $indicatorSize, labelColor: $labelColor, labelStyle: $labelStyle, labelPadding: $labelPadding, unselectedLabelColor: $unselectedLabelColor, unselectedLabelStyle: $unselectedLabelStyle, dragStartBehavior: $dragStartBehavior, enableFeedback: $enableFeedback, physics: $physics)';
return 'MiraiTabBar(tabs: $tabs, initialIndex: $initialIndex, isScrollable: $isScrollable, padding: $padding, indicatorColor: $indicatorColor, automaticIndicatorColorAdjustment: $automaticIndicatorColorAdjustment, indicatorWeight: $indicatorWeight, indicatorPadding: $indicatorPadding, indicatorSize: $indicatorSize, labelColor: $labelColor, labelStyle: $labelStyle, labelPadding: $labelPadding, unselectedLabelColor: $unselectedLabelColor, unselectedLabelStyle: $unselectedLabelStyle, dragStartBehavior: $dragStartBehavior, enableFeedback: $enableFeedback, physics: $physics, tabAlignment: $tabAlignment)';
}

@override
Expand Down Expand Up @@ -499,7 +515,9 @@ class _$_MiraiTabBar implements _MiraiTabBar {
other.dragStartBehavior == dragStartBehavior) &&
(identical(other.enableFeedback, enableFeedback) ||
other.enableFeedback == enableFeedback) &&
(identical(other.physics, physics) || other.physics == physics));
(identical(other.physics, physics) || other.physics == physics) &&
(identical(other.tabAlignment, tabAlignment) ||
other.tabAlignment == tabAlignment));
}

@JsonKey(ignore: true)
Expand All @@ -522,7 +540,8 @@ class _$_MiraiTabBar implements _MiraiTabBar {
unselectedLabelStyle,
dragStartBehavior,
enableFeedback,
physics);
physics,
tabAlignment);

@JsonKey(ignore: true)
@override
Expand Down Expand Up @@ -556,7 +575,8 @@ abstract class _MiraiTabBar implements MiraiTabBar {
final MiraiTextStyle? unselectedLabelStyle,
final DragStartBehavior dragStartBehavior,
final bool? enableFeedback,
final MiraiScrollPhysics? physics}) = _$_MiraiTabBar;
final MiraiScrollPhysics? physics,
final TabAlignment? tabAlignment}) = _$_MiraiTabBar;

factory _MiraiTabBar.fromJson(Map<String, dynamic> json) =
_$_MiraiTabBar.fromJson;
Expand Down Expand Up @@ -596,6 +616,8 @@ abstract class _MiraiTabBar implements MiraiTabBar {
@override
MiraiScrollPhysics? get physics;
@override
TabAlignment? get tabAlignment;
@override
@JsonKey(ignore: true)
_$$_MiraiTabBarCopyWith<_$_MiraiTabBar> get copyWith =>
throw _privateConstructorUsedError;
Expand Down
10 changes: 10 additions & 0 deletions packages/mirai/lib/src/parsers/mirai_tab_bar/mirai_tab_bar.g.dart

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 @@ -42,6 +42,7 @@ class MiraiTabBarParser extends MiraiParser<MiraiTabBar> {
enableFeedback: model.enableFeedback,
onTap: (_) {},
physics: model.physics?.parse,
tabAlignment: model.tabAlignment,
);
}
}
1 change: 1 addition & 0 deletions packages/mirai/lib/src/parsers/parsers.dart
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,4 @@ export 'package:mirai/src/parsers/mirai_text_form_field/mirai_text_form_field.da
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/utils/mirai_scroll_physics.dart';

0 comments on commit f3c98fb

Please sign in to comment.