diff --git a/lib/route.dart b/lib/route.dart index 25cbe08..472c03a 100644 --- a/lib/route.dart +++ b/lib/route.dart @@ -51,6 +51,7 @@ class AppRouter extends RootStackRouter { path: '/creators', children: [ AutoRoute(page: CreatorHubRoute.page, path: ''), + AutoRoute(page: CreatorPostListRoute.page, path: ':name/posts'), AutoRoute(page: StickersRoute.page, path: ':name/stickers'), AutoRoute(page: NewStickerPacksRoute.page, path: ':name/stickers/new'), AutoRoute( diff --git a/lib/route.gr.dart b/lib/route.gr.dart index 6d630be..e3c67c5 100644 --- a/lib/route.gr.dart +++ b/lib/route.gr.dart @@ -9,45 +9,46 @@ // coverage:ignore-file // ignore_for_file: no_leading_underscores_for_library_prefixes -import 'package:auto_route/auto_route.dart' as _i27; -import 'package:flutter/foundation.dart' as _i29; -import 'package:flutter/material.dart' as _i28; -import 'package:island/models/post.dart' as _i30; -import 'package:island/route.dart' as _i31; +import 'package:auto_route/auto_route.dart' as _i28; +import 'package:flutter/foundation.dart' as _i30; +import 'package:flutter/material.dart' as _i29; +import 'package:island/models/post.dart' as _i31; +import 'package:island/route.dart' as _i32; import 'package:island/screens/account.dart' as _i2; -import 'package:island/screens/account/event_calendar.dart' as _i14; +import 'package:island/screens/account/event_calendar.dart' as _i15; import 'package:island/screens/account/me/settings.dart' as _i3; -import 'package:island/screens/account/me/update.dart' as _i25; +import 'package:island/screens/account/me/update.dart' as _i26; import 'package:island/screens/account/profile.dart' as _i1; -import 'package:island/screens/account/relationship.dart' as _i22; +import 'package:island/screens/account/relationship.dart' as _i23; import 'package:island/screens/auth/create_account.dart' as _i8; -import 'package:island/screens/auth/login.dart' as _i16; -import 'package:island/screens/auth/tabs.dart' as _i24; +import 'package:island/screens/auth/login.dart' as _i17; +import 'package:island/screens/auth/tabs.dart' as _i25; import 'package:island/screens/chat/call.dart' as _i4; import 'package:island/screens/chat/chat.dart' as _i6; import 'package:island/screens/chat/room.dart' as _i7; import 'package:island/screens/chat/room_detail.dart' as _i5; import 'package:island/screens/creators/hub.dart' as _i9; -import 'package:island/screens/creators/publishers.dart' as _i10; -import 'package:island/screens/creators/stickers/pack_detail.dart' as _i13; -import 'package:island/screens/creators/stickers/stickers.dart' as _i12; -import 'package:island/screens/explore.dart' as _i15; -import 'package:island/screens/notification.dart' as _i17; -import 'package:island/screens/posts/compose.dart' as _i18; -import 'package:island/screens/posts/detail.dart' as _i19; -import 'package:island/screens/posts/pub_profile.dart' as _i20; -import 'package:island/screens/realm/detail.dart' as _i21; -import 'package:island/screens/realm/realms.dart' as _i11; -import 'package:island/screens/settings.dart' as _i23; -import 'package:island/screens/wallet.dart' as _i26; +import 'package:island/screens/creators/posts/list.dart' as _i10; +import 'package:island/screens/creators/publishers.dart' as _i11; +import 'package:island/screens/creators/stickers/pack_detail.dart' as _i14; +import 'package:island/screens/creators/stickers/stickers.dart' as _i13; +import 'package:island/screens/explore.dart' as _i16; +import 'package:island/screens/notification.dart' as _i18; +import 'package:island/screens/posts/compose.dart' as _i19; +import 'package:island/screens/posts/detail.dart' as _i20; +import 'package:island/screens/posts/pub_profile.dart' as _i21; +import 'package:island/screens/realm/detail.dart' as _i22; +import 'package:island/screens/realm/realms.dart' as _i12; +import 'package:island/screens/settings.dart' as _i24; +import 'package:island/screens/wallet.dart' as _i27; /// generated route for /// [_i1.AccountProfileScreen] -class AccountProfileRoute extends _i27.PageRouteInfo { +class AccountProfileRoute extends _i28.PageRouteInfo { AccountProfileRoute({ - _i28.Key? key, + _i29.Key? key, required String name, - List<_i27.PageRouteInfo>? children, + List<_i28.PageRouteInfo>? children, }) : super( AccountProfileRoute.name, args: AccountProfileRouteArgs(key: key, name: name), @@ -57,7 +58,7 @@ class AccountProfileRoute extends _i27.PageRouteInfo { static const String name = 'AccountProfileRoute'; - static _i27.PageInfo page = _i27.PageInfo( + static _i28.PageInfo page = _i28.PageInfo( name, builder: (data) { final pathParams = data.inheritedPathParams; @@ -73,7 +74,7 @@ class AccountProfileRoute extends _i27.PageRouteInfo { class AccountProfileRouteArgs { const AccountProfileRouteArgs({this.key, required this.name}); - final _i28.Key? key; + final _i29.Key? key; final String name; @@ -95,11 +96,11 @@ class AccountProfileRouteArgs { /// generated route for /// [_i2.AccountScreen] -class AccountRoute extends _i27.PageRouteInfo { +class AccountRoute extends _i28.PageRouteInfo { AccountRoute({ - _i29.Key? key, + _i30.Key? key, bool isAside = false, - List<_i27.PageRouteInfo>? children, + List<_i28.PageRouteInfo>? children, }) : super( AccountRoute.name, args: AccountRouteArgs(key: key, isAside: isAside), @@ -108,7 +109,7 @@ class AccountRoute extends _i27.PageRouteInfo { static const String name = 'AccountRoute'; - static _i27.PageInfo page = _i27.PageInfo( + static _i28.PageInfo page = _i28.PageInfo( name, builder: (data) { final args = data.argsAs( @@ -122,7 +123,7 @@ class AccountRoute extends _i27.PageRouteInfo { class AccountRouteArgs { const AccountRouteArgs({this.key, this.isAside = false}); - final _i29.Key? key; + final _i30.Key? key; final bool isAside; @@ -144,13 +145,13 @@ class AccountRouteArgs { /// generated route for /// [_i3.AccountSettingsScreen] -class AccountSettingsRoute extends _i27.PageRouteInfo { - const AccountSettingsRoute({List<_i27.PageRouteInfo>? children}) +class AccountSettingsRoute extends _i28.PageRouteInfo { + const AccountSettingsRoute({List<_i28.PageRouteInfo>? children}) : super(AccountSettingsRoute.name, initialChildren: children); static const String name = 'AccountSettingsRoute'; - static _i27.PageInfo page = _i27.PageInfo( + static _i28.PageInfo page = _i28.PageInfo( name, builder: (data) { return const _i3.AccountSettingsScreen(); @@ -160,13 +161,13 @@ class AccountSettingsRoute extends _i27.PageRouteInfo { /// generated route for /// [_i2.AccountShellScreen] -class AccountShellRoute extends _i27.PageRouteInfo { - const AccountShellRoute({List<_i27.PageRouteInfo>? children}) +class AccountShellRoute extends _i28.PageRouteInfo { + const AccountShellRoute({List<_i28.PageRouteInfo>? children}) : super(AccountShellRoute.name, initialChildren: children); static const String name = 'AccountShellRoute'; - static _i27.PageInfo page = _i27.PageInfo( + static _i28.PageInfo page = _i28.PageInfo( name, builder: (data) { return const _i2.AccountShellScreen(); @@ -176,11 +177,11 @@ class AccountShellRoute extends _i27.PageRouteInfo { /// generated route for /// [_i4.CallScreen] -class CallRoute extends _i27.PageRouteInfo { +class CallRoute extends _i28.PageRouteInfo { CallRoute({ - _i28.Key? key, + _i29.Key? key, required String roomId, - List<_i27.PageRouteInfo>? children, + List<_i28.PageRouteInfo>? children, }) : super( CallRoute.name, args: CallRouteArgs(key: key, roomId: roomId), @@ -190,7 +191,7 @@ class CallRoute extends _i27.PageRouteInfo { static const String name = 'CallRoute'; - static _i27.PageInfo page = _i27.PageInfo( + static _i28.PageInfo page = _i28.PageInfo( name, builder: (data) { final pathParams = data.inheritedPathParams; @@ -205,7 +206,7 @@ class CallRoute extends _i27.PageRouteInfo { class CallRouteArgs { const CallRouteArgs({this.key, required this.roomId}); - final _i28.Key? key; + final _i29.Key? key; final String roomId; @@ -227,11 +228,11 @@ class CallRouteArgs { /// generated route for /// [_i5.ChatDetailScreen] -class ChatDetailRoute extends _i27.PageRouteInfo { +class ChatDetailRoute extends _i28.PageRouteInfo { ChatDetailRoute({ - _i28.Key? key, + _i29.Key? key, required String id, - List<_i27.PageRouteInfo>? children, + List<_i28.PageRouteInfo>? children, }) : super( ChatDetailRoute.name, args: ChatDetailRouteArgs(key: key, id: id), @@ -241,7 +242,7 @@ class ChatDetailRoute extends _i27.PageRouteInfo { static const String name = 'ChatDetailRoute'; - static _i27.PageInfo page = _i27.PageInfo( + static _i28.PageInfo page = _i28.PageInfo( name, builder: (data) { final pathParams = data.inheritedPathParams; @@ -256,7 +257,7 @@ class ChatDetailRoute extends _i27.PageRouteInfo { class ChatDetailRouteArgs { const ChatDetailRouteArgs({this.key, required this.id}); - final _i28.Key? key; + final _i29.Key? key; final String id; @@ -278,11 +279,11 @@ class ChatDetailRouteArgs { /// generated route for /// [_i6.ChatListScreen] -class ChatListRoute extends _i27.PageRouteInfo { +class ChatListRoute extends _i28.PageRouteInfo { ChatListRoute({ - _i28.Key? key, + _i29.Key? key, bool isAside = false, - List<_i27.PageRouteInfo>? children, + List<_i28.PageRouteInfo>? children, }) : super( ChatListRoute.name, args: ChatListRouteArgs(key: key, isAside: isAside), @@ -291,7 +292,7 @@ class ChatListRoute extends _i27.PageRouteInfo { static const String name = 'ChatListRoute'; - static _i27.PageInfo page = _i27.PageInfo( + static _i28.PageInfo page = _i28.PageInfo( name, builder: (data) { final args = data.argsAs( @@ -305,7 +306,7 @@ class ChatListRoute extends _i27.PageRouteInfo { class ChatListRouteArgs { const ChatListRouteArgs({this.key, this.isAside = false}); - final _i28.Key? key; + final _i29.Key? key; final bool isAside; @@ -327,11 +328,11 @@ class ChatListRouteArgs { /// generated route for /// [_i7.ChatRoomScreen] -class ChatRoomRoute extends _i27.PageRouteInfo { +class ChatRoomRoute extends _i28.PageRouteInfo { ChatRoomRoute({ - _i29.Key? key, + _i30.Key? key, required String id, - List<_i27.PageRouteInfo>? children, + List<_i28.PageRouteInfo>? children, }) : super( ChatRoomRoute.name, args: ChatRoomRouteArgs(key: key, id: id), @@ -341,7 +342,7 @@ class ChatRoomRoute extends _i27.PageRouteInfo { static const String name = 'ChatRoomRoute'; - static _i27.PageInfo page = _i27.PageInfo( + static _i28.PageInfo page = _i28.PageInfo( name, builder: (data) { final pathParams = data.inheritedPathParams; @@ -356,7 +357,7 @@ class ChatRoomRoute extends _i27.PageRouteInfo { class ChatRoomRouteArgs { const ChatRoomRouteArgs({this.key, required this.id}); - final _i29.Key? key; + final _i30.Key? key; final String id; @@ -378,13 +379,13 @@ class ChatRoomRouteArgs { /// generated route for /// [_i6.ChatShellScreen] -class ChatShellRoute extends _i27.PageRouteInfo { - const ChatShellRoute({List<_i27.PageRouteInfo>? children}) +class ChatShellRoute extends _i28.PageRouteInfo { + const ChatShellRoute({List<_i28.PageRouteInfo>? children}) : super(ChatShellRoute.name, initialChildren: children); static const String name = 'ChatShellRoute'; - static _i27.PageInfo page = _i27.PageInfo( + static _i28.PageInfo page = _i28.PageInfo( name, builder: (data) { return const _i6.ChatShellScreen(); @@ -394,13 +395,13 @@ class ChatShellRoute extends _i27.PageRouteInfo { /// generated route for /// [_i8.CreateAccountScreen] -class CreateAccountRoute extends _i27.PageRouteInfo { - const CreateAccountRoute({List<_i27.PageRouteInfo>? children}) +class CreateAccountRoute extends _i28.PageRouteInfo { + const CreateAccountRoute({List<_i28.PageRouteInfo>? children}) : super(CreateAccountRoute.name, initialChildren: children); static const String name = 'CreateAccountRoute'; - static _i27.PageInfo page = _i27.PageInfo( + static _i28.PageInfo page = _i28.PageInfo( name, builder: (data) { return const _i8.CreateAccountScreen(); @@ -410,11 +411,11 @@ class CreateAccountRoute extends _i27.PageRouteInfo { /// generated route for /// [_i9.CreatorHubScreen] -class CreatorHubRoute extends _i27.PageRouteInfo { +class CreatorHubRoute extends _i28.PageRouteInfo { CreatorHubRoute({ - _i28.Key? key, + _i29.Key? key, bool isAside = false, - List<_i27.PageRouteInfo>? children, + List<_i28.PageRouteInfo>? children, }) : super( CreatorHubRoute.name, args: CreatorHubRouteArgs(key: key, isAside: isAside), @@ -423,7 +424,7 @@ class CreatorHubRoute extends _i27.PageRouteInfo { static const String name = 'CreatorHubRoute'; - static _i27.PageInfo page = _i27.PageInfo( + static _i28.PageInfo page = _i28.PageInfo( name, builder: (data) { final args = data.argsAs( @@ -437,7 +438,7 @@ class CreatorHubRoute extends _i27.PageRouteInfo { class CreatorHubRouteArgs { const CreatorHubRouteArgs({this.key, this.isAside = false}); - final _i28.Key? key; + final _i29.Key? key; final bool isAside; @@ -459,13 +460,13 @@ class CreatorHubRouteArgs { /// generated route for /// [_i9.CreatorHubShellScreen] -class CreatorHubShellRoute extends _i27.PageRouteInfo { - const CreatorHubShellRoute({List<_i27.PageRouteInfo>? children}) +class CreatorHubShellRoute extends _i28.PageRouteInfo { + const CreatorHubShellRoute({List<_i28.PageRouteInfo>? children}) : super(CreatorHubShellRoute.name, initialChildren: children); static const String name = 'CreatorHubShellRoute'; - static _i27.PageInfo page = _i27.PageInfo( + static _i28.PageInfo page = _i28.PageInfo( name, builder: (data) { return const _i9.CreatorHubShellScreen(); @@ -473,10 +474,64 @@ class CreatorHubShellRoute extends _i27.PageRouteInfo { ); } +/// generated route for +/// [_i10.CreatorPostListScreen] +class CreatorPostListRoute + extends _i28.PageRouteInfo { + CreatorPostListRoute({ + _i29.Key? key, + required String pubName, + List<_i28.PageRouteInfo>? children, + }) : super( + CreatorPostListRoute.name, + args: CreatorPostListRouteArgs(key: key, pubName: pubName), + rawPathParams: {'name': pubName}, + initialChildren: children, + ); + + static const String name = 'CreatorPostListRoute'; + + static _i28.PageInfo page = _i28.PageInfo( + name, + builder: (data) { + final pathParams = data.inheritedPathParams; + final args = data.argsAs( + orElse: + () => + CreatorPostListRouteArgs(pubName: pathParams.getString('name')), + ); + return _i10.CreatorPostListScreen(key: args.key, pubName: args.pubName); + }, + ); +} + +class CreatorPostListRouteArgs { + const CreatorPostListRouteArgs({this.key, required this.pubName}); + + final _i29.Key? key; + + final String pubName; + + @override + String toString() { + return 'CreatorPostListRouteArgs{key: $key, pubName: $pubName}'; + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) return true; + if (other is! CreatorPostListRouteArgs) return false; + return key == other.key && pubName == other.pubName; + } + + @override + int get hashCode => key.hashCode ^ pubName.hashCode; +} + /// generated route for /// [_i6.EditChatScreen] -class EditChatRoute extends _i27.PageRouteInfo { - EditChatRoute({_i28.Key? key, String? id, List<_i27.PageRouteInfo>? children}) +class EditChatRoute extends _i28.PageRouteInfo { + EditChatRoute({_i29.Key? key, String? id, List<_i28.PageRouteInfo>? children}) : super( EditChatRoute.name, args: EditChatRouteArgs(key: key, id: id), @@ -486,7 +541,7 @@ class EditChatRoute extends _i27.PageRouteInfo { static const String name = 'EditChatRoute'; - static _i27.PageInfo page = _i27.PageInfo( + static _i28.PageInfo page = _i28.PageInfo( name, builder: (data) { final pathParams = data.inheritedPathParams; @@ -501,7 +556,7 @@ class EditChatRoute extends _i27.PageRouteInfo { class EditChatRouteArgs { const EditChatRouteArgs({this.key, this.id}); - final _i28.Key? key; + final _i29.Key? key; final String? id; @@ -522,12 +577,12 @@ class EditChatRouteArgs { } /// generated route for -/// [_i10.EditPublisherScreen] -class EditPublisherRoute extends _i27.PageRouteInfo { +/// [_i11.EditPublisherScreen] +class EditPublisherRoute extends _i28.PageRouteInfo { EditPublisherRoute({ - _i28.Key? key, + _i29.Key? key, String? name, - List<_i27.PageRouteInfo>? children, + List<_i28.PageRouteInfo>? children, }) : super( EditPublisherRoute.name, args: EditPublisherRouteArgs(key: key, name: name), @@ -537,14 +592,14 @@ class EditPublisherRoute extends _i27.PageRouteInfo { static const String name = 'EditPublisherRoute'; - static _i27.PageInfo page = _i27.PageInfo( + static _i28.PageInfo page = _i28.PageInfo( name, builder: (data) { final pathParams = data.inheritedPathParams; final args = data.argsAs( orElse: () => EditPublisherRouteArgs(name: pathParams.optString('id')), ); - return _i10.EditPublisherScreen(key: args.key, name: args.name); + return _i11.EditPublisherScreen(key: args.key, name: args.name); }, ); } @@ -552,7 +607,7 @@ class EditPublisherRoute extends _i27.PageRouteInfo { class EditPublisherRouteArgs { const EditPublisherRouteArgs({this.key, this.name}); - final _i28.Key? key; + final _i29.Key? key; final String? name; @@ -573,12 +628,12 @@ class EditPublisherRouteArgs { } /// generated route for -/// [_i11.EditRealmScreen] -class EditRealmRoute extends _i27.PageRouteInfo { +/// [_i12.EditRealmScreen] +class EditRealmRoute extends _i28.PageRouteInfo { EditRealmRoute({ - _i28.Key? key, + _i29.Key? key, String? slug, - List<_i27.PageRouteInfo>? children, + List<_i28.PageRouteInfo>? children, }) : super( EditRealmRoute.name, args: EditRealmRouteArgs(key: key, slug: slug), @@ -588,14 +643,14 @@ class EditRealmRoute extends _i27.PageRouteInfo { static const String name = 'EditRealmRoute'; - static _i27.PageInfo page = _i27.PageInfo( + static _i28.PageInfo page = _i28.PageInfo( name, builder: (data) { final pathParams = data.inheritedPathParams; final args = data.argsAs( orElse: () => EditRealmRouteArgs(slug: pathParams.optString('slug')), ); - return _i11.EditRealmScreen(key: args.key, slug: args.slug); + return _i12.EditRealmScreen(key: args.key, slug: args.slug); }, ); } @@ -603,7 +658,7 @@ class EditRealmRoute extends _i27.PageRouteInfo { class EditRealmRouteArgs { const EditRealmRouteArgs({this.key, this.slug}); - final _i28.Key? key; + final _i29.Key? key; final String? slug; @@ -624,14 +679,14 @@ class EditRealmRouteArgs { } /// generated route for -/// [_i12.EditStickerPacksScreen] +/// [_i13.EditStickerPacksScreen] class EditStickerPacksRoute - extends _i27.PageRouteInfo { + extends _i28.PageRouteInfo { EditStickerPacksRoute({ - _i28.Key? key, + _i29.Key? key, required String pubName, String? packId, - List<_i27.PageRouteInfo>? children, + List<_i28.PageRouteInfo>? children, }) : super( EditStickerPacksRoute.name, args: EditStickerPacksRouteArgs( @@ -645,7 +700,7 @@ class EditStickerPacksRoute static const String name = 'EditStickerPacksRoute'; - static _i27.PageInfo page = _i27.PageInfo( + static _i28.PageInfo page = _i28.PageInfo( name, builder: (data) { final pathParams = data.inheritedPathParams; @@ -656,7 +711,7 @@ class EditStickerPacksRoute packId: pathParams.optString('packId'), ), ); - return _i12.EditStickerPacksScreen( + return _i13.EditStickerPacksScreen( key: args.key, pubName: args.pubName, packId: args.packId, @@ -672,7 +727,7 @@ class EditStickerPacksRouteArgs { this.packId, }); - final _i28.Key? key; + final _i29.Key? key; final String pubName; @@ -697,13 +752,13 @@ class EditStickerPacksRouteArgs { } /// generated route for -/// [_i13.EditStickersScreen] -class EditStickersRoute extends _i27.PageRouteInfo { +/// [_i14.EditStickersScreen] +class EditStickersRoute extends _i28.PageRouteInfo { EditStickersRoute({ - _i28.Key? key, + _i29.Key? key, required String packId, required String? id, - List<_i27.PageRouteInfo>? children, + List<_i28.PageRouteInfo>? children, }) : super( EditStickersRoute.name, args: EditStickersRouteArgs(key: key, packId: packId, id: id), @@ -713,7 +768,7 @@ class EditStickersRoute extends _i27.PageRouteInfo { static const String name = 'EditStickersRoute'; - static _i27.PageInfo page = _i27.PageInfo( + static _i28.PageInfo page = _i28.PageInfo( name, builder: (data) { final pathParams = data.inheritedPathParams; @@ -724,7 +779,7 @@ class EditStickersRoute extends _i27.PageRouteInfo { id: pathParams.optString('id'), ), ); - return _i13.EditStickersScreen( + return _i14.EditStickersScreen( key: args.key, packId: args.packId, id: args.id, @@ -740,7 +795,7 @@ class EditStickersRouteArgs { required this.id, }); - final _i28.Key? key; + final _i29.Key? key; final String packId; @@ -763,12 +818,12 @@ class EditStickersRouteArgs { } /// generated route for -/// [_i14.EventCalanderScreen] -class EventCalanderRoute extends _i27.PageRouteInfo { +/// [_i15.EventCalanderScreen] +class EventCalanderRoute extends _i28.PageRouteInfo { EventCalanderRoute({ - _i28.Key? key, + _i29.Key? key, required String name, - List<_i27.PageRouteInfo>? children, + List<_i28.PageRouteInfo>? children, }) : super( EventCalanderRoute.name, args: EventCalanderRouteArgs(key: key, name: name), @@ -778,7 +833,7 @@ class EventCalanderRoute extends _i27.PageRouteInfo { static const String name = 'EventCalanderRoute'; - static _i27.PageInfo page = _i27.PageInfo( + static _i28.PageInfo page = _i28.PageInfo( name, builder: (data) { final pathParams = data.inheritedPathParams; @@ -786,7 +841,7 @@ class EventCalanderRoute extends _i27.PageRouteInfo { orElse: () => EventCalanderRouteArgs(name: pathParams.getString('name')), ); - return _i14.EventCalanderScreen(key: args.key, name: args.name); + return _i15.EventCalanderScreen(key: args.key, name: args.name); }, ); } @@ -794,7 +849,7 @@ class EventCalanderRoute extends _i27.PageRouteInfo { class EventCalanderRouteArgs { const EventCalanderRouteArgs({this.key, required this.name}); - final _i28.Key? key; + final _i29.Key? key; final String name; @@ -815,12 +870,12 @@ class EventCalanderRouteArgs { } /// generated route for -/// [_i15.ExploreScreen] -class ExploreRoute extends _i27.PageRouteInfo { +/// [_i16.ExploreScreen] +class ExploreRoute extends _i28.PageRouteInfo { ExploreRoute({ - _i28.Key? key, + _i29.Key? key, bool isAside = false, - List<_i27.PageRouteInfo>? children, + List<_i28.PageRouteInfo>? children, }) : super( ExploreRoute.name, args: ExploreRouteArgs(key: key, isAside: isAside), @@ -829,13 +884,13 @@ class ExploreRoute extends _i27.PageRouteInfo { static const String name = 'ExploreRoute'; - static _i27.PageInfo page = _i27.PageInfo( + static _i28.PageInfo page = _i28.PageInfo( name, builder: (data) { final args = data.argsAs( orElse: () => const ExploreRouteArgs(), ); - return _i15.ExploreScreen(key: args.key, isAside: args.isAside); + return _i16.ExploreScreen(key: args.key, isAside: args.isAside); }, ); } @@ -843,7 +898,7 @@ class ExploreRoute extends _i27.PageRouteInfo { class ExploreRouteArgs { const ExploreRouteArgs({this.key, this.isAside = false}); - final _i28.Key? key; + final _i29.Key? key; final bool isAside; @@ -864,46 +919,46 @@ class ExploreRouteArgs { } /// generated route for -/// [_i15.ExploreShellScreen] -class ExploreShellRoute extends _i27.PageRouteInfo { - const ExploreShellRoute({List<_i27.PageRouteInfo>? children}) +/// [_i16.ExploreShellScreen] +class ExploreShellRoute extends _i28.PageRouteInfo { + const ExploreShellRoute({List<_i28.PageRouteInfo>? children}) : super(ExploreShellRoute.name, initialChildren: children); static const String name = 'ExploreShellRoute'; - static _i27.PageInfo page = _i27.PageInfo( + static _i28.PageInfo page = _i28.PageInfo( name, builder: (data) { - return const _i15.ExploreShellScreen(); + return const _i16.ExploreShellScreen(); }, ); } /// generated route for -/// [_i16.LoginScreen] -class LoginRoute extends _i27.PageRouteInfo { - const LoginRoute({List<_i27.PageRouteInfo>? children}) +/// [_i17.LoginScreen] +class LoginRoute extends _i28.PageRouteInfo { + const LoginRoute({List<_i28.PageRouteInfo>? children}) : super(LoginRoute.name, initialChildren: children); static const String name = 'LoginRoute'; - static _i27.PageInfo page = _i27.PageInfo( + static _i28.PageInfo page = _i28.PageInfo( name, builder: (data) { - return const _i16.LoginScreen(); + return const _i17.LoginScreen(); }, ); } /// generated route for /// [_i6.NewChatScreen] -class NewChatRoute extends _i27.PageRouteInfo { - const NewChatRoute({List<_i27.PageRouteInfo>? children}) +class NewChatRoute extends _i28.PageRouteInfo { + const NewChatRoute({List<_i28.PageRouteInfo>? children}) : super(NewChatRoute.name, initialChildren: children); static const String name = 'NewChatRoute'; - static _i27.PageInfo page = _i27.PageInfo( + static _i28.PageInfo page = _i28.PageInfo( name, builder: (data) { return const _i6.NewChatScreen(); @@ -912,45 +967,45 @@ class NewChatRoute extends _i27.PageRouteInfo { } /// generated route for -/// [_i10.NewPublisherScreen] -class NewPublisherRoute extends _i27.PageRouteInfo { - const NewPublisherRoute({List<_i27.PageRouteInfo>? children}) +/// [_i11.NewPublisherScreen] +class NewPublisherRoute extends _i28.PageRouteInfo { + const NewPublisherRoute({List<_i28.PageRouteInfo>? children}) : super(NewPublisherRoute.name, initialChildren: children); static const String name = 'NewPublisherRoute'; - static _i27.PageInfo page = _i27.PageInfo( + static _i28.PageInfo page = _i28.PageInfo( name, builder: (data) { - return const _i10.NewPublisherScreen(); + return const _i11.NewPublisherScreen(); }, ); } /// generated route for -/// [_i11.NewRealmScreen] -class NewRealmRoute extends _i27.PageRouteInfo { - const NewRealmRoute({List<_i27.PageRouteInfo>? children}) +/// [_i12.NewRealmScreen] +class NewRealmRoute extends _i28.PageRouteInfo { + const NewRealmRoute({List<_i28.PageRouteInfo>? children}) : super(NewRealmRoute.name, initialChildren: children); static const String name = 'NewRealmRoute'; - static _i27.PageInfo page = _i27.PageInfo( + static _i28.PageInfo page = _i28.PageInfo( name, builder: (data) { - return const _i11.NewRealmScreen(); + return const _i12.NewRealmScreen(); }, ); } /// generated route for -/// [_i12.NewStickerPacksScreen] +/// [_i13.NewStickerPacksScreen] class NewStickerPacksRoute - extends _i27.PageRouteInfo { + extends _i28.PageRouteInfo { NewStickerPacksRoute({ - _i28.Key? key, + _i29.Key? key, required String pubName, - List<_i27.PageRouteInfo>? children, + List<_i28.PageRouteInfo>? children, }) : super( NewStickerPacksRoute.name, args: NewStickerPacksRouteArgs(key: key, pubName: pubName), @@ -960,7 +1015,7 @@ class NewStickerPacksRoute static const String name = 'NewStickerPacksRoute'; - static _i27.PageInfo page = _i27.PageInfo( + static _i28.PageInfo page = _i28.PageInfo( name, builder: (data) { final pathParams = data.inheritedPathParams; @@ -969,7 +1024,7 @@ class NewStickerPacksRoute () => NewStickerPacksRouteArgs(pubName: pathParams.getString('name')), ); - return _i12.NewStickerPacksScreen(key: args.key, pubName: args.pubName); + return _i13.NewStickerPacksScreen(key: args.key, pubName: args.pubName); }, ); } @@ -977,7 +1032,7 @@ class NewStickerPacksRoute class NewStickerPacksRouteArgs { const NewStickerPacksRouteArgs({this.key, required this.pubName}); - final _i28.Key? key; + final _i29.Key? key; final String pubName; @@ -998,12 +1053,12 @@ class NewStickerPacksRouteArgs { } /// generated route for -/// [_i13.NewStickersScreen] -class NewStickersRoute extends _i27.PageRouteInfo { +/// [_i14.NewStickersScreen] +class NewStickersRoute extends _i28.PageRouteInfo { NewStickersRoute({ - _i28.Key? key, + _i29.Key? key, required String packId, - List<_i27.PageRouteInfo>? children, + List<_i28.PageRouteInfo>? children, }) : super( NewStickersRoute.name, args: NewStickersRouteArgs(key: key, packId: packId), @@ -1013,7 +1068,7 @@ class NewStickersRoute extends _i27.PageRouteInfo { static const String name = 'NewStickersRoute'; - static _i27.PageInfo page = _i27.PageInfo( + static _i28.PageInfo page = _i28.PageInfo( name, builder: (data) { final pathParams = data.inheritedPathParams; @@ -1021,7 +1076,7 @@ class NewStickersRoute extends _i27.PageRouteInfo { orElse: () => NewStickersRouteArgs(packId: pathParams.getString('packId')), ); - return _i13.NewStickersScreen(key: args.key, packId: args.packId); + return _i14.NewStickersScreen(key: args.key, packId: args.packId); }, ); } @@ -1029,7 +1084,7 @@ class NewStickersRoute extends _i27.PageRouteInfo { class NewStickersRouteArgs { const NewStickersRouteArgs({this.key, required this.packId}); - final _i28.Key? key; + final _i29.Key? key; final String packId; @@ -1050,30 +1105,30 @@ class NewStickersRouteArgs { } /// generated route for -/// [_i17.NotificationScreen] -class NotificationRoute extends _i27.PageRouteInfo { - const NotificationRoute({List<_i27.PageRouteInfo>? children}) +/// [_i18.NotificationScreen] +class NotificationRoute extends _i28.PageRouteInfo { + const NotificationRoute({List<_i28.PageRouteInfo>? children}) : super(NotificationRoute.name, initialChildren: children); static const String name = 'NotificationRoute'; - static _i27.PageInfo page = _i27.PageInfo( + static _i28.PageInfo page = _i28.PageInfo( name, builder: (data) { - return const _i17.NotificationScreen(); + return const _i18.NotificationScreen(); }, ); } /// generated route for -/// [_i18.PostComposeScreen] -class PostComposeRoute extends _i27.PageRouteInfo { +/// [_i19.PostComposeScreen] +class PostComposeRoute extends _i28.PageRouteInfo { PostComposeRoute({ - _i28.Key? key, - _i30.SnPost? originalPost, - _i30.SnPost? repliedPost, - _i30.SnPost? forwardedPost, - List<_i27.PageRouteInfo>? children, + _i29.Key? key, + _i31.SnPost? originalPost, + _i31.SnPost? repliedPost, + _i31.SnPost? forwardedPost, + List<_i28.PageRouteInfo>? children, }) : super( PostComposeRoute.name, args: PostComposeRouteArgs( @@ -1087,13 +1142,13 @@ class PostComposeRoute extends _i27.PageRouteInfo { static const String name = 'PostComposeRoute'; - static _i27.PageInfo page = _i27.PageInfo( + static _i28.PageInfo page = _i28.PageInfo( name, builder: (data) { final args = data.argsAs( orElse: () => const PostComposeRouteArgs(), ); - return _i18.PostComposeScreen( + return _i19.PostComposeScreen( key: args.key, originalPost: args.originalPost, repliedPost: args.repliedPost, @@ -1111,13 +1166,13 @@ class PostComposeRouteArgs { this.forwardedPost, }); - final _i28.Key? key; + final _i29.Key? key; - final _i30.SnPost? originalPost; + final _i31.SnPost? originalPost; - final _i30.SnPost? repliedPost; + final _i31.SnPost? repliedPost; - final _i30.SnPost? forwardedPost; + final _i31.SnPost? forwardedPost; @override String toString() { @@ -1143,12 +1198,12 @@ class PostComposeRouteArgs { } /// generated route for -/// [_i19.PostDetailScreen] -class PostDetailRoute extends _i27.PageRouteInfo { +/// [_i20.PostDetailScreen] +class PostDetailRoute extends _i28.PageRouteInfo { PostDetailRoute({ - _i28.Key? key, + _i29.Key? key, required String id, - List<_i27.PageRouteInfo>? children, + List<_i28.PageRouteInfo>? children, }) : super( PostDetailRoute.name, args: PostDetailRouteArgs(key: key, id: id), @@ -1158,14 +1213,14 @@ class PostDetailRoute extends _i27.PageRouteInfo { static const String name = 'PostDetailRoute'; - static _i27.PageInfo page = _i27.PageInfo( + static _i28.PageInfo page = _i28.PageInfo( name, builder: (data) { final pathParams = data.inheritedPathParams; final args = data.argsAs( orElse: () => PostDetailRouteArgs(id: pathParams.getString('id')), ); - return _i19.PostDetailScreen(key: args.key, id: args.id); + return _i20.PostDetailScreen(key: args.key, id: args.id); }, ); } @@ -1173,7 +1228,7 @@ class PostDetailRoute extends _i27.PageRouteInfo { class PostDetailRouteArgs { const PostDetailRouteArgs({this.key, required this.id}); - final _i28.Key? key; + final _i29.Key? key; final String id; @@ -1194,12 +1249,12 @@ class PostDetailRouteArgs { } /// generated route for -/// [_i18.PostEditScreen] -class PostEditRoute extends _i27.PageRouteInfo { +/// [_i19.PostEditScreen] +class PostEditRoute extends _i28.PageRouteInfo { PostEditRoute({ - _i28.Key? key, + _i29.Key? key, required String id, - List<_i27.PageRouteInfo>? children, + List<_i28.PageRouteInfo>? children, }) : super( PostEditRoute.name, args: PostEditRouteArgs(key: key, id: id), @@ -1209,14 +1264,14 @@ class PostEditRoute extends _i27.PageRouteInfo { static const String name = 'PostEditRoute'; - static _i27.PageInfo page = _i27.PageInfo( + static _i28.PageInfo page = _i28.PageInfo( name, builder: (data) { final pathParams = data.inheritedPathParams; final args = data.argsAs( orElse: () => PostEditRouteArgs(id: pathParams.getString('id')), ); - return _i18.PostEditScreen(key: args.key, id: args.id); + return _i19.PostEditScreen(key: args.key, id: args.id); }, ); } @@ -1224,7 +1279,7 @@ class PostEditRoute extends _i27.PageRouteInfo { class PostEditRouteArgs { const PostEditRouteArgs({this.key, required this.id}); - final _i28.Key? key; + final _i29.Key? key; final String id; @@ -1245,13 +1300,13 @@ class PostEditRouteArgs { } /// generated route for -/// [_i20.PublisherProfileScreen] +/// [_i21.PublisherProfileScreen] class PublisherProfileRoute - extends _i27.PageRouteInfo { + extends _i28.PageRouteInfo { PublisherProfileRoute({ - _i28.Key? key, + _i29.Key? key, required String name, - List<_i27.PageRouteInfo>? children, + List<_i28.PageRouteInfo>? children, }) : super( PublisherProfileRoute.name, args: PublisherProfileRouteArgs(key: key, name: name), @@ -1261,7 +1316,7 @@ class PublisherProfileRoute static const String name = 'PublisherProfileRoute'; - static _i27.PageInfo page = _i27.PageInfo( + static _i28.PageInfo page = _i28.PageInfo( name, builder: (data) { final pathParams = data.inheritedPathParams; @@ -1269,7 +1324,7 @@ class PublisherProfileRoute orElse: () => PublisherProfileRouteArgs(name: pathParams.getString('name')), ); - return _i20.PublisherProfileScreen(key: args.key, name: args.name); + return _i21.PublisherProfileScreen(key: args.key, name: args.name); }, ); } @@ -1277,7 +1332,7 @@ class PublisherProfileRoute class PublisherProfileRouteArgs { const PublisherProfileRouteArgs({this.key, required this.name}); - final _i28.Key? key; + final _i29.Key? key; final String name; @@ -1298,12 +1353,12 @@ class PublisherProfileRouteArgs { } /// generated route for -/// [_i21.RealmDetailScreen] -class RealmDetailRoute extends _i27.PageRouteInfo { +/// [_i22.RealmDetailScreen] +class RealmDetailRoute extends _i28.PageRouteInfo { RealmDetailRoute({ - _i28.Key? key, + _i29.Key? key, required String slug, - List<_i27.PageRouteInfo>? children, + List<_i28.PageRouteInfo>? children, }) : super( RealmDetailRoute.name, args: RealmDetailRouteArgs(key: key, slug: slug), @@ -1313,14 +1368,14 @@ class RealmDetailRoute extends _i27.PageRouteInfo { static const String name = 'RealmDetailRoute'; - static _i27.PageInfo page = _i27.PageInfo( + static _i28.PageInfo page = _i28.PageInfo( name, builder: (data) { final pathParams = data.inheritedPathParams; final args = data.argsAs( orElse: () => RealmDetailRouteArgs(slug: pathParams.getString('slug')), ); - return _i21.RealmDetailScreen(key: args.key, slug: args.slug); + return _i22.RealmDetailScreen(key: args.key, slug: args.slug); }, ); } @@ -1328,7 +1383,7 @@ class RealmDetailRoute extends _i27.PageRouteInfo { class RealmDetailRouteArgs { const RealmDetailRouteArgs({this.key, required this.slug}); - final _i28.Key? key; + final _i29.Key? key; final String slug; @@ -1349,62 +1404,62 @@ class RealmDetailRouteArgs { } /// generated route for -/// [_i11.RealmListScreen] -class RealmListRoute extends _i27.PageRouteInfo { - const RealmListRoute({List<_i27.PageRouteInfo>? children}) +/// [_i12.RealmListScreen] +class RealmListRoute extends _i28.PageRouteInfo { + const RealmListRoute({List<_i28.PageRouteInfo>? children}) : super(RealmListRoute.name, initialChildren: children); static const String name = 'RealmListRoute'; - static _i27.PageInfo page = _i27.PageInfo( + static _i28.PageInfo page = _i28.PageInfo( name, builder: (data) { - return const _i11.RealmListScreen(); + return const _i12.RealmListScreen(); }, ); } /// generated route for -/// [_i22.RelationshipScreen] -class RelationshipRoute extends _i27.PageRouteInfo { - const RelationshipRoute({List<_i27.PageRouteInfo>? children}) +/// [_i23.RelationshipScreen] +class RelationshipRoute extends _i28.PageRouteInfo { + const RelationshipRoute({List<_i28.PageRouteInfo>? children}) : super(RelationshipRoute.name, initialChildren: children); static const String name = 'RelationshipRoute'; - static _i27.PageInfo page = _i27.PageInfo( + static _i28.PageInfo page = _i28.PageInfo( name, builder: (data) { - return const _i22.RelationshipScreen(); + return const _i23.RelationshipScreen(); }, ); } /// generated route for -/// [_i23.SettingsScreen] -class SettingsRoute extends _i27.PageRouteInfo { - const SettingsRoute({List<_i27.PageRouteInfo>? children}) +/// [_i24.SettingsScreen] +class SettingsRoute extends _i28.PageRouteInfo { + const SettingsRoute({List<_i28.PageRouteInfo>? children}) : super(SettingsRoute.name, initialChildren: children); static const String name = 'SettingsRoute'; - static _i27.PageInfo page = _i27.PageInfo( + static _i28.PageInfo page = _i28.PageInfo( name, builder: (data) { - return const _i23.SettingsScreen(); + return const _i24.SettingsScreen(); }, ); } /// generated route for -/// [_i13.StickerPackDetailScreen] +/// [_i14.StickerPackDetailScreen] class StickerPackDetailRoute - extends _i27.PageRouteInfo { + extends _i28.PageRouteInfo { StickerPackDetailRoute({ - _i28.Key? key, + _i29.Key? key, required String pubName, required String id, - List<_i27.PageRouteInfo>? children, + List<_i28.PageRouteInfo>? children, }) : super( StickerPackDetailRoute.name, args: StickerPackDetailRouteArgs(key: key, pubName: pubName, id: id), @@ -1414,7 +1469,7 @@ class StickerPackDetailRoute static const String name = 'StickerPackDetailRoute'; - static _i27.PageInfo page = _i27.PageInfo( + static _i28.PageInfo page = _i28.PageInfo( name, builder: (data) { final pathParams = data.inheritedPathParams; @@ -1425,7 +1480,7 @@ class StickerPackDetailRoute id: pathParams.getString('packId'), ), ); - return _i13.StickerPackDetailScreen( + return _i14.StickerPackDetailScreen( key: args.key, pubName: args.pubName, id: args.id, @@ -1441,7 +1496,7 @@ class StickerPackDetailRouteArgs { required this.id, }); - final _i28.Key? key; + final _i29.Key? key; final String pubName; @@ -1464,12 +1519,12 @@ class StickerPackDetailRouteArgs { } /// generated route for -/// [_i12.StickersScreen] -class StickersRoute extends _i27.PageRouteInfo { +/// [_i13.StickersScreen] +class StickersRoute extends _i28.PageRouteInfo { StickersRoute({ - _i28.Key? key, + _i29.Key? key, required String pubName, - List<_i27.PageRouteInfo>? children, + List<_i28.PageRouteInfo>? children, }) : super( StickersRoute.name, args: StickersRouteArgs(key: key, pubName: pubName), @@ -1479,14 +1534,14 @@ class StickersRoute extends _i27.PageRouteInfo { static const String name = 'StickersRoute'; - static _i27.PageInfo page = _i27.PageInfo( + static _i28.PageInfo page = _i28.PageInfo( name, builder: (data) { final pathParams = data.inheritedPathParams; final args = data.argsAs( orElse: () => StickersRouteArgs(pubName: pathParams.getString('name')), ); - return _i12.StickersScreen(key: args.key, pubName: args.pubName); + return _i13.StickersScreen(key: args.key, pubName: args.pubName); }, ); } @@ -1494,7 +1549,7 @@ class StickersRoute extends _i27.PageRouteInfo { class StickersRouteArgs { const StickersRouteArgs({this.key, required this.pubName}); - final _i28.Key? key; + final _i29.Key? key; final String pubName; @@ -1515,14 +1570,14 @@ class StickersRouteArgs { } /// generated route for -/// [_i24.TabsNavigationWidget] +/// [_i25.TabsNavigationWidget] class TabsNavigationWidget - extends _i27.PageRouteInfo { + extends _i28.PageRouteInfo { TabsNavigationWidget({ - _i28.Key? key, - required _i28.Widget child, - required _i31.AppRouter router, - List<_i27.PageRouteInfo>? children, + _i29.Key? key, + required _i29.Widget child, + required _i32.AppRouter router, + List<_i28.PageRouteInfo>? children, }) : super( TabsNavigationWidget.name, args: TabsNavigationWidgetArgs(key: key, child: child, router: router), @@ -1531,11 +1586,11 @@ class TabsNavigationWidget static const String name = 'TabsNavigationWidget'; - static _i27.PageInfo page = _i27.PageInfo( + static _i28.PageInfo page = _i28.PageInfo( name, builder: (data) { final args = data.argsAs(); - return _i24.TabsNavigationWidget( + return _i25.TabsNavigationWidget( key: args.key, child: args.child, router: args.router, @@ -1551,11 +1606,11 @@ class TabsNavigationWidgetArgs { required this.router, }); - final _i28.Key? key; + final _i29.Key? key; - final _i28.Widget child; + final _i29.Widget child; - final _i31.AppRouter router; + final _i32.AppRouter router; @override String toString() { @@ -1574,33 +1629,33 @@ class TabsNavigationWidgetArgs { } /// generated route for -/// [_i25.UpdateProfileScreen] -class UpdateProfileRoute extends _i27.PageRouteInfo { - const UpdateProfileRoute({List<_i27.PageRouteInfo>? children}) +/// [_i26.UpdateProfileScreen] +class UpdateProfileRoute extends _i28.PageRouteInfo { + const UpdateProfileRoute({List<_i28.PageRouteInfo>? children}) : super(UpdateProfileRoute.name, initialChildren: children); static const String name = 'UpdateProfileRoute'; - static _i27.PageInfo page = _i27.PageInfo( + static _i28.PageInfo page = _i28.PageInfo( name, builder: (data) { - return const _i25.UpdateProfileScreen(); + return const _i26.UpdateProfileScreen(); }, ); } /// generated route for -/// [_i26.WalletScreen] -class WalletRoute extends _i27.PageRouteInfo { - const WalletRoute({List<_i27.PageRouteInfo>? children}) +/// [_i27.WalletScreen] +class WalletRoute extends _i28.PageRouteInfo { + const WalletRoute({List<_i28.PageRouteInfo>? children}) : super(WalletRoute.name, initialChildren: children); static const String name = 'WalletRoute'; - static _i27.PageInfo page = _i27.PageInfo( + static _i28.PageInfo page = _i28.PageInfo( name, builder: (data) { - return const _i26.WalletScreen(); + return const _i27.WalletScreen(); }, ); } diff --git a/lib/screens/creators/hub.dart b/lib/screens/creators/hub.dart index eae5d20..84b47ba 100644 --- a/lib/screens/creators/hub.dart +++ b/lib/screens/creators/hub.dart @@ -263,6 +263,13 @@ class CreatorHubScreen extends HookConsumerWidget { contentPadding: EdgeInsets.symmetric( horizontal: 24, ), + onTap: () { + context.router.push( + CreatorPostListRoute( + pubName: currentPublisher.value!.name, + ), + ); + }, ), Divider(height: 1).padding(vertical: 8), ListTile( diff --git a/lib/screens/creators/posts/list.dart b/lib/screens/creators/posts/list.dart new file mode 100644 index 0000000..5227151 --- /dev/null +++ b/lib/screens/creators/posts/list.dart @@ -0,0 +1,27 @@ +import 'package:auto_route/auto_route.dart'; +import 'package:easy_localization/easy_localization.dart'; +import 'package:flutter/material.dart'; +import 'package:hooks_riverpod/hooks_riverpod.dart'; +import 'package:island/widgets/app_scaffold.dart'; +import 'package:island/widgets/post/post_list.dart'; + +@RoutePage() +class CreatorPostListScreen extends HookConsumerWidget { + final String pubName; + const CreatorPostListScreen({ + super.key, + @PathParam('name') required this.pubName, + }); + + @override + Widget build(BuildContext context, WidgetRef ref) { + return AppScaffold( + appBar: AppBar(title: Text('posts').tr()), + body: CustomScrollView( + slivers: [ + SliverPostList(pubName: pubName, itemType: PostItemType.creator), + ], + ), + ); + } +} diff --git a/lib/widgets/post/post_item_creator.dart b/lib/widgets/post/post_item_creator.dart new file mode 100644 index 0000000..01429e2 --- /dev/null +++ b/lib/widgets/post/post_item_creator.dart @@ -0,0 +1,457 @@ +import 'package:auto_route/auto_route.dart'; +import 'package:easy_localization/easy_localization.dart'; +import 'package:flutter/material.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/services/time.dart'; +import 'package:island/widgets/alert.dart'; +import 'package:island/widgets/content/cloud_file_collection.dart'; +import 'package:island/widgets/content/markdown.dart'; +import 'package:island/widgets/post/post_item.dart'; +import 'package:material_symbols_icons/symbols.dart'; +import 'package:styled_widget/styled_widget.dart'; +import 'package:super_context_menu/super_context_menu.dart'; + +class PostItemCreator extends HookConsumerWidget { + final Color? backgroundColor; + final SnPost item; + final EdgeInsets? padding; + final bool isOpenable; + final Function? onRefresh; + final Function(SnPost)? onUpdate; + + const PostItemCreator({ + super.key, + required this.item, + this.backgroundColor, + this.padding, + this.isOpenable = true, + this.onRefresh, + this.onUpdate, + }); + + @override + Widget build(BuildContext context, WidgetRef ref) { + final renderingPadding = + padding ?? const EdgeInsets.symmetric(horizontal: 16, vertical: 16); + + return ContextMenuWidget( + menuProvider: (_) { + return Menu( + children: [ + MenuAction( + title: 'edit'.tr(), + image: MenuImage.icon(Symbols.edit), + callback: () { + context.router.push(PostEditRoute(id: item.id)).then((value) { + if (value != null) { + onRefresh?.call(); + } + }); + }, + ), + MenuAction( + title: 'delete'.tr(), + image: MenuImage.icon(Symbols.delete), + callback: () { + showConfirmAlert('deletePostHint'.tr(), 'deletePost'.tr()).then( + (confirm) { + if (confirm) { + final client = ref.watch(apiClientProvider); + client + .delete('/posts/${item.id}') + .catchError((err) { + showErrorAlert(err); + return err; + }) + .then((_) { + onRefresh?.call(); + }); + } + }, + ); + }, + ), + MenuSeparator(), + MenuAction( + title: 'copyLink'.tr(), + image: MenuImage.icon(Symbols.link), + callback: () { + // Copy post link to clipboard + context.router.push(PostDetailRoute(id: item.id)); + }, + ), + ], + ); + }, + child: Material( + color: backgroundColor, + borderRadius: BorderRadius.circular(12), + elevation: 1, + child: InkWell( + borderRadius: BorderRadius.circular(12), + onTap: () { + if (isOpenable) { + context.router.push(PostDetailRoute(id: item.id)); + } + }, + child: Padding( + padding: renderingPadding, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + _buildPostHeader(context), + _buildPostContent(context), + const Gap(16), + _buildAnalyticsSection(context), + ], + ), + ), + ), + ), + ); + } + + Widget _buildPostHeader(BuildContext context) { + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + // Post ID and timestamp row + Row( + children: [ + Container( + padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4), + decoration: BoxDecoration( + color: Theme.of(context).colorScheme.primaryContainer, + borderRadius: BorderRadius.circular(4), + ), + child: Text( + 'ID: ${item.id.substring(0, 6)}', + style: TextStyle( + fontSize: 12, + fontWeight: FontWeight.bold, + color: Theme.of(context).colorScheme.onPrimaryContainer, + ), + ), + ), + const Spacer(), + Icon( + _getVisibilityIcon(item.visibility), + size: 16, + color: Theme.of(context).colorScheme.secondary, + ), + const SizedBox(width: 4), + Text( + _getVisibilityText(item.visibility).tr(), + style: TextStyle( + fontSize: 12, + color: Theme.of(context).colorScheme.secondary, + ), + ), + const Gap(8), + Text( + item.publishedAt.formatSystem(), + style: TextStyle( + fontSize: 12, + color: Theme.of(context).colorScheme.secondary, + ), + ), + ], + ), + const Gap(8), + + // Title and description + if (item.title?.isNotEmpty ?? false) + Text( + item.title!, + style: Theme.of( + context, + ).textTheme.titleMedium?.copyWith(fontWeight: FontWeight.bold), + ), + if (item.description?.isNotEmpty ?? false) + Text( + item.description!, + style: Theme.of(context).textTheme.bodyMedium?.copyWith( + color: Theme.of(context).colorScheme.onSurfaceVariant, + ), + ).padding(top: 4), + ], + ); + } + + Widget _buildPostContent(BuildContext context) { + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + // Content preview + if (item.content?.isNotEmpty ?? false) + Container( + margin: const EdgeInsets.only(top: 12), + child: MarkdownTextContent(content: item.content!), + ), + + // Attachments + if (item.attachments.isNotEmpty) + CloudFileList( + files: item.attachments, + maxWidth: MediaQuery.of(context).size.width * 0.85, + minWidth: MediaQuery.of(context).size.width * 0.9, + ).padding(top: 8), + + // Reference post indicator + if (item.repliedPost != null || item.forwardedPost != null) + Container( + margin: const EdgeInsets.only(top: 8), + child: Row( + children: [ + Icon( + item.repliedPost != null ? Symbols.reply : Symbols.forward, + size: 16, + color: Theme.of(context).colorScheme.secondary, + ), + const SizedBox(width: 4), + Text( + item.repliedPost != null + ? 'repliedTo'.tr() + : 'forwarded'.tr(), + style: TextStyle( + fontSize: 12, + color: Theme.of(context).colorScheme.secondary, + ), + ), + ], + ), + ), + ], + ); + } + + Widget _buildAnalyticsSection(BuildContext context) { + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text('Analytics', style: Theme.of(context).textTheme.titleSmall), + const Gap(8), + + // Engagement metrics in a card + Card( + elevation: 1, + margin: EdgeInsets.zero, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(12), + side: BorderSide( + color: Theme.of(context).colorScheme.outline.withOpacity(0.3), + ), + ), + child: Padding( + padding: const EdgeInsets.all(16), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + _buildMetricItem( + context, + Symbols.visibility, + 'Views', + '${item.viewsUnique} / ${item.viewsTotal}', + 'Unique / Total', + ), + _buildMetricItem( + context, + Symbols.thumb_up, + 'Upvotes', + '${item.upvotes}', + null, + ), + _buildMetricItem( + context, + Symbols.thumb_down, + 'Downvotes', + '${item.downvotes}', + null, + ), + ], + ), + ), + ), + const Gap(16), + + // Reactions summary + if (item.reactionsCount.isNotEmpty) _buildReactionsSection(context), + + // Metadata section + if (item.meta != null && item.meta!.isNotEmpty) + _buildMetadataSection(context), + + // Creation and modification timestamps + const Gap(16), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + 'Created: ${item.createdAt.formatSystem()}', + style: TextStyle( + fontSize: 12, + color: Theme.of(context).colorScheme.secondary, + ), + ), + if (item.editedAt != null) + Text( + 'Edited: ${item.editedAt!.formatSystem()}', + style: TextStyle( + fontSize: 12, + color: Theme.of(context).colorScheme.secondary, + ), + ), + ], + ), + ], + ); + } + + Widget _buildMetricItem( + BuildContext context, + IconData icon, + String label, + String value, + String? subtitle, + ) { + return Column( + children: [ + Icon(icon, size: 20, color: Theme.of(context).colorScheme.primary), + const Gap(4), + Text( + label, + style: TextStyle( + fontSize: 12, + color: Theme.of(context).colorScheme.secondary, + ), + ), + Text( + value, + style: const TextStyle(fontSize: 16, fontWeight: FontWeight.bold), + ), + if (subtitle != null) + Text( + subtitle, + style: TextStyle( + fontSize: 10, + color: Theme.of(context).colorScheme.secondary, + ), + ), + ], + ); + } + + Widget _buildReactionsSection(BuildContext context) { + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + 'reactions'.plural( + item.reactionsCount.isNotEmpty + ? item.reactionsCount.values.reduce((a, b) => a + b) + : 0, + ), + style: TextStyle( + fontSize: 14, + fontWeight: FontWeight.w500, + color: Theme.of(context).colorScheme.secondary, + ), + ), + const Gap(8), + PostReactionList( + parentId: item.id, + reactions: item.reactionsCount, + padding: EdgeInsets.zero, + onReact: (symbol, attitude, delta) { + final reactionsCount = Map.from(item.reactionsCount); + reactionsCount[symbol] = (reactionsCount[symbol] ?? 0) + delta; + onUpdate?.call(item.copyWith(reactionsCount: reactionsCount)); + }, + ), + const Gap(16), + ], + ); + } + + Widget _buildMetadataSection(BuildContext context) { + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + const Gap(16), + Text('Metadata', style: Theme.of(context).textTheme.titleSmall), + const Gap(8), + Container( + padding: const EdgeInsets.all(12), + decoration: BoxDecoration( + color: Theme.of( + context, + ).colorScheme.surfaceVariant.withOpacity(0.5), + borderRadius: BorderRadius.circular(8), + border: Border.all( + color: Theme.of(context).colorScheme.outline.withOpacity(0.3), + ), + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + for (final entry in item.meta!.entries) + Padding( + padding: const EdgeInsets.only(bottom: 8), + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + '${entry.key}: ', + style: const TextStyle( + fontWeight: FontWeight.bold, + fontSize: 12, + ), + ), + Expanded( + child: Text( + '${entry.value}', + style: const TextStyle(fontSize: 12), + ), + ), + ], + ), + ), + ], + ), + ), + ], + ); + } +} + +// Helper method to get the appropriate icon for each visibility status +IconData _getVisibilityIcon(int visibility) { + switch (visibility) { + case 1: // Friends + return Symbols.group; + case 2: // Unlisted + return Symbols.link_off; + case 3: // Private + return Symbols.lock; + default: // Public (0) or unknown + return Symbols.public; + } +} + +// Helper method to get the translation key for each visibility status +String _getVisibilityText(int visibility) { + switch (visibility) { + case 1: // Friends + return 'postVisibilityFriends'; + case 2: // Unlisted + return 'postVisibilityUnlisted'; + case 3: // Private + return 'postVisibilityPrivate'; + default: // Public (0) or unknown + return 'postVisibilityPublic'; + } +} diff --git a/lib/widgets/post/post_list.dart b/lib/widgets/post/post_list.dart index 30d8b64..593132f 100644 --- a/lib/widgets/post/post_list.dart +++ b/lib/widgets/post/post_list.dart @@ -4,6 +4,7 @@ import 'package:island/models/post.dart'; import 'package:island/pods/network.dart'; import 'package:island/widgets/content/paging_helper_ext.dart'; import 'package:island/widgets/post/post_item.dart'; +import 'package:island/widgets/post/post_item_creator.dart'; import 'package:riverpod_annotation/riverpod_annotation.dart'; import 'package:riverpod_paging_utils/riverpod_paging_utils.dart'; @@ -46,9 +47,34 @@ class PostListNotifier extends _$PostListNotifier } } +/// Defines which post item widget to use in the list +enum PostItemType { + /// Regular post item with user information + regular, + + /// Creator view with analytics and metadata + creator +} + class SliverPostList extends HookConsumerWidget { final String? pubName; - const SliverPostList({super.key, this.pubName}); + final PostItemType itemType; + final Color? backgroundColor; + final EdgeInsets? padding; + final bool isOpenable; + final Function? onRefresh; + final Function(SnPost)? onUpdate; + + const SliverPostList({ + super.key, + this.pubName, + this.itemType = PostItemType.regular, + this.backgroundColor, + this.padding, + this.isOpenable = true, + this.onRefresh, + this.onUpdate, + }); @override Widget build(BuildContext context, WidgetRef ref) { @@ -63,10 +89,12 @@ class SliverPostList extends HookConsumerWidget { if (index == widgetCount - 1) { return endItemView; } - + + final post = data.items[index]; + return Column( children: [ - PostItem(item: data.items[index]), + _buildPostItem(post), const Divider(height: 1), ], ); @@ -74,4 +102,21 @@ class SliverPostList extends HookConsumerWidget { ), ); } + + Widget _buildPostItem(SnPost post) { + switch (itemType) { + case PostItemType.creator: + return PostItemCreator( + item: post, + backgroundColor: backgroundColor, + padding: padding, + isOpenable: isOpenable, + onRefresh: onRefresh, + onUpdate: onUpdate, + ); + case PostItemType.regular: + default: + return PostItem(item: post); + } + } }