Skip to content

Commit

Permalink
bug fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
mdddj committed May 22, 2023
1 parent 959ee3b commit 4f9c5bc
Show file tree
Hide file tree
Showing 6 changed files with 62 additions and 17 deletions.
14 changes: 7 additions & 7 deletions lib/app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,14 @@ class MyApp extends ApplicationWidget {
Widget buildApplication(ApplicationModel applicationModel) => const App();

@override
Widget buildErrorWidget(Object e, Object s,BuildContext context, WidgetRef ref) {
Widget buildErrorWidget(Object e, Object s, BuildContext context, WidgetRef ref) {
if (e is AppException) {
kLog(e.message);
}
return InitLoadingWidget(isError: true,retry: ()=>ref.invalidate(application(ApplocationContext(context, ref))),);
return InitLoadingWidget(
isError: true,
retry: () => ref.invalidate(application(ApplocationContext(context, ref))),
);
}

@override
Expand Down Expand Up @@ -80,11 +83,6 @@ class AppBottomNav extends View {
currentIndex: currentIndex,
onTap: ((index) {
appCore.ref.read(homeModuleShowIndex.notifier).state = index;
if (index == 3) {
delayFunction(() {
appCore.favoritesRepository.refresh(true);
});
}
}),
items: [
BottomNavigationBarItem(label: '首页', icon: _buildIcon(currentIndex, 0, 'home', context)),
Expand All @@ -95,3 +93,5 @@ class AppBottomNav extends View {
]);
}
}


2 changes: 1 addition & 1 deletion lib/common/view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ extension ApplicationContextEx on ApplocationContext {
extension ApplicationModelEx on ApplicationModel {
IList<Category> get watchCategory => ref.watch(categoryRiverpod.select((value) => value.categorys));
}

typedef MyView = View;
///自定义封装view
abstract class View extends ConsumerWidget {
const View({super.key});
Expand Down
2 changes: 1 addition & 1 deletion lib/provider/riverpod/favorites/riverpod_model.g.dart

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

16 changes: 15 additions & 1 deletion lib/provider/riverpod/model/my_user.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,21 @@ class MyUser with _$MyUser{
@Default(false) bool accountNonExpired,
@Default(false) bool accountNonLocked,
@Default(false) bool credentialsNonExpired,

@Default(Vip.none) Vip vip
}) = _MyUser;
factory MyUser.fromJson(Map<String,Object?> json)=>_$MyUserFromJson(json);
}

@JsonEnum(valueField: 'vip')
enum Vip {
@JsonValue(0)
none,
@JsonValue(1)
vip,

@JsonValue(2)
superVip,

@JsonValue(3)
specialVip
}
36 changes: 29 additions & 7 deletions lib/provider/riverpod/model/my_user.freezed.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ mixin _$MyUser {
bool get accountNonExpired => throw _privateConstructorUsedError;
bool get accountNonLocked => throw _privateConstructorUsedError;
bool get credentialsNonExpired => throw _privateConstructorUsedError;
Vip get vip => throw _privateConstructorUsedError;

Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
@JsonKey(ignore: true)
Expand All @@ -59,7 +60,8 @@ abstract class $MyUserCopyWith<$Res> {
bool enabled,
bool accountNonExpired,
bool accountNonLocked,
bool credentialsNonExpired});
bool credentialsNonExpired,
Vip vip});
}

/// @nodoc
Expand Down Expand Up @@ -89,6 +91,7 @@ class _$MyUserCopyWithImpl<$Res, $Val extends MyUser>
Object? accountNonExpired = null,
Object? accountNonLocked = null,
Object? credentialsNonExpired = null,
Object? vip = null,
}) {
return _then(_value.copyWith(
id: null == id
Expand Down Expand Up @@ -147,6 +150,10 @@ class _$MyUserCopyWithImpl<$Res, $Val extends MyUser>
? _value.credentialsNonExpired
: credentialsNonExpired // ignore: cast_nullable_to_non_nullable
as bool,
vip: null == vip
? _value.vip
: vip // ignore: cast_nullable_to_non_nullable
as Vip,
) as $Val);
}
}
Expand All @@ -171,7 +178,8 @@ abstract class _$$_MyUserCopyWith<$Res> implements $MyUserCopyWith<$Res> {
bool enabled,
bool accountNonExpired,
bool accountNonLocked,
bool credentialsNonExpired});
bool credentialsNonExpired,
Vip vip});
}

/// @nodoc
Expand All @@ -198,6 +206,7 @@ class __$$_MyUserCopyWithImpl<$Res>
Object? accountNonExpired = null,
Object? accountNonLocked = null,
Object? credentialsNonExpired = null,
Object? vip = null,
}) {
return _then(_$_MyUser(
id: null == id
Expand Down Expand Up @@ -256,6 +265,10 @@ class __$$_MyUserCopyWithImpl<$Res>
? _value.credentialsNonExpired
: credentialsNonExpired // ignore: cast_nullable_to_non_nullable
as bool,
vip: null == vip
? _value.vip
: vip // ignore: cast_nullable_to_non_nullable
as Vip,
));
}
}
Expand All @@ -277,7 +290,8 @@ class _$_MyUser implements _MyUser {
this.enabled = false,
this.accountNonExpired = false,
this.accountNonLocked = false,
this.credentialsNonExpired = false});
this.credentialsNonExpired = false,
this.vip = Vip.none});

factory _$_MyUser.fromJson(Map<String, dynamic> json) =>
_$$_MyUserFromJson(json);
Expand Down Expand Up @@ -323,10 +337,13 @@ class _$_MyUser implements _MyUser {
@override
@JsonKey()
final bool credentialsNonExpired;
@override
@JsonKey()
final Vip vip;

@override
String toString() {
return 'MyUser(id: $id, loginNumber: $loginNumber, username: $username, email: $email, nickName: $nickName, picture: $picture, phone: $phone, type: $type, status: $status, loginTime: $loginTime, enabled: $enabled, accountNonExpired: $accountNonExpired, accountNonLocked: $accountNonLocked, credentialsNonExpired: $credentialsNonExpired)';
return 'MyUser(id: $id, loginNumber: $loginNumber, username: $username, email: $email, nickName: $nickName, picture: $picture, phone: $phone, type: $type, status: $status, loginTime: $loginTime, enabled: $enabled, accountNonExpired: $accountNonExpired, accountNonLocked: $accountNonLocked, credentialsNonExpired: $credentialsNonExpired, vip: $vip)';
}

@override
Expand Down Expand Up @@ -354,7 +371,8 @@ class _$_MyUser implements _MyUser {
(identical(other.accountNonLocked, accountNonLocked) ||
other.accountNonLocked == accountNonLocked) &&
(identical(other.credentialsNonExpired, credentialsNonExpired) ||
other.credentialsNonExpired == credentialsNonExpired));
other.credentialsNonExpired == credentialsNonExpired) &&
(identical(other.vip, vip) || other.vip == vip));
}

@JsonKey(ignore: true)
Expand All @@ -374,7 +392,8 @@ class _$_MyUser implements _MyUser {
enabled,
accountNonExpired,
accountNonLocked,
credentialsNonExpired);
credentialsNonExpired,
vip);

@JsonKey(ignore: true)
@override
Expand Down Expand Up @@ -405,7 +424,8 @@ abstract class _MyUser implements MyUser {
final bool enabled,
final bool accountNonExpired,
final bool accountNonLocked,
final bool credentialsNonExpired}) = _$_MyUser;
final bool credentialsNonExpired,
final Vip vip}) = _$_MyUser;

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

Expand Down Expand Up @@ -438,6 +458,8 @@ abstract class _MyUser implements MyUser {
@override
bool get credentialsNonExpired;
@override
Vip get vip;
@override
@JsonKey(ignore: true)
_$$_MyUserCopyWith<_$_MyUser> get copyWith =>
throw _privateConstructorUsedError;
Expand Down
9 changes: 9 additions & 0 deletions lib/provider/riverpod/model/my_user.g.dart

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

0 comments on commit 4f9c5bc

Please sign in to comment.