Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Added tabAlignment in mirai tab bar #235

Merged
merged 1 commit into from
Nov 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions examples/mirai_gallery/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -149,10 +149,10 @@ packages:
dependency: transitive
description:
name: collection
sha256: f092b211a4319e98e5ff58223576de6c2803db36221657b46c82574721240687
sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a
url: "https://pub.dev"
source: hosted
version: "1.17.2"
version: "1.18.0"
convert:
dependency: transitive
description:
Expand Down Expand Up @@ -375,10 +375,10 @@ packages:
dependency: transitive
description:
name: meta
sha256: "3c74dbf8763d36539f114c799d8a2d87343b5067e9d796ca22b5eb8437090ee3"
sha256: a6e590c838b18133bb482a2745ad77c5bb7715fb0451209e1a7567d416678b8e
url: "https://pub.dev"
source: hosted
version: "1.9.1"
version: "1.10.0"
mime:
dependency: transitive
description:
Expand Down Expand Up @@ -521,18 +521,18 @@ packages:
dependency: transitive
description:
name: stack_trace
sha256: c3c7d8edb15bee7f0f74debd4b9c5f3c2ea86766fe4178eb2a18eb30a0bdaed5
sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b"
url: "https://pub.dev"
source: hosted
version: "1.11.0"
version: "1.11.1"
stream_channel:
dependency: transitive
description:
name: stream_channel
sha256: "83615bee9045c1d322bbbd1ba209b7a749c2cbcdcb3fdd1df8eb488b3279c1c8"
sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7
url: "https://pub.dev"
source: hosted
version: "2.1.1"
version: "2.1.2"
stream_transform:
dependency: transitive
description:
Expand Down Expand Up @@ -561,10 +561,10 @@ packages:
dependency: transitive
description:
name: test_api
sha256: "75760ffd7786fffdfb9597c35c5b27eaeec82be8edfb6d71d32651128ed7aab8"
sha256: "5c2f730018264d276c20e4f1503fd1308dfbbae39ec8ee63c5236311ac06954b"
url: "https://pub.dev"
source: hosted
version: "0.6.0"
version: "0.6.1"
timing:
dependency: transitive
description:
Expand Down Expand Up @@ -601,10 +601,10 @@ packages:
dependency: transitive
description:
name: web
sha256: dc8ccd225a2005c1be616fe02951e2e342092edf968cf0844220383757ef8f10
sha256: afe077240a270dcfd2aafe77602b4113645af95d0ad31128cc02bce5ac5d5152
url: "https://pub.dev"
source: hosted
version: "0.1.4-beta"
version: "0.3.0"
web_socket_channel:
dependency: transitive
description:
Expand Down Expand Up @@ -654,5 +654,5 @@ packages:
source: hosted
version: "3.1.2"
sdks:
dart: ">=3.1.0-185.0.dev <4.0.0"
dart: ">=3.2.0-194.0.dev <4.0.0"
flutter: ">=3.7.0"
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 @@ -244,11 +251,11 @@ class _$MiraiTabBarCopyWithImpl<$Res, $Val extends MiraiTabBar>
}

/// @nodoc
abstract class _$$_MiraiTabBarCopyWith<$Res>
abstract class _$$MiraiTabBarImplCopyWith<$Res>
implements $MiraiTabBarCopyWith<$Res> {
factory _$$_MiraiTabBarCopyWith(
_$_MiraiTabBar value, $Res Function(_$_MiraiTabBar) then) =
__$$_MiraiTabBarCopyWithImpl<$Res>;
factory _$$MiraiTabBarImplCopyWith(
_$MiraiTabBarImpl value, $Res Function(_$MiraiTabBarImpl) then) =
__$$MiraiTabBarImplCopyWithImpl<$Res>;
@override
@useResult
$Res call(
Expand All @@ -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 All @@ -283,11 +291,11 @@ abstract class _$$_MiraiTabBarCopyWith<$Res>
}

/// @nodoc
class __$$_MiraiTabBarCopyWithImpl<$Res>
extends _$MiraiTabBarCopyWithImpl<$Res, _$_MiraiTabBar>
implements _$$_MiraiTabBarCopyWith<$Res> {
__$$_MiraiTabBarCopyWithImpl(
_$_MiraiTabBar _value, $Res Function(_$_MiraiTabBar) _then)
class __$$MiraiTabBarImplCopyWithImpl<$Res>
extends _$MiraiTabBarCopyWithImpl<$Res, _$MiraiTabBarImpl>
implements _$$MiraiTabBarImplCopyWith<$Res> {
__$$MiraiTabBarImplCopyWithImpl(
_$MiraiTabBarImpl _value, $Res Function(_$MiraiTabBarImpl) _then)
: super(_value, _then);

@pragma('vm:prefer-inline')
Expand All @@ -310,8 +318,9 @@ class __$$_MiraiTabBarCopyWithImpl<$Res>
Object? dragStartBehavior = null,
Object? enableFeedback = freezed,
Object? physics = freezed,
Object? tabAlignment = freezed,
}) {
return _then(_$_MiraiTabBar(
return _then(_$MiraiTabBarImpl(
tabs: null == tabs
? _value._tabs
: tabs // ignore: cast_nullable_to_non_nullable
Expand Down Expand Up @@ -381,14 +390,18 @@ 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?,
));
}
}

/// @nodoc
@JsonSerializable()
class _$_MiraiTabBar implements _MiraiTabBar {
const _$_MiraiTabBar(
class _$MiraiTabBarImpl implements _MiraiTabBar {
const _$MiraiTabBarImpl(
{required final List<Map<String, dynamic>> tabs,
this.initialIndex = 0,
this.isScrollable = false,
Expand All @@ -405,11 +418,12 @@ 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) =>
_$$_MiraiTabBarFromJson(json);
factory _$MiraiTabBarImpl.fromJson(Map<String, dynamic> json) =>
_$$MiraiTabBarImplFromJson(json);

final List<Map<String, dynamic>> _tabs;
@override
Expand Down Expand Up @@ -456,17 +470,19 @@ 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
bool operator ==(dynamic other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$_MiraiTabBar &&
other is _$MiraiTabBarImpl &&
const DeepCollectionEquality().equals(other._tabs, _tabs) &&
(identical(other.initialIndex, initialIndex) ||
other.initialIndex == initialIndex) &&
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,17 +540,18 @@ class _$_MiraiTabBar implements _MiraiTabBar {
unselectedLabelStyle,
dragStartBehavior,
enableFeedback,
physics);
physics,
tabAlignment);

@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$_MiraiTabBarCopyWith<_$_MiraiTabBar> get copyWith =>
__$$_MiraiTabBarCopyWithImpl<_$_MiraiTabBar>(this, _$identity);
_$$MiraiTabBarImplCopyWith<_$MiraiTabBarImpl> get copyWith =>
__$$MiraiTabBarImplCopyWithImpl<_$MiraiTabBarImpl>(this, _$identity);

@override
Map<String, dynamic> toJson() {
return _$$_MiraiTabBarToJson(
return _$$MiraiTabBarImplToJson(
this,
);
}
Expand All @@ -556,10 +575,11 @@ abstract class _MiraiTabBar implements MiraiTabBar {
final MiraiTextStyle? unselectedLabelStyle,
final DragStartBehavior dragStartBehavior,
final bool? enableFeedback,
final MiraiScrollPhysics? physics}) = _$_MiraiTabBar;
final MiraiScrollPhysics? physics,
final TabAlignment? tabAlignment}) = _$MiraiTabBarImpl;

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

@override
List<Map<String, dynamic>> get tabs;
Expand Down Expand Up @@ -596,7 +616,9 @@ abstract class _MiraiTabBar implements MiraiTabBar {
@override
MiraiScrollPhysics? get physics;
@override
TabAlignment? get tabAlignment;
@override
@JsonKey(ignore: true)
_$$_MiraiTabBarCopyWith<_$_MiraiTabBar> get copyWith =>
_$$MiraiTabBarImplCopyWith<_$MiraiTabBarImpl> get copyWith =>
throw _privateConstructorUsedError;
}
16 changes: 13 additions & 3 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,
);
}
}