♻️ Refactor router, moved from auto_router to go_router
This commit is contained in:
@ -1,14 +1,13 @@
|
||||
import 'package:auto_route/auto_route.dart';
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:gap/gap.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
import 'package:island/pods/message.dart';
|
||||
import 'package:island/pods/network.dart';
|
||||
import 'package:island/pods/userinfo.dart';
|
||||
import 'package:island/route.gr.dart';
|
||||
import 'package:island/screens/notification.dart';
|
||||
import 'package:island/services/responsive.dart';
|
||||
import 'package:island/widgets/account/account_name.dart';
|
||||
@ -19,9 +18,9 @@ import 'package:island/widgets/content/cloud_files.dart';
|
||||
import 'package:material_symbols_icons/symbols.dart';
|
||||
import 'package:styled_widget/styled_widget.dart';
|
||||
|
||||
@RoutePage()
|
||||
class AccountShellScreen extends HookConsumerWidget {
|
||||
const AccountShellScreen({super.key});
|
||||
final Widget child;
|
||||
const AccountShellScreen({super.key, required this.child});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
@ -34,17 +33,16 @@ class AccountShellScreen extends HookConsumerWidget {
|
||||
children: [
|
||||
Flexible(flex: 2, child: AccountScreen(isAside: true)),
|
||||
VerticalDivider(width: 1),
|
||||
Flexible(flex: 3, child: AutoRouter()),
|
||||
Flexible(flex: 3, child: child),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
return AppBackground(isRoot: true, child: AutoRouter());
|
||||
return AppBackground(isRoot: true, child: child);
|
||||
}
|
||||
}
|
||||
|
||||
@RoutePage()
|
||||
class AccountScreen extends HookConsumerWidget {
|
||||
final bool isAside;
|
||||
const AccountScreen({super.key, this.isAside = false});
|
||||
@ -100,9 +98,7 @@ class AccountScreen extends HookConsumerWidget {
|
||||
radius: 24,
|
||||
),
|
||||
onTap: () {
|
||||
context.router.push(
|
||||
AccountProfileRoute(name: user.value!.name),
|
||||
);
|
||||
context.push('/account/${user.value!.name}');
|
||||
},
|
||||
),
|
||||
Expanded(
|
||||
@ -147,7 +143,7 @@ class AccountScreen extends HookConsumerWidget {
|
||||
progress: user.value!.profile.levelingProgress,
|
||||
),
|
||||
onTap: () {
|
||||
context.router.push(LevelingRoute());
|
||||
context.push('/account/leveling');
|
||||
},
|
||||
).padding(horizontal: 12),
|
||||
Row(
|
||||
@ -165,7 +161,7 @@ class AccountScreen extends HookConsumerWidget {
|
||||
],
|
||||
).padding(horizontal: 16, vertical: 12),
|
||||
onTap: () {
|
||||
context.router.push(CreatorHubShellRoute());
|
||||
context.push('/creators');
|
||||
},
|
||||
),
|
||||
).height(140),
|
||||
@ -204,7 +200,7 @@ class AccountScreen extends HookConsumerWidget {
|
||||
],
|
||||
),
|
||||
onTap: () {
|
||||
context.router.push(NotificationRoute());
|
||||
context.push('/notification');
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
@ -214,7 +210,7 @@ class AccountScreen extends HookConsumerWidget {
|
||||
contentPadding: EdgeInsets.symmetric(horizontal: 24),
|
||||
title: Text('wallet').tr(),
|
||||
onTap: () {
|
||||
context.router.push(WalletRoute());
|
||||
context.push('/wallet');
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
@ -224,7 +220,7 @@ class AccountScreen extends HookConsumerWidget {
|
||||
contentPadding: EdgeInsets.symmetric(horizontal: 24),
|
||||
title: Text('relationships').tr(),
|
||||
onTap: () {
|
||||
context.router.push(RelationshipRoute());
|
||||
context.push('/account/relationship');
|
||||
},
|
||||
),
|
||||
const Divider(height: 1).padding(vertical: 8),
|
||||
@ -235,7 +231,7 @@ class AccountScreen extends HookConsumerWidget {
|
||||
contentPadding: EdgeInsets.symmetric(horizontal: 24),
|
||||
title: Text('appSettings').tr(),
|
||||
onTap: () {
|
||||
context.router.push(SettingsRoute());
|
||||
context.push('/settings');
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
@ -245,7 +241,7 @@ class AccountScreen extends HookConsumerWidget {
|
||||
contentPadding: EdgeInsets.symmetric(horizontal: 24),
|
||||
title: Text('updateYourProfile').tr(),
|
||||
onTap: () {
|
||||
context.router.push(UpdateProfileRoute());
|
||||
context.push('/account/me/update');
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
@ -255,7 +251,7 @@ class AccountScreen extends HookConsumerWidget {
|
||||
contentPadding: EdgeInsets.symmetric(horizontal: 24),
|
||||
title: Text('accountSettings').tr(),
|
||||
onTap: () {
|
||||
context.router.push(AccountSettingsRoute());
|
||||
context.push('/account/me/settings');
|
||||
},
|
||||
),
|
||||
if (kDebugMode) const Divider(height: 1).padding(vertical: 8),
|
||||
@ -320,7 +316,7 @@ class _UnauthorizedAccountScreen extends StatelessWidget {
|
||||
child: Card(
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
context.router.push(CreateAccountRoute());
|
||||
context.push('/auth/create');
|
||||
},
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(16),
|
||||
@ -342,7 +338,7 @@ class _UnauthorizedAccountScreen extends StatelessWidget {
|
||||
child: Card(
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
context.router.push(LoginRoute());
|
||||
context.push('/auth/login');
|
||||
},
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(16),
|
||||
@ -361,7 +357,7 @@ class _UnauthorizedAccountScreen extends StatelessWidget {
|
||||
const Gap(8),
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
context.router.push(SettingsRoute());
|
||||
context.push('/settings');
|
||||
},
|
||||
child: Text('appSettings').tr(),
|
||||
).center(),
|
||||
|
@ -1,4 +1,3 @@
|
||||
import 'package:auto_route/auto_route.dart';
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||
@ -12,10 +11,9 @@ import 'package:island/widgets/account/event_calendar.dart';
|
||||
import 'package:island/widgets/account/fortune_graph.dart';
|
||||
import 'package:styled_widget/styled_widget.dart';
|
||||
|
||||
@RoutePage()
|
||||
class EventCalanderScreen extends HookConsumerWidget {
|
||||
final String name;
|
||||
const EventCalanderScreen({super.key, @PathParam("name") required this.name});
|
||||
const EventCalanderScreen({super.key, required this.name});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
|
@ -1,4 +1,3 @@
|
||||
import 'package:auto_route/auto_route.dart';
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:gap/gap.dart';
|
||||
@ -31,7 +30,6 @@ Future<SnWalletSubscription?> accountStellarSubscription(Ref ref) async {
|
||||
}
|
||||
}
|
||||
|
||||
@RoutePage()
|
||||
class LevelingScreen extends HookConsumerWidget {
|
||||
const LevelingScreen({super.key});
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:auto_route/annotations.dart';
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
@ -51,7 +50,6 @@ Future<List<SnAccountConnection>> accountConnections(Ref ref) async {
|
||||
.toList();
|
||||
}
|
||||
|
||||
@RoutePage()
|
||||
class AccountSettingsScreen extends HookConsumerWidget {
|
||||
const AccountSettingsScreen({super.key});
|
||||
|
||||
|
@ -1,4 +1,3 @@
|
||||
import 'package:auto_route/auto_route.dart';
|
||||
import 'package:croppy/croppy.dart' hide cropImage;
|
||||
import 'package:dropdown_button2/dropdown_button2.dart';
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
@ -20,7 +19,6 @@ import 'package:styled_widget/styled_widget.dart';
|
||||
|
||||
const kServerSupportedLanguages = {'en-US': 'en-us', 'zh-CN': 'zh-hans'};
|
||||
|
||||
@RoutePage()
|
||||
class UpdateProfileScreen extends HookConsumerWidget {
|
||||
const UpdateProfileScreen({super.key});
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
import 'package:auto_route/auto_route.dart';
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:gap/gap.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
import 'package:island/models/chat.dart';
|
||||
@ -96,13 +96,9 @@ Future<SnRelationship?> accountRelationship(Ref ref, String uname) async {
|
||||
}
|
||||
}
|
||||
|
||||
@RoutePage()
|
||||
class AccountProfileScreen extends HookConsumerWidget {
|
||||
final String name;
|
||||
const AccountProfileScreen({
|
||||
super.key,
|
||||
@PathParam("name") required this.name,
|
||||
});
|
||||
const AccountProfileScreen({super.key, required this.name});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
@ -142,7 +138,7 @@ class AccountProfileScreen extends HookConsumerWidget {
|
||||
Future<void> directMessageAction() async {
|
||||
if (!account.hasValue) return;
|
||||
if (accountChat.value != null) {
|
||||
context.router.pushPath('/chat/${accountChat.value!.id}');
|
||||
context.push('/chat/${accountChat.value!.id}');
|
||||
return;
|
||||
}
|
||||
showLoadingModal(context);
|
||||
@ -153,7 +149,7 @@ class AccountProfileScreen extends HookConsumerWidget {
|
||||
data: {'related_user_id': account.value!.id},
|
||||
);
|
||||
final chat = SnChatRoom.fromJson(resp.data);
|
||||
if (context.mounted) context.router.pushPath('/chat/${chat.id}');
|
||||
if (context.mounted) context.push('/chat/${chat.id}');
|
||||
ref.invalidate(accountDirectChatProvider(name));
|
||||
} catch (err) {
|
||||
showErrorAlert(err);
|
||||
|
@ -1,4 +1,3 @@
|
||||
import 'package:auto_route/auto_route.dart';
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
@ -204,7 +203,6 @@ class RelationshipListTile extends StatelessWidget {
|
||||
}
|
||||
}
|
||||
|
||||
@RoutePage()
|
||||
class RelationshipScreen extends HookConsumerWidget {
|
||||
const RelationshipScreen({super.key});
|
||||
|
||||
|
@ -1,12 +1,11 @@
|
||||
import 'package:auto_route/auto_route.dart';
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:email_validator/email_validator.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||
import 'package:gap/gap.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
import 'package:island/pods/network.dart';
|
||||
import 'package:island/route.gr.dart';
|
||||
import 'package:island/screens/account/me/update.dart';
|
||||
import 'package:island/widgets/alert.dart';
|
||||
import 'package:island/widgets/app_scaffold.dart';
|
||||
@ -16,7 +15,6 @@ import 'package:url_launcher/url_launcher_string.dart';
|
||||
|
||||
import 'captcha.dart';
|
||||
|
||||
@RoutePage()
|
||||
class CreateAccountScreen extends HookConsumerWidget {
|
||||
const CreateAccountScreen({super.key});
|
||||
|
||||
@ -307,7 +305,7 @@ class _PostCreateModal extends HookConsumerWidget {
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
context.router.replace(LoginRoute());
|
||||
context.pushReplacement('/auth/login');
|
||||
},
|
||||
child: Text('login'.tr()),
|
||||
),
|
||||
|
@ -3,7 +3,6 @@ import 'dart:io';
|
||||
import 'dart:math' as math;
|
||||
|
||||
import 'package:animations/animations.dart';
|
||||
import 'package:auto_route/auto_route.dart';
|
||||
import 'package:device_info_plus/device_info_plus.dart';
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
@ -43,7 +42,6 @@ final Map<int, (String, String, IconData)> kFactorTypes = {
|
||||
4: ('authFactorPin', 'authFactorPinDescription', Symbols.nest_secure_alarm),
|
||||
};
|
||||
|
||||
@RoutePage()
|
||||
class LoginScreen extends HookConsumerWidget {
|
||||
const LoginScreen({super.key});
|
||||
|
||||
|
@ -1,4 +1,3 @@
|
||||
import 'package:auto_route/annotations.dart';
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||
@ -14,10 +13,9 @@ import 'package:livekit_client/livekit_client.dart';
|
||||
import 'package:material_symbols_icons/symbols.dart';
|
||||
import 'package:styled_widget/styled_widget.dart';
|
||||
|
||||
@RoutePage()
|
||||
class CallScreen extends HookConsumerWidget {
|
||||
final String roomId;
|
||||
const CallScreen({super.key, @PathParam('id') required this.roomId});
|
||||
const CallScreen({super.key, required this.roomId});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
|
@ -1,9 +1,9 @@
|
||||
import 'package:auto_route/auto_route.dart';
|
||||
import 'package:collection/collection.dart';
|
||||
import 'package:croppy/croppy.dart' hide cropImage;
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||
import 'package:gap/gap.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
@ -15,7 +15,6 @@ import 'package:island/pods/call.dart';
|
||||
import 'package:island/pods/chat_summary.dart';
|
||||
import 'package:island/pods/config.dart';
|
||||
import 'package:island/pods/network.dart';
|
||||
import 'package:island/route.gr.dart';
|
||||
import 'package:island/screens/realm/realms.dart';
|
||||
import 'package:island/services/file.dart';
|
||||
import 'package:island/services/responsive.dart';
|
||||
@ -173,9 +172,9 @@ Future<List<SnChatRoom>> chatroomsJoined(Ref ref) async {
|
||||
.toList();
|
||||
}
|
||||
|
||||
@RoutePage()
|
||||
class ChatShellScreen extends HookConsumerWidget {
|
||||
const ChatShellScreen({super.key});
|
||||
final Widget child;
|
||||
const ChatShellScreen({super.key, required this.child});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
@ -188,17 +187,16 @@ class ChatShellScreen extends HookConsumerWidget {
|
||||
children: [
|
||||
Flexible(flex: 2, child: ChatListScreen(isAside: true)),
|
||||
VerticalDivider(width: 1),
|
||||
Flexible(flex: 4, child: AutoRouter()),
|
||||
Flexible(flex: 4, child: child),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
return AppBackground(isRoot: true, child: AutoRouter());
|
||||
return AppBackground(isRoot: true, child: child);
|
||||
}
|
||||
}
|
||||
|
||||
@RoutePage()
|
||||
class ChatListScreen extends HookConsumerWidget {
|
||||
final bool isAside;
|
||||
const ChatListScreen({super.key, this.isAside = false});
|
||||
@ -319,7 +317,7 @@ class ChatListScreen extends HookConsumerWidget {
|
||||
leading: const Icon(Symbols.add),
|
||||
onTap: () {
|
||||
Navigator.pop(context);
|
||||
context.pushRoute(NewChatRoute()).then((value) {
|
||||
context.push('/chat/new').then((value) {
|
||||
if (value != null) {
|
||||
ref.invalidate(chatroomsJoinedProvider);
|
||||
}
|
||||
@ -400,16 +398,7 @@ class ChatListScreen extends HookConsumerWidget {
|
||||
room: item,
|
||||
isDirect: item.type == 1,
|
||||
onTap: () {
|
||||
if (context.router.topRoute.name ==
|
||||
ChatRoomRoute.name) {
|
||||
context.router.replace(
|
||||
ChatRoomRoute(id: item.id),
|
||||
);
|
||||
} else {
|
||||
context.router.push(
|
||||
ChatRoomRoute(id: item.id),
|
||||
);
|
||||
}
|
||||
context.push('/chat/${item.id}');
|
||||
},
|
||||
);
|
||||
},
|
||||
@ -456,7 +445,6 @@ Future<SnChatMember?> chatroomIdentity(Ref ref, String? identifier) async {
|
||||
return SnChatMember.fromJson(resp.data);
|
||||
}
|
||||
|
||||
@RoutePage()
|
||||
class NewChatScreen extends StatelessWidget {
|
||||
const NewChatScreen({super.key});
|
||||
|
||||
@ -466,10 +454,9 @@ class NewChatScreen extends StatelessWidget {
|
||||
}
|
||||
}
|
||||
|
||||
@RoutePage()
|
||||
class EditChatScreen extends HookConsumerWidget {
|
||||
final String? id;
|
||||
const EditChatScreen({super.key, @PathParam("id") this.id});
|
||||
const EditChatScreen({super.key, this.id});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
@ -579,7 +566,7 @@ class EditChatScreen extends HookConsumerWidget {
|
||||
options: Options(method: id == null ? 'POST' : 'PATCH'),
|
||||
);
|
||||
if (context.mounted) {
|
||||
context.maybePop(SnChatRoom.fromJson(resp.data));
|
||||
context.pop(SnChatRoom.fromJson(resp.data));
|
||||
}
|
||||
} catch (err) {
|
||||
showErrorAlert(err);
|
||||
|
@ -1,10 +1,10 @@
|
||||
import 'dart:async';
|
||||
import 'dart:convert';
|
||||
import 'dart:io';
|
||||
import 'package:auto_route/auto_route.dart';
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||
import 'package:gap/gap.dart';
|
||||
@ -18,7 +18,6 @@ import 'package:island/pods/config.dart';
|
||||
import 'package:island/pods/database.dart';
|
||||
import 'package:island/pods/network.dart';
|
||||
import 'package:island/pods/websocket.dart';
|
||||
import 'package:island/route.gr.dart';
|
||||
import 'package:island/services/responsive.dart';
|
||||
import 'package:island/widgets/alert.dart';
|
||||
import 'package:island/widgets/app_scaffold.dart';
|
||||
@ -288,10 +287,9 @@ class MessagesNotifier extends _$MessagesNotifier {
|
||||
}
|
||||
}
|
||||
|
||||
@RoutePage()
|
||||
class ChatRoomScreen extends HookConsumerWidget {
|
||||
final String id;
|
||||
const ChatRoomScreen({super.key, @PathParam("id") required this.id});
|
||||
const ChatRoomScreen({super.key, required this.id});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
@ -605,7 +603,7 @@ class ChatRoomScreen extends HookConsumerWidget {
|
||||
IconButton(
|
||||
icon: const Icon(Icons.more_vert),
|
||||
onPressed: () {
|
||||
context.router.push(ChatDetailRoute(id: id));
|
||||
context.push('/chat/id/detail');
|
||||
},
|
||||
),
|
||||
const Gap(8),
|
||||
|
@ -1,14 +1,13 @@
|
||||
import 'package:auto_route/auto_route.dart';
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
import 'package:gap/gap.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
import 'package:island/models/chat.dart';
|
||||
import 'package:island/pods/network.dart';
|
||||
import 'package:island/route.gr.dart';
|
||||
import 'package:island/screens/chat/chat.dart';
|
||||
import 'package:island/widgets/account/account_picker.dart';
|
||||
import 'package:island/widgets/alert.dart';
|
||||
@ -23,10 +22,9 @@ import 'package:styled_widget/styled_widget.dart';
|
||||
part 'room_detail.freezed.dart';
|
||||
part 'room_detail.g.dart';
|
||||
|
||||
@RoutePage()
|
||||
class ChatDetailScreen extends HookConsumerWidget {
|
||||
final String id;
|
||||
const ChatDetailScreen({super.key, @PathParam("id") required this.id});
|
||||
const ChatDetailScreen({super.key, required this.id});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
@ -391,7 +389,7 @@ class _ChatRoomActionMenu extends HookConsumerWidget {
|
||||
if ((chatIdentity.value?.role ?? 0) >= 50)
|
||||
PopupMenuItem(
|
||||
onTap: () {
|
||||
context.router.replace(EditChatRoute(id: id));
|
||||
context.pushReplacement('/chat/$id/edit');
|
||||
},
|
||||
child: Row(
|
||||
children: [
|
||||
@ -426,9 +424,7 @@ class _ChatRoomActionMenu extends HookConsumerWidget {
|
||||
client.delete('/chat/$id');
|
||||
ref.invalidate(chatroomsJoinedProvider);
|
||||
if (context.mounted) {
|
||||
context.router.popUntil(
|
||||
(route) => route is ChatRoomRoute,
|
||||
);
|
||||
context.pop();
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -461,9 +457,7 @@ class _ChatRoomActionMenu extends HookConsumerWidget {
|
||||
client.delete('/chat/$id/members/me');
|
||||
ref.invalidate(chatroomsJoinedProvider);
|
||||
if (context.mounted) {
|
||||
context.router.popUntil(
|
||||
(route) => route is ChatRoomRoute,
|
||||
);
|
||||
context.pop();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -22,14 +22,11 @@ mixin _$ChatRoomMemberState {
|
||||
@pragma('vm:prefer-inline')
|
||||
$ChatRoomMemberStateCopyWith<ChatRoomMemberState> get copyWith => _$ChatRoomMemberStateCopyWithImpl<ChatRoomMemberState>(this as ChatRoomMemberState, _$identity);
|
||||
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is ChatRoomMemberState&&const DeepCollectionEquality().equals(other.members, members)&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&(identical(other.total, total) || other.total == total)&&(identical(other.error, error) || other.error == error));
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,const DeepCollectionEquality().hash(members),isLoading,total,error);
|
||||
|
||||
@ -38,7 +35,6 @@ String toString() {
|
||||
return 'ChatRoomMemberState(members: $members, isLoading: $isLoading, total: $total, error: $error)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@ -49,9 +45,6 @@ $Res call({
|
||||
List<SnChatMember> members, bool isLoading, int total, String? error
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class _$ChatRoomMemberStateCopyWithImpl<$Res>
|
||||
@ -75,10 +68,8 @@ as String?,
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// @nodoc
|
||||
|
||||
|
||||
class _ChatRoomMemberState implements ChatRoomMemberState {
|
||||
const _ChatRoomMemberState({required final List<SnChatMember> members, required this.isLoading, required this.total, this.error}): _members = members;
|
||||
|
||||
@ -100,14 +91,11 @@ class _ChatRoomMemberState implements ChatRoomMemberState {
|
||||
@pragma('vm:prefer-inline')
|
||||
_$ChatRoomMemberStateCopyWith<_ChatRoomMemberState> get copyWith => __$ChatRoomMemberStateCopyWithImpl<_ChatRoomMemberState>(this, _$identity);
|
||||
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _ChatRoomMemberState&&const DeepCollectionEquality().equals(other._members, _members)&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&(identical(other.total, total) || other.total == total)&&(identical(other.error, error) || other.error == error));
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,const DeepCollectionEquality().hash(_members),isLoading,total,error);
|
||||
|
||||
@ -116,7 +104,6 @@ String toString() {
|
||||
return 'ChatRoomMemberState(members: $members, isLoading: $isLoading, total: $total, error: $error)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@ -127,9 +114,6 @@ $Res call({
|
||||
List<SnChatMember> members, bool isLoading, int total, String? error
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class __$ChatRoomMemberStateCopyWithImpl<$Res>
|
||||
@ -151,7 +135,6 @@ as String?,
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
// dart format on
|
||||
|
@ -1,13 +1,12 @@
|
||||
import 'package:auto_route/auto_route.dart';
|
||||
import 'package:dropdown_button2/dropdown_button2.dart';
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||
import 'package:gap/gap.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
import 'package:island/models/post.dart';
|
||||
import 'package:island/pods/network.dart';
|
||||
import 'package:island/route.gr.dart';
|
||||
import 'package:island/screens/creators/publishers.dart';
|
||||
import 'package:island/services/responsive.dart';
|
||||
import 'package:island/widgets/alert.dart';
|
||||
@ -27,9 +26,9 @@ Future<SnPublisherStats?> publisherStats(Ref ref, String? uname) async {
|
||||
return SnPublisherStats.fromJson(resp.data);
|
||||
}
|
||||
|
||||
@RoutePage()
|
||||
class CreatorHubShellScreen extends StatelessWidget {
|
||||
const CreatorHubShellScreen({super.key});
|
||||
final Widget child;
|
||||
const CreatorHubShellScreen({super.key, required this.child});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -39,15 +38,14 @@ class CreatorHubShellScreen extends StatelessWidget {
|
||||
children: [
|
||||
SizedBox(width: 360, child: const CreatorHubScreen(isAside: true)),
|
||||
const VerticalDivider(width: 1),
|
||||
Expanded(child: AutoRouter()),
|
||||
Expanded(child: child),
|
||||
],
|
||||
);
|
||||
}
|
||||
return AutoRouter();
|
||||
return child;
|
||||
}
|
||||
}
|
||||
|
||||
@RoutePage()
|
||||
class CreatorHubScreen extends HookConsumerWidget {
|
||||
final bool isAside;
|
||||
const CreatorHubScreen({super.key, this.isAside = false});
|
||||
@ -65,8 +63,8 @@ class CreatorHubScreen extends HookConsumerWidget {
|
||||
);
|
||||
|
||||
void updatePublisher() {
|
||||
context.router
|
||||
.push(EditPublisherRoute(name: currentPublisher.value!.name))
|
||||
context
|
||||
.push('/creators/${currentPublisher.value!.name}/edit')
|
||||
.then((value) async {
|
||||
if (value == null) return;
|
||||
final data = await ref.refresh(publishersManagedProvider.future);
|
||||
@ -223,7 +221,7 @@ class CreatorHubScreen extends HookConsumerWidget {
|
||||
subtitle: Text('createPublisherHint').tr(),
|
||||
trailing: const Icon(Symbols.chevron_right),
|
||||
onTap: () {
|
||||
context.router.push(NewPublisherRoute()).then((
|
||||
context.push('/creators/publishers/new').then((
|
||||
value,
|
||||
) {
|
||||
if (value != null) {
|
||||
@ -249,10 +247,8 @@ class CreatorHubScreen extends HookConsumerWidget {
|
||||
horizontal: 24,
|
||||
),
|
||||
onTap: () {
|
||||
context.router.push(
|
||||
StickersRoute(
|
||||
pubName: currentPublisher.value!.name,
|
||||
),
|
||||
context.push(
|
||||
'/creators/${currentPublisher.value!.name}/stickers',
|
||||
);
|
||||
},
|
||||
),
|
||||
@ -265,10 +261,8 @@ class CreatorHubScreen extends HookConsumerWidget {
|
||||
horizontal: 24,
|
||||
),
|
||||
onTap: () {
|
||||
context.router.push(
|
||||
CreatorPostListRoute(
|
||||
pubName: currentPublisher.value!.name,
|
||||
),
|
||||
context.push(
|
||||
'/creators/${currentPublisher.value!.name}/posts',
|
||||
);
|
||||
},
|
||||
),
|
||||
|
@ -1,6 +1,6 @@
|
||||
import 'package:auto_route/auto_route.dart';
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
import 'package:island/widgets/app_scaffold.dart';
|
||||
@ -8,13 +8,9 @@ import 'package:island/widgets/content/sheet.dart';
|
||||
import 'package:island/widgets/post/post_list.dart';
|
||||
import 'package:material_symbols_icons/symbols.dart';
|
||||
|
||||
@RoutePage()
|
||||
class CreatorPostListScreen extends HookConsumerWidget {
|
||||
final String pubName;
|
||||
const CreatorPostListScreen({
|
||||
super.key,
|
||||
@PathParam('name') required this.pubName,
|
||||
});
|
||||
const CreatorPostListScreen({super.key, required this.pubName});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
@ -34,7 +30,7 @@ class CreatorPostListScreen extends HookConsumerWidget {
|
||||
subtitle: Text('Create a regular post'),
|
||||
onTap: () async {
|
||||
Navigator.pop(context);
|
||||
final result = await context.router.pushPath(
|
||||
final result = await context.push(
|
||||
'/posts/compose?type=0',
|
||||
);
|
||||
if (result == true) {
|
||||
@ -48,7 +44,7 @@ class CreatorPostListScreen extends HookConsumerWidget {
|
||||
subtitle: Text('Create a detailed article'),
|
||||
onTap: () async {
|
||||
Navigator.pop(context);
|
||||
final result = await context.router.pushPath(
|
||||
final result = await context.push(
|
||||
'/posts/compose?type=1',
|
||||
);
|
||||
if (result == true) {
|
||||
|
@ -1,10 +1,10 @@
|
||||
import 'package:auto_route/auto_route.dart';
|
||||
import 'package:collection/collection.dart';
|
||||
import 'package:croppy/croppy.dart' hide cropImage;
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
import 'package:image_picker/image_picker.dart';
|
||||
import 'package:island/models/file.dart';
|
||||
@ -44,7 +44,6 @@ Future<SnPublisher?> publisher(Ref ref, String? identifier) async {
|
||||
return SnPublisher.fromJson(resp.data);
|
||||
}
|
||||
|
||||
@RoutePage()
|
||||
class NewPublisherScreen extends StatelessWidget {
|
||||
const NewPublisherScreen({super.key});
|
||||
|
||||
@ -54,10 +53,9 @@ class NewPublisherScreen extends StatelessWidget {
|
||||
}
|
||||
}
|
||||
|
||||
@RoutePage()
|
||||
class EditPublisherScreen extends HookConsumerWidget {
|
||||
final String? name;
|
||||
const EditPublisherScreen({super.key, @PathParam('id') this.name});
|
||||
const EditPublisherScreen({super.key, this.name});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
@ -177,7 +175,7 @@ class EditPublisherScreen extends HookConsumerWidget {
|
||||
options: Options(method: name == null ? 'POST' : 'PATCH'),
|
||||
);
|
||||
if (context.mounted) {
|
||||
context.maybePop(SnPublisher.fromJson(resp.data));
|
||||
context.pop(SnPublisher.fromJson(resp.data));
|
||||
}
|
||||
} catch (err) {
|
||||
showErrorAlert(err);
|
||||
|
@ -1,7 +1,7 @@
|
||||
import 'package:auto_route/auto_route.dart';
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
@ -10,7 +10,6 @@ import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
import 'package:island/models/sticker.dart';
|
||||
import 'package:island/pods/network.dart';
|
||||
import 'package:island/route.gr.dart';
|
||||
import 'package:island/screens/creators/stickers/stickers.dart';
|
||||
import 'package:island/widgets/alert.dart';
|
||||
import 'package:island/widgets/app_scaffold.dart';
|
||||
@ -34,14 +33,13 @@ Future<List<SnSticker>> stickerPackContent(Ref ref, String packId) async {
|
||||
.toList();
|
||||
}
|
||||
|
||||
@RoutePage()
|
||||
class StickerPackDetailScreen extends HookConsumerWidget {
|
||||
final String id;
|
||||
final String pubName;
|
||||
const StickerPackDetailScreen({
|
||||
super.key,
|
||||
@PathParam('name') required this.pubName,
|
||||
@PathParam('packId') required this.id,
|
||||
required this.pubName,
|
||||
required this.id,
|
||||
});
|
||||
|
||||
@override
|
||||
@ -76,7 +74,7 @@ class StickerPackDetailScreen extends HookConsumerWidget {
|
||||
IconButton(
|
||||
icon: const Icon(Symbols.add_circle),
|
||||
onPressed: () {
|
||||
AutoRouter.of(context).push(NewStickersRoute(packId: id)).then((
|
||||
context.push('/creators/stickers/$id/new').then((
|
||||
value,
|
||||
) {
|
||||
if (value != null) {
|
||||
@ -175,12 +173,9 @@ class StickerPackDetailScreen extends HookConsumerWidget {
|
||||
title: 'edit'.tr(),
|
||||
image: MenuImage.icon(Symbols.edit),
|
||||
callback: () {
|
||||
context.router
|
||||
context
|
||||
.push(
|
||||
EditStickersRoute(
|
||||
packId: id,
|
||||
id: sticker.id,
|
||||
),
|
||||
'/creators/stickers/$id/edit/${sticker.id}',
|
||||
)
|
||||
.then((value) {
|
||||
if (value != null) {
|
||||
@ -264,8 +259,8 @@ class _StickerPackActionMenu extends HookConsumerWidget {
|
||||
(context) => [
|
||||
PopupMenuItem(
|
||||
onTap: () {
|
||||
context.router.push(
|
||||
EditStickerPacksRoute(pubName: pubName, packId: packId),
|
||||
context.push(
|
||||
'/creators/$pubName/stickers/$packId/edit',
|
||||
);
|
||||
},
|
||||
child: Row(
|
||||
@ -299,7 +294,7 @@ class _StickerPackActionMenu extends HookConsumerWidget {
|
||||
final client = ref.watch(apiClientProvider);
|
||||
client.delete('/stickers/$packId');
|
||||
ref.invalidate(stickerPacksNotifierProvider);
|
||||
if (context.mounted) context.router.maybePop(true);
|
||||
if (context.mounted) context.pop(true);
|
||||
}
|
||||
});
|
||||
},
|
||||
@ -331,13 +326,9 @@ Future<SnSticker?> stickerPackSticker(
|
||||
return SnSticker.fromJson(resp.data);
|
||||
}
|
||||
|
||||
@RoutePage()
|
||||
class NewStickersScreen extends StatelessWidget {
|
||||
final String packId;
|
||||
const NewStickersScreen({
|
||||
super.key,
|
||||
@PathParam('packId') required this.packId,
|
||||
});
|
||||
const NewStickersScreen({super.key, required this.packId});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -345,15 +336,10 @@ class NewStickersScreen extends StatelessWidget {
|
||||
}
|
||||
}
|
||||
|
||||
@RoutePage()
|
||||
class EditStickersScreen extends HookConsumerWidget {
|
||||
final String packId;
|
||||
final String? id;
|
||||
const EditStickersScreen({
|
||||
super.key,
|
||||
@PathParam("packId") required this.packId,
|
||||
@PathParam("id") required this.id,
|
||||
});
|
||||
const EditStickersScreen({super.key, required this.packId, required this.id});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
|
@ -22,14 +22,11 @@ mixin _$StickerWithPackQuery {
|
||||
@pragma('vm:prefer-inline')
|
||||
$StickerWithPackQueryCopyWith<StickerWithPackQuery> get copyWith => _$StickerWithPackQueryCopyWithImpl<StickerWithPackQuery>(this as StickerWithPackQuery, _$identity);
|
||||
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is StickerWithPackQuery&&(identical(other.packId, packId) || other.packId == packId)&&(identical(other.id, id) || other.id == id));
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,packId,id);
|
||||
|
||||
@ -38,7 +35,6 @@ String toString() {
|
||||
return 'StickerWithPackQuery(packId: $packId, id: $id)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@ -49,9 +45,6 @@ $Res call({
|
||||
String packId, String id
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class _$StickerWithPackQueryCopyWithImpl<$Res>
|
||||
@ -73,10 +66,8 @@ as String,
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// @nodoc
|
||||
|
||||
|
||||
class _StickerWithPackQuery implements StickerWithPackQuery {
|
||||
const _StickerWithPackQuery({required this.packId, required this.id});
|
||||
|
||||
@ -90,14 +81,11 @@ class _StickerWithPackQuery implements StickerWithPackQuery {
|
||||
@pragma('vm:prefer-inline')
|
||||
_$StickerWithPackQueryCopyWith<_StickerWithPackQuery> get copyWith => __$StickerWithPackQueryCopyWithImpl<_StickerWithPackQuery>(this, _$identity);
|
||||
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _StickerWithPackQuery&&(identical(other.packId, packId) || other.packId == packId)&&(identical(other.id, id) || other.id == id));
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,packId,id);
|
||||
|
||||
@ -106,7 +94,6 @@ String toString() {
|
||||
return 'StickerWithPackQuery(packId: $packId, id: $id)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@ -117,9 +104,6 @@ $Res call({
|
||||
String packId, String id
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class __$StickerWithPackQueryCopyWithImpl<$Res>
|
||||
@ -139,7 +123,6 @@ as String,
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
// dart format on
|
||||
|
@ -1,13 +1,12 @@
|
||||
import 'package:auto_route/auto_route.dart';
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||
import 'package:gap/gap.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
import 'package:island/models/sticker.dart';
|
||||
import 'package:island/pods/network.dart';
|
||||
import 'package:island/route.gr.dart';
|
||||
import 'package:island/widgets/alert.dart';
|
||||
import 'package:island/widgets/app_scaffold.dart';
|
||||
import 'package:material_symbols_icons/symbols.dart';
|
||||
@ -17,10 +16,9 @@ import 'package:riverpod_paging_utils/riverpod_paging_utils.dart';
|
||||
|
||||
part 'stickers.g.dart';
|
||||
|
||||
@RoutePage()
|
||||
class StickersScreen extends HookConsumerWidget {
|
||||
final String pubName;
|
||||
const StickersScreen({super.key, @PathParam("name") required this.pubName});
|
||||
const StickersScreen({super.key, required this.pubName});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
@ -30,7 +28,7 @@ class StickersScreen extends HookConsumerWidget {
|
||||
actions: [
|
||||
IconButton(
|
||||
onPressed: () {
|
||||
context.router.push(NewStickerPacksRoute(pubName: pubName)).then((
|
||||
context.push('/creators/stickers/new?pubName=pubName').then((
|
||||
value,
|
||||
) {
|
||||
if (value != null) {
|
||||
@ -73,8 +71,8 @@ class SliverStickerPacksList extends HookConsumerWidget {
|
||||
subtitle: Text(sticker.description),
|
||||
trailing: const Icon(Symbols.chevron_right),
|
||||
onTap: () {
|
||||
context.router.push(
|
||||
StickerPackDetailRoute(pubName: pubName, id: sticker.id),
|
||||
context.push(
|
||||
'/creators/$pubName/stickers/${sticker.id}',
|
||||
);
|
||||
},
|
||||
);
|
||||
@ -137,13 +135,9 @@ Future<SnStickerPack?> stickerPack(Ref ref, String? packId) async {
|
||||
return SnStickerPack.fromJson(resp.data);
|
||||
}
|
||||
|
||||
@RoutePage()
|
||||
class NewStickerPacksScreen extends HookConsumerWidget {
|
||||
final String pubName;
|
||||
const NewStickerPacksScreen({
|
||||
super.key,
|
||||
@PathParam("name") required this.pubName,
|
||||
});
|
||||
const NewStickerPacksScreen({super.key, required this.pubName});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
@ -151,15 +145,10 @@ class NewStickerPacksScreen extends HookConsumerWidget {
|
||||
}
|
||||
}
|
||||
|
||||
@RoutePage()
|
||||
class EditStickerPacksScreen extends HookConsumerWidget {
|
||||
final String pubName;
|
||||
final String? packId;
|
||||
const EditStickerPacksScreen({
|
||||
super.key,
|
||||
@PathParam("name") required this.pubName,
|
||||
@PathParam("packId") this.packId,
|
||||
});
|
||||
const EditStickerPacksScreen({super.key, required this.pubName, this.packId});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
@ -200,7 +189,7 @@ class EditStickerPacksScreen extends HookConsumerWidget {
|
||||
),
|
||||
);
|
||||
if (!context.mounted) return;
|
||||
context.router.maybePop(SnStickerPack.fromJson(resp.data));
|
||||
context.pop(SnStickerPack.fromJson(resp.data));
|
||||
} catch (err) {
|
||||
showErrorAlert(err);
|
||||
} finally {
|
||||
|
@ -1,12 +1,11 @@
|
||||
import 'package:auto_route/auto_route.dart';
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||
import 'package:gap/gap.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
import 'package:island/models/activity.dart';
|
||||
import 'package:island/pods/userinfo.dart';
|
||||
import 'package:island/route.gr.dart';
|
||||
import 'package:island/services/responsive.dart';
|
||||
import 'package:island/widgets/app_scaffold.dart';
|
||||
import 'package:island/models/post.dart';
|
||||
@ -22,13 +21,13 @@ import 'package:styled_widget/styled_widget.dart';
|
||||
|
||||
part 'explore.g.dart';
|
||||
|
||||
@RoutePage()
|
||||
class ExploreShellScreen extends ConsumerWidget {
|
||||
const ExploreShellScreen({super.key});
|
||||
class ExploreShellScreen extends HookConsumerWidget {
|
||||
final Widget child;
|
||||
const ExploreShellScreen({super.key, required this.child});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final isWide = isWideScreen(context);
|
||||
final isWide = MediaQuery.of(context).size.width > 640;
|
||||
|
||||
if (isWide) {
|
||||
return AppBackground(
|
||||
@ -37,17 +36,16 @@ class ExploreShellScreen extends ConsumerWidget {
|
||||
children: [
|
||||
Flexible(flex: 2, child: ExploreScreen(isAside: true)),
|
||||
VerticalDivider(width: 1),
|
||||
Flexible(flex: 3, child: AutoRouter()),
|
||||
Flexible(flex: 3, child: child),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
return AppBackground(isRoot: true, child: AutoRouter());
|
||||
return AppBackground(isRoot: true, child: child);
|
||||
}
|
||||
}
|
||||
|
||||
@RoutePage()
|
||||
class ExploreScreen extends HookConsumerWidget {
|
||||
final bool isAside;
|
||||
const ExploreScreen({super.key, this.isAside = false});
|
||||
@ -126,7 +124,7 @@ class ExploreScreen extends HookConsumerWidget {
|
||||
floatingActionButton: FloatingActionButton(
|
||||
heroTag: Key("explore-page-fab"),
|
||||
onPressed: () {
|
||||
context.router.push(PostComposeRoute()).then((value) {
|
||||
context.push('/posts/compose').then((value) {
|
||||
if (value != null) {
|
||||
activitiesNotifier.forceRefresh();
|
||||
}
|
||||
|
@ -1,9 +1,9 @@
|
||||
import 'dart:async';
|
||||
import 'dart:math' as math;
|
||||
|
||||
import 'package:auto_route/auto_route.dart';
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
import 'package:island/models/user.dart';
|
||||
@ -107,7 +107,6 @@ class NotificationListNotifier extends _$NotificationListNotifier
|
||||
}
|
||||
}
|
||||
|
||||
@RoutePage()
|
||||
class NotificationScreen extends HookConsumerWidget {
|
||||
const NotificationScreen({super.key});
|
||||
|
||||
@ -198,7 +197,7 @@ class NotificationScreen extends HookConsumerWidget {
|
||||
return;
|
||||
}
|
||||
if (uri.scheme == 'solian') {
|
||||
context.router.pushPath(
|
||||
context.push(
|
||||
['', uri.host, ...uri.pathSegments].join('/'),
|
||||
);
|
||||
return;
|
||||
|
@ -1,4 +1,3 @@
|
||||
import 'package:auto_route/auto_route.dart';
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||
@ -40,10 +39,9 @@ sealed class PostComposeInitialState with _$PostComposeInitialState {
|
||||
_$PostComposeInitialStateFromJson(json);
|
||||
}
|
||||
|
||||
@RoutePage()
|
||||
class PostEditScreen extends HookConsumerWidget {
|
||||
final String id;
|
||||
const PostEditScreen({super.key, @PathParam('id') required this.id});
|
||||
const PostEditScreen({super.key, required this.id});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
@ -66,7 +64,6 @@ class PostEditScreen extends HookConsumerWidget {
|
||||
}
|
||||
}
|
||||
|
||||
@RoutePage()
|
||||
class PostComposeScreen extends HookConsumerWidget {
|
||||
final SnPost? originalPost;
|
||||
final SnPost? repliedPost;
|
||||
@ -78,7 +75,7 @@ class PostComposeScreen extends HookConsumerWidget {
|
||||
this.originalPost,
|
||||
this.repliedPost,
|
||||
this.forwardedPost,
|
||||
@QueryParam('type') this.type,
|
||||
this.type,
|
||||
this.initialState,
|
||||
});
|
||||
|
||||
|
@ -26,7 +26,6 @@ $PostComposeInitialStateCopyWith<PostComposeInitialState> get copyWith => _$Post
|
||||
/// Serializes this PostComposeInitialState to a JSON map.
|
||||
Map<String, dynamic> toJson();
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is PostComposeInitialState&&(identical(other.title, title) || other.title == title)&&(identical(other.description, description) || other.description == description)&&(identical(other.content, content) || other.content == content)&&const DeepCollectionEquality().equals(other.attachments, attachments)&&(identical(other.visibility, visibility) || other.visibility == visibility));
|
||||
@ -41,7 +40,6 @@ String toString() {
|
||||
return 'PostComposeInitialState(title: $title, description: $description, content: $content, attachments: $attachments, visibility: $visibility)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@ -52,9 +50,6 @@ $Res call({
|
||||
String? title, String? description, String? content, List<UniversalFile> attachments, int? visibility
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class _$PostComposeInitialStateCopyWithImpl<$Res>
|
||||
@ -79,7 +74,6 @@ as int?,
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
|
||||
@ -124,7 +118,6 @@ String toString() {
|
||||
return 'PostComposeInitialState(title: $title, description: $description, content: $content, attachments: $attachments, visibility: $visibility)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@ -135,9 +128,6 @@ $Res call({
|
||||
String? title, String? description, String? content, List<UniversalFile> attachments, int? visibility
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class __$PostComposeInitialStateCopyWithImpl<$Res>
|
||||
@ -160,7 +150,6 @@ as int?,
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
// dart format on
|
||||
|
@ -1,6 +1,5 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:auto_route/auto_route.dart';
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
@ -26,10 +25,9 @@ import 'package:island/widgets/post/draft_manager.dart';
|
||||
import 'package:material_symbols_icons/symbols.dart';
|
||||
import 'package:styled_widget/styled_widget.dart';
|
||||
|
||||
@RoutePage()
|
||||
class ArticleEditScreen extends HookConsumerWidget {
|
||||
final String id;
|
||||
const ArticleEditScreen({super.key, @PathParam('id') required this.id});
|
||||
const ArticleEditScreen({super.key, required this.id});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
@ -50,7 +48,6 @@ class ArticleEditScreen extends HookConsumerWidget {
|
||||
}
|
||||
}
|
||||
|
||||
@RoutePage()
|
||||
class ArticleComposeScreen extends HookConsumerWidget {
|
||||
final SnPost? originalPost;
|
||||
|
||||
|
@ -1,4 +1,3 @@
|
||||
import 'package:auto_route/auto_route.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:gap/gap.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
@ -22,10 +21,9 @@ Future<SnPost?> post(Ref ref, String id) async {
|
||||
return SnPost.fromJson(resp.data);
|
||||
}
|
||||
|
||||
@RoutePage()
|
||||
class PostDetailScreen extends HookConsumerWidget {
|
||||
final String id;
|
||||
const PostDetailScreen({super.key, @PathParam('id') required this.id});
|
||||
const PostDetailScreen({super.key, required this.id});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
|
@ -1,6 +1,6 @@
|
||||
import 'package:auto_route/auto_route.dart';
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||
import 'package:gap/gap.dart';
|
||||
@ -67,12 +67,11 @@ Future<Color?> publisherAppbarForcegroundColor(Ref ref, String pubName) async {
|
||||
return dominantColor.computeLuminance() > 0.5 ? Colors.black : Colors.white;
|
||||
}
|
||||
|
||||
@RoutePage()
|
||||
class PublisherProfileScreen extends HookConsumerWidget {
|
||||
final String name;
|
||||
const PublisherProfileScreen({
|
||||
super.key,
|
||||
@PathParam("name") required this.name,
|
||||
required this.name,
|
||||
});
|
||||
|
||||
@override
|
||||
@ -186,7 +185,7 @@ class PublisherProfileScreen extends HookConsumerWidget {
|
||||
),
|
||||
onTap: () {
|
||||
Navigator.pop(context, true);
|
||||
context.router.pushPath('/account/${data.name}');
|
||||
context.push('/account/${data.name}');
|
||||
},
|
||||
),
|
||||
Expanded(
|
||||
|
@ -1,13 +1,12 @@
|
||||
import 'package:auto_route/auto_route.dart';
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||
import 'package:gap/gap.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
import 'package:island/models/realm.dart';
|
||||
import 'package:island/pods/network.dart';
|
||||
import 'package:island/route.gr.dart';
|
||||
import 'package:island/screens/realm/realms.dart';
|
||||
import 'package:island/widgets/account/account_picker.dart';
|
||||
import 'package:island/widgets/alert.dart';
|
||||
@ -27,10 +26,10 @@ Future<SnRealmMember?> realmIdentity(Ref ref, String realmSlug) async {
|
||||
return SnRealmMember.fromJson(response.data);
|
||||
}
|
||||
|
||||
@RoutePage()
|
||||
class RealmDetailScreen extends HookConsumerWidget {
|
||||
final String slug;
|
||||
const RealmDetailScreen({super.key, @PathParam("slug") required this.slug});
|
||||
|
||||
const RealmDetailScreen({super.key, required this.slug});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
@ -129,7 +128,7 @@ class _RealmActionMenu extends HookConsumerWidget {
|
||||
if (isModerator)
|
||||
PopupMenuItem(
|
||||
onTap: () {
|
||||
context.router.replace(EditRealmRoute(slug: realmSlug));
|
||||
context.pushReplacement('/realms/$realmSlug/edit');
|
||||
},
|
||||
child: Row(
|
||||
children: [
|
||||
@ -167,7 +166,7 @@ class _RealmActionMenu extends HookConsumerWidget {
|
||||
client.delete('/realms/$realmSlug');
|
||||
ref.invalidate(realmsJoinedProvider);
|
||||
if (context.mounted) {
|
||||
context.router.maybePop(true);
|
||||
context.pop(true);
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -201,7 +200,7 @@ class _RealmActionMenu extends HookConsumerWidget {
|
||||
);
|
||||
ref.invalidate(realmsJoinedProvider);
|
||||
if (context.mounted) {
|
||||
context.router.maybePop(true);
|
||||
context.pop(true);
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -239,7 +238,7 @@ class _RealmActionMenu extends HookConsumerWidget {
|
||||
client.delete('/realms/$realmSlug/members/me');
|
||||
ref.invalidate(realmsJoinedProvider);
|
||||
if (context.mounted) {
|
||||
context.router.maybePop(true);
|
||||
context.pop(true);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -1,8 +1,8 @@
|
||||
import 'package:auto_route/auto_route.dart';
|
||||
import 'package:croppy/croppy.dart' show CropAspectRatio;
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||
import 'package:gap/gap.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
@ -11,7 +11,6 @@ import 'package:island/models/file.dart';
|
||||
import 'package:island/models/realm.dart';
|
||||
import 'package:island/pods/config.dart';
|
||||
import 'package:island/pods/network.dart';
|
||||
import 'package:island/route.gr.dart';
|
||||
import 'package:island/services/file.dart';
|
||||
import 'package:island/services/responsive.dart';
|
||||
import 'package:island/widgets/alert.dart';
|
||||
@ -33,7 +32,6 @@ Future<List<SnRealm>> realmsJoined(Ref ref) async {
|
||||
return resp.data.map((e) => SnRealm.fromJson(e)).cast<SnRealm>().toList();
|
||||
}
|
||||
|
||||
@RoutePage()
|
||||
class RealmListScreen extends HookConsumerWidget {
|
||||
const RealmListScreen({super.key});
|
||||
|
||||
@ -79,7 +77,7 @@ class RealmListScreen extends HookConsumerWidget {
|
||||
heroTag: Key("realms-page-fab"),
|
||||
child: const Icon(Symbols.add),
|
||||
onPressed: () {
|
||||
context.router.push(NewRealmRoute()).then((value) {
|
||||
context.push('/realms/new').then((value) {
|
||||
if (value != null) {
|
||||
ref.invalidate(realmsJoinedProvider);
|
||||
}
|
||||
@ -106,9 +104,7 @@ class RealmListScreen extends HookConsumerWidget {
|
||||
title: Text(value[item].name),
|
||||
subtitle: Text(value[item].description),
|
||||
onTap: () {
|
||||
context.router.push(
|
||||
RealmDetailRoute(slug: value[item].slug),
|
||||
);
|
||||
context.push('/realms/${value[item].slug}');
|
||||
},
|
||||
contentPadding: EdgeInsets.only(
|
||||
left: 16,
|
||||
@ -143,7 +139,6 @@ Future<SnRealm?> realm(Ref ref, String? identifier) async {
|
||||
return SnRealm.fromJson(resp.data);
|
||||
}
|
||||
|
||||
@RoutePage()
|
||||
class NewRealmScreen extends StatelessWidget {
|
||||
const NewRealmScreen({super.key});
|
||||
|
||||
@ -153,10 +148,9 @@ class NewRealmScreen extends StatelessWidget {
|
||||
}
|
||||
}
|
||||
|
||||
@RoutePage()
|
||||
class EditRealmScreen extends HookConsumerWidget {
|
||||
final String? slug;
|
||||
const EditRealmScreen({super.key, @PathParam('slug') this.slug});
|
||||
const EditRealmScreen({super.key, this.slug});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
@ -262,7 +256,7 @@ class EditRealmScreen extends HookConsumerWidget {
|
||||
options: Options(method: slug == null ? 'POST' : 'PATCH'),
|
||||
);
|
||||
if (context.mounted) {
|
||||
context.maybePop(SnRealm.fromJson(resp.data));
|
||||
context.pop(SnRealm.fromJson(resp.data));
|
||||
}
|
||||
} catch (err) {
|
||||
showErrorAlert(err);
|
||||
|
@ -1,11 +1,11 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:auto_route/auto_route.dart';
|
||||
import 'package:collection/collection.dart';
|
||||
import 'package:dropdown_button2/dropdown_button2.dart';
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_colorpicker/flutter_colorpicker.dart';
|
||||
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||
@ -21,7 +21,6 @@ import 'package:path_provider/path_provider.dart';
|
||||
import 'package:styled_widget/styled_widget.dart';
|
||||
import 'package:island/pods/config.dart';
|
||||
|
||||
@RoutePage()
|
||||
class SettingsScreen extends HookConsumerWidget {
|
||||
const SettingsScreen({super.key});
|
||||
|
||||
@ -590,7 +589,7 @@ class SettingsScreen extends HookConsumerWidget {
|
||||
if (isDesktop &&
|
||||
event is KeyDownEvent &&
|
||||
event.logicalKey == LogicalKeyboardKey.escape) {
|
||||
context.router.pop();
|
||||
context.pop();
|
||||
return KeyEventResult.handled;
|
||||
}
|
||||
return KeyEventResult.ignored;
|
||||
|
@ -1,10 +1,9 @@
|
||||
import 'dart:developer';
|
||||
import 'dart:ui';
|
||||
import 'package:auto_route/auto_route.dart';
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
import 'package:island/route.gr.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:island/screens/notification.dart';
|
||||
import 'package:island/services/responsive.dart';
|
||||
import 'package:island/widgets/navigation/conditional_bottom_nav.dart';
|
||||
@ -12,42 +11,22 @@ import 'package:material_symbols_icons/symbols.dart';
|
||||
|
||||
final currentRouteProvider = StateProvider<String?>((ref) => null);
|
||||
|
||||
class TabNavigationObserver extends AutoRouterObserver {
|
||||
Function(String?) onChange;
|
||||
TabNavigationObserver({required this.onChange});
|
||||
|
||||
@override
|
||||
void didPush(Route route, Route? previousRoute) {
|
||||
log('pushed ${previousRoute?.settings.name} -> ${route.settings.name}');
|
||||
if (route is DialogRoute) return;
|
||||
final name = route.settings.name;
|
||||
if (name == null) return;
|
||||
if (name.contains('Shell')) return;
|
||||
Future(() {
|
||||
onChange(name);
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
void didPop(Route route, Route? previousRoute) {
|
||||
log('popped ${route.settings.name} -> ${previousRoute?.settings.name}');
|
||||
if (previousRoute is DialogRoute) return;
|
||||
final name = previousRoute?.settings.name;
|
||||
if (name == null) return;
|
||||
if (name.contains('Shell')) return;
|
||||
Future(() {
|
||||
onChange(name);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@RoutePage()
|
||||
class TabsScreen extends HookConsumerWidget {
|
||||
const TabsScreen({super.key});
|
||||
final Widget? child;
|
||||
const TabsScreen({super.key, this.child});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final useHorizontalLayout = isWideScreen(context);
|
||||
// final useHorizontalLayout = isWideScreen(context);
|
||||
final currentLocation = GoRouterState.of(context).uri.toString();
|
||||
|
||||
// Update the current route provider whenever the location changes
|
||||
useEffect(() {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
ref.read(currentRouteProvider.notifier).state = currentLocation;
|
||||
});
|
||||
return null;
|
||||
}, [currentLocation]);
|
||||
|
||||
final notificationUnreadCount = ref.watch(
|
||||
notificationUnreadCountNotifierProvider,
|
||||
@ -73,85 +52,89 @@ class TabsScreen extends HookConsumerWidget {
|
||||
),
|
||||
];
|
||||
|
||||
final routes = <PageRouteInfo>[
|
||||
ExploreShellRoute(),
|
||||
ChatShellRoute(),
|
||||
RealmListRoute(),
|
||||
AccountShellRoute(),
|
||||
final routes = [
|
||||
'/',
|
||||
'/chat',
|
||||
'/realms',
|
||||
'/account',
|
||||
];
|
||||
|
||||
return AutoTabsRouter.tabBar(
|
||||
routes: routes,
|
||||
scrollDirection: useHorizontalLayout ? Axis.vertical : Axis.horizontal,
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
builder: (context, child, _) {
|
||||
final tabsRouter = AutoTabsRouter.of(context);
|
||||
int getCurrentIndex() {
|
||||
if (currentLocation.startsWith('/chat')) return 1;
|
||||
if (currentLocation.startsWith('/realms')) return 2;
|
||||
if (currentLocation.startsWith('/account')) return 3;
|
||||
return 0; // Default to explore
|
||||
}
|
||||
|
||||
if (isWideScreen(context)) {
|
||||
return Row(
|
||||
children: [
|
||||
NavigationRail(
|
||||
destinations:
|
||||
destinations
|
||||
.map(
|
||||
(e) => NavigationRailDestination(
|
||||
icon: e.icon,
|
||||
label: Text(e.label),
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
selectedIndex: tabsRouter.activeIndex,
|
||||
onDestinationSelected: tabsRouter.setActiveIndex,
|
||||
),
|
||||
const VerticalDivider(width: 1),
|
||||
Expanded(child: child),
|
||||
],
|
||||
);
|
||||
}
|
||||
void onDestinationSelected(int index) {
|
||||
context.go(routes[index]);
|
||||
}
|
||||
|
||||
return Stack(
|
||||
children: [
|
||||
Positioned.fill(child: child),
|
||||
Positioned(
|
||||
left: 0,
|
||||
right: 0,
|
||||
bottom: 0,
|
||||
child: ConditionalBottomNav(
|
||||
child: ClipRRect(
|
||||
child: BackdropFilter(
|
||||
filter: ImageFilter.blur(sigmaX: 10, sigmaY: 10),
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(
|
||||
context,
|
||||
).colorScheme.surface.withOpacity(0.8),
|
||||
final currentIndex = getCurrentIndex();
|
||||
|
||||
if (isWideScreen(context)) {
|
||||
return Row(
|
||||
children: [
|
||||
NavigationRail(
|
||||
destinations:
|
||||
destinations
|
||||
.map(
|
||||
(e) => NavigationRailDestination(
|
||||
icon: e.icon,
|
||||
label: Text(e.label),
|
||||
),
|
||||
child: MediaQuery.removePadding(
|
||||
context: context,
|
||||
removeTop: true,
|
||||
child: NavigationBar(
|
||||
backgroundColor: Colors.transparent,
|
||||
shadowColor: Colors.transparent,
|
||||
overlayColor: const WidgetStatePropertyAll(
|
||||
Colors.transparent,
|
||||
),
|
||||
surfaceTintColor: Colors.transparent,
|
||||
height: 56,
|
||||
labelBehavior:
|
||||
NavigationDestinationLabelBehavior.alwaysHide,
|
||||
selectedIndex: tabsRouter.activeIndex,
|
||||
onDestinationSelected: tabsRouter.setActiveIndex,
|
||||
destinations: destinations,
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
selectedIndex: currentIndex,
|
||||
onDestinationSelected: onDestinationSelected,
|
||||
),
|
||||
const VerticalDivider(width: 1),
|
||||
Expanded(child: child ?? const SizedBox.shrink()),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
return Stack(
|
||||
children: [
|
||||
Positioned.fill(child: child ?? const SizedBox.shrink()),
|
||||
Positioned(
|
||||
left: 0,
|
||||
right: 0,
|
||||
bottom: 0,
|
||||
child: ConditionalBottomNav(
|
||||
child: ClipRRect(
|
||||
child: BackdropFilter(
|
||||
filter: ImageFilter.blur(sigmaX: 10, sigmaY: 10),
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(
|
||||
context,
|
||||
).colorScheme.surface.withOpacity(0.8),
|
||||
),
|
||||
child: MediaQuery.removePadding(
|
||||
context: context,
|
||||
removeTop: true,
|
||||
child: NavigationBar(
|
||||
backgroundColor: Colors.transparent,
|
||||
shadowColor: Colors.transparent,
|
||||
overlayColor: const WidgetStatePropertyAll(
|
||||
Colors.transparent,
|
||||
),
|
||||
surfaceTintColor: Colors.transparent,
|
||||
height: 56,
|
||||
labelBehavior:
|
||||
NavigationDestinationLabelBehavior.alwaysHide,
|
||||
selectedIndex: currentIndex,
|
||||
onDestinationSelected: onDestinationSelected,
|
||||
destinations: destinations,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,3 @@
|
||||
import 'package:auto_route/annotations.dart';
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
@ -72,7 +71,6 @@ class TransactionListNotifier extends _$TransactionListNotifier
|
||||
}
|
||||
}
|
||||
|
||||
@RoutePage()
|
||||
class WalletScreen extends HookConsumerWidget {
|
||||
const WalletScreen({super.key});
|
||||
|
||||
|
Reference in New Issue
Block a user