Publisher profile basis

This commit is contained in:
LittleSheep 2025-05-14 00:49:54 +08:00
parent 610b924daf
commit 70f58259de
8 changed files with 632 additions and 158 deletions

View File

@ -35,6 +35,10 @@ class AppRouter extends RootStackRouter {
path: '/account/me/publishers/:id/edit', path: '/account/me/publishers/:id/edit',
), ),
AutoRoute(page: AccountProfileRoute.page, path: '/account/:name'), AutoRoute(page: AccountProfileRoute.page, path: '/account/:name'),
AutoRoute(
page: PublisherProfileRoute.page,
path: '/account/:name/calendar',
),
AutoRoute(page: PostComposeRoute.page, path: '/posts/compose'), AutoRoute(page: PostComposeRoute.page, path: '/posts/compose'),
AutoRoute(page: PostDetailRoute.page, path: '/posts/:id'), AutoRoute(page: PostDetailRoute.page, path: '/posts/:id'),
AutoRoute(page: PostEditRoute.page, path: '/posts/:id/edit'), AutoRoute(page: PostEditRoute.page, path: '/posts/:id/edit'),

View File

@ -9,18 +9,18 @@
// coverage:ignore-file // coverage:ignore-file
// ignore_for_file: no_leading_underscores_for_library_prefixes // ignore_for_file: no_leading_underscores_for_library_prefixes
import 'package:auto_route/auto_route.dart' as _i22; import 'package:auto_route/auto_route.dart' as _i23;
import 'package:flutter/material.dart' as _i23; import 'package:flutter/material.dart' as _i24;
import 'package:island/models/post.dart' as _i24; import 'package:island/models/post.dart' as _i25;
import 'package:island/screens/account.dart' as _i2; import 'package:island/screens/account.dart' as _i2;
import 'package:island/screens/account/me.dart' as _i15; import 'package:island/screens/account/me.dart' as _i15;
import 'package:island/screens/account/me/event_calendar.dart' as _i14; import 'package:island/screens/account/me/event_calendar.dart' as _i14;
import 'package:island/screens/account/me/publishers.dart' as _i8; import 'package:island/screens/account/me/publishers.dart' as _i8;
import 'package:island/screens/account/me/update.dart' as _i21; import 'package:island/screens/account/me/update.dart' as _i22;
import 'package:island/screens/account/profile.dart' as _i1; import 'package:island/screens/account/profile.dart' as _i1;
import 'package:island/screens/auth/create_account.dart' as _i6; import 'package:island/screens/auth/create_account.dart' as _i6;
import 'package:island/screens/auth/login.dart' as _i13; import 'package:island/screens/auth/login.dart' as _i13;
import 'package:island/screens/auth/tabs.dart' as _i20; import 'package:island/screens/auth/tabs.dart' as _i21;
import 'package:island/screens/chat/chat.dart' as _i4; import 'package:island/screens/chat/chat.dart' as _i4;
import 'package:island/screens/chat/room.dart' as _i5; import 'package:island/screens/chat/room.dart' as _i5;
import 'package:island/screens/chat/room_detail.dart' as _i3; import 'package:island/screens/chat/room_detail.dart' as _i3;
@ -30,17 +30,18 @@ import 'package:island/screens/creators/stickers/stickers.dart' as _i10;
import 'package:island/screens/explore.dart' as _i12; import 'package:island/screens/explore.dart' as _i12;
import 'package:island/screens/posts/compose.dart' as _i16; import 'package:island/screens/posts/compose.dart' as _i16;
import 'package:island/screens/posts/detail.dart' as _i17; import 'package:island/screens/posts/detail.dart' as _i17;
import 'package:island/screens/realm/detail.dart' as _i18; import 'package:island/screens/posts/pub_profile.dart' as _i18;
import 'package:island/screens/realm/detail.dart' as _i19;
import 'package:island/screens/realm/realms.dart' as _i9; import 'package:island/screens/realm/realms.dart' as _i9;
import 'package:island/screens/settings.dart' as _i19; import 'package:island/screens/settings.dart' as _i20;
/// generated route for /// generated route for
/// [_i1.AccountProfileScreen] /// [_i1.AccountProfileScreen]
class AccountProfileRoute extends _i22.PageRouteInfo<AccountProfileRouteArgs> { class AccountProfileRoute extends _i23.PageRouteInfo<AccountProfileRouteArgs> {
AccountProfileRoute({ AccountProfileRoute({
_i23.Key? key, _i24.Key? key,
required String name, required String name,
List<_i22.PageRouteInfo>? children, List<_i23.PageRouteInfo>? children,
}) : super( }) : super(
AccountProfileRoute.name, AccountProfileRoute.name,
args: AccountProfileRouteArgs(key: key, name: name), args: AccountProfileRouteArgs(key: key, name: name),
@ -50,7 +51,7 @@ class AccountProfileRoute extends _i22.PageRouteInfo<AccountProfileRouteArgs> {
static const String name = 'AccountProfileRoute'; static const String name = 'AccountProfileRoute';
static _i22.PageInfo page = _i22.PageInfo( static _i23.PageInfo page = _i23.PageInfo(
name, name,
builder: (data) { builder: (data) {
final pathParams = data.inheritedPathParams; final pathParams = data.inheritedPathParams;
@ -66,7 +67,7 @@ class AccountProfileRoute extends _i22.PageRouteInfo<AccountProfileRouteArgs> {
class AccountProfileRouteArgs { class AccountProfileRouteArgs {
const AccountProfileRouteArgs({this.key, required this.name}); const AccountProfileRouteArgs({this.key, required this.name});
final _i23.Key? key; final _i24.Key? key;
final String name; final String name;
@ -78,13 +79,13 @@ class AccountProfileRouteArgs {
/// generated route for /// generated route for
/// [_i2.AccountScreen] /// [_i2.AccountScreen]
class AccountRoute extends _i22.PageRouteInfo<void> { class AccountRoute extends _i23.PageRouteInfo<void> {
const AccountRoute({List<_i22.PageRouteInfo>? children}) const AccountRoute({List<_i23.PageRouteInfo>? children})
: super(AccountRoute.name, initialChildren: children); : super(AccountRoute.name, initialChildren: children);
static const String name = 'AccountRoute'; static const String name = 'AccountRoute';
static _i22.PageInfo page = _i22.PageInfo( static _i23.PageInfo page = _i23.PageInfo(
name, name,
builder: (data) { builder: (data) {
return const _i2.AccountScreen(); return const _i2.AccountScreen();
@ -94,11 +95,11 @@ class AccountRoute extends _i22.PageRouteInfo<void> {
/// generated route for /// generated route for
/// [_i3.ChatDetailScreen] /// [_i3.ChatDetailScreen]
class ChatDetailRoute extends _i22.PageRouteInfo<ChatDetailRouteArgs> { class ChatDetailRoute extends _i23.PageRouteInfo<ChatDetailRouteArgs> {
ChatDetailRoute({ ChatDetailRoute({
_i23.Key? key, _i24.Key? key,
required int id, required int id,
List<_i22.PageRouteInfo>? children, List<_i23.PageRouteInfo>? children,
}) : super( }) : super(
ChatDetailRoute.name, ChatDetailRoute.name,
args: ChatDetailRouteArgs(key: key, id: id), args: ChatDetailRouteArgs(key: key, id: id),
@ -108,7 +109,7 @@ class ChatDetailRoute extends _i22.PageRouteInfo<ChatDetailRouteArgs> {
static const String name = 'ChatDetailRoute'; static const String name = 'ChatDetailRoute';
static _i22.PageInfo page = _i22.PageInfo( static _i23.PageInfo page = _i23.PageInfo(
name, name,
builder: (data) { builder: (data) {
final pathParams = data.inheritedPathParams; final pathParams = data.inheritedPathParams;
@ -123,7 +124,7 @@ class ChatDetailRoute extends _i22.PageRouteInfo<ChatDetailRouteArgs> {
class ChatDetailRouteArgs { class ChatDetailRouteArgs {
const ChatDetailRouteArgs({this.key, required this.id}); const ChatDetailRouteArgs({this.key, required this.id});
final _i23.Key? key; final _i24.Key? key;
final int id; final int id;
@ -135,13 +136,13 @@ class ChatDetailRouteArgs {
/// generated route for /// generated route for
/// [_i4.ChatListScreen] /// [_i4.ChatListScreen]
class ChatListRoute extends _i22.PageRouteInfo<void> { class ChatListRoute extends _i23.PageRouteInfo<void> {
const ChatListRoute({List<_i22.PageRouteInfo>? children}) const ChatListRoute({List<_i23.PageRouteInfo>? children})
: super(ChatListRoute.name, initialChildren: children); : super(ChatListRoute.name, initialChildren: children);
static const String name = 'ChatListRoute'; static const String name = 'ChatListRoute';
static _i22.PageInfo page = _i22.PageInfo( static _i23.PageInfo page = _i23.PageInfo(
name, name,
builder: (data) { builder: (data) {
return const _i4.ChatListScreen(); return const _i4.ChatListScreen();
@ -151,11 +152,11 @@ class ChatListRoute extends _i22.PageRouteInfo<void> {
/// generated route for /// generated route for
/// [_i5.ChatRoomScreen] /// [_i5.ChatRoomScreen]
class ChatRoomRoute extends _i22.PageRouteInfo<ChatRoomRouteArgs> { class ChatRoomRoute extends _i23.PageRouteInfo<ChatRoomRouteArgs> {
ChatRoomRoute({ ChatRoomRoute({
_i23.Key? key, _i24.Key? key,
required int id, required int id,
List<_i22.PageRouteInfo>? children, List<_i23.PageRouteInfo>? children,
}) : super( }) : super(
ChatRoomRoute.name, ChatRoomRoute.name,
args: ChatRoomRouteArgs(key: key, id: id), args: ChatRoomRouteArgs(key: key, id: id),
@ -165,7 +166,7 @@ class ChatRoomRoute extends _i22.PageRouteInfo<ChatRoomRouteArgs> {
static const String name = 'ChatRoomRoute'; static const String name = 'ChatRoomRoute';
static _i22.PageInfo page = _i22.PageInfo( static _i23.PageInfo page = _i23.PageInfo(
name, name,
builder: (data) { builder: (data) {
final pathParams = data.inheritedPathParams; final pathParams = data.inheritedPathParams;
@ -180,7 +181,7 @@ class ChatRoomRoute extends _i22.PageRouteInfo<ChatRoomRouteArgs> {
class ChatRoomRouteArgs { class ChatRoomRouteArgs {
const ChatRoomRouteArgs({this.key, required this.id}); const ChatRoomRouteArgs({this.key, required this.id});
final _i23.Key? key; final _i24.Key? key;
final int id; final int id;
@ -192,13 +193,13 @@ class ChatRoomRouteArgs {
/// generated route for /// generated route for
/// [_i6.CreateAccountScreen] /// [_i6.CreateAccountScreen]
class CreateAccountRoute extends _i22.PageRouteInfo<void> { class CreateAccountRoute extends _i23.PageRouteInfo<void> {
const CreateAccountRoute({List<_i22.PageRouteInfo>? children}) const CreateAccountRoute({List<_i23.PageRouteInfo>? children})
: super(CreateAccountRoute.name, initialChildren: children); : super(CreateAccountRoute.name, initialChildren: children);
static const String name = 'CreateAccountRoute'; static const String name = 'CreateAccountRoute';
static _i22.PageInfo page = _i22.PageInfo( static _i23.PageInfo page = _i23.PageInfo(
name, name,
builder: (data) { builder: (data) {
return const _i6.CreateAccountScreen(); return const _i6.CreateAccountScreen();
@ -208,13 +209,13 @@ class CreateAccountRoute extends _i22.PageRouteInfo<void> {
/// generated route for /// generated route for
/// [_i7.CreatorHubScreen] /// [_i7.CreatorHubScreen]
class CreatorHubRoute extends _i22.PageRouteInfo<void> { class CreatorHubRoute extends _i23.PageRouteInfo<void> {
const CreatorHubRoute({List<_i22.PageRouteInfo>? children}) const CreatorHubRoute({List<_i23.PageRouteInfo>? children})
: super(CreatorHubRoute.name, initialChildren: children); : super(CreatorHubRoute.name, initialChildren: children);
static const String name = 'CreatorHubRoute'; static const String name = 'CreatorHubRoute';
static _i22.PageInfo page = _i22.PageInfo( static _i23.PageInfo page = _i23.PageInfo(
name, name,
builder: (data) { builder: (data) {
return const _i7.CreatorHubScreen(); return const _i7.CreatorHubScreen();
@ -224,8 +225,8 @@ class CreatorHubRoute extends _i22.PageRouteInfo<void> {
/// generated route for /// generated route for
/// [_i4.EditChatScreen] /// [_i4.EditChatScreen]
class EditChatRoute extends _i22.PageRouteInfo<EditChatRouteArgs> { class EditChatRoute extends _i23.PageRouteInfo<EditChatRouteArgs> {
EditChatRoute({_i23.Key? key, int? id, List<_i22.PageRouteInfo>? children}) EditChatRoute({_i24.Key? key, int? id, List<_i23.PageRouteInfo>? children})
: super( : super(
EditChatRoute.name, EditChatRoute.name,
args: EditChatRouteArgs(key: key, id: id), args: EditChatRouteArgs(key: key, id: id),
@ -235,7 +236,7 @@ class EditChatRoute extends _i22.PageRouteInfo<EditChatRouteArgs> {
static const String name = 'EditChatRoute'; static const String name = 'EditChatRoute';
static _i22.PageInfo page = _i22.PageInfo( static _i23.PageInfo page = _i23.PageInfo(
name, name,
builder: (data) { builder: (data) {
final pathParams = data.inheritedPathParams; final pathParams = data.inheritedPathParams;
@ -250,7 +251,7 @@ class EditChatRoute extends _i22.PageRouteInfo<EditChatRouteArgs> {
class EditChatRouteArgs { class EditChatRouteArgs {
const EditChatRouteArgs({this.key, this.id}); const EditChatRouteArgs({this.key, this.id});
final _i23.Key? key; final _i24.Key? key;
final int? id; final int? id;
@ -262,11 +263,11 @@ class EditChatRouteArgs {
/// generated route for /// generated route for
/// [_i8.EditPublisherScreen] /// [_i8.EditPublisherScreen]
class EditPublisherRoute extends _i22.PageRouteInfo<EditPublisherRouteArgs> { class EditPublisherRoute extends _i23.PageRouteInfo<EditPublisherRouteArgs> {
EditPublisherRoute({ EditPublisherRoute({
_i23.Key? key, _i24.Key? key,
String? name, String? name,
List<_i22.PageRouteInfo>? children, List<_i23.PageRouteInfo>? children,
}) : super( }) : super(
EditPublisherRoute.name, EditPublisherRoute.name,
args: EditPublisherRouteArgs(key: key, name: name), args: EditPublisherRouteArgs(key: key, name: name),
@ -276,7 +277,7 @@ class EditPublisherRoute extends _i22.PageRouteInfo<EditPublisherRouteArgs> {
static const String name = 'EditPublisherRoute'; static const String name = 'EditPublisherRoute';
static _i22.PageInfo page = _i22.PageInfo( static _i23.PageInfo page = _i23.PageInfo(
name, name,
builder: (data) { builder: (data) {
final pathParams = data.inheritedPathParams; final pathParams = data.inheritedPathParams;
@ -291,7 +292,7 @@ class EditPublisherRoute extends _i22.PageRouteInfo<EditPublisherRouteArgs> {
class EditPublisherRouteArgs { class EditPublisherRouteArgs {
const EditPublisherRouteArgs({this.key, this.name}); const EditPublisherRouteArgs({this.key, this.name});
final _i23.Key? key; final _i24.Key? key;
final String? name; final String? name;
@ -303,11 +304,11 @@ class EditPublisherRouteArgs {
/// generated route for /// generated route for
/// [_i9.EditRealmScreen] /// [_i9.EditRealmScreen]
class EditRealmRoute extends _i22.PageRouteInfo<EditRealmRouteArgs> { class EditRealmRoute extends _i23.PageRouteInfo<EditRealmRouteArgs> {
EditRealmRoute({ EditRealmRoute({
_i23.Key? key, _i24.Key? key,
String? slug, String? slug,
List<_i22.PageRouteInfo>? children, List<_i23.PageRouteInfo>? children,
}) : super( }) : super(
EditRealmRoute.name, EditRealmRoute.name,
args: EditRealmRouteArgs(key: key, slug: slug), args: EditRealmRouteArgs(key: key, slug: slug),
@ -317,7 +318,7 @@ class EditRealmRoute extends _i22.PageRouteInfo<EditRealmRouteArgs> {
static const String name = 'EditRealmRoute'; static const String name = 'EditRealmRoute';
static _i22.PageInfo page = _i22.PageInfo( static _i23.PageInfo page = _i23.PageInfo(
name, name,
builder: (data) { builder: (data) {
final pathParams = data.inheritedPathParams; final pathParams = data.inheritedPathParams;
@ -332,7 +333,7 @@ class EditRealmRoute extends _i22.PageRouteInfo<EditRealmRouteArgs> {
class EditRealmRouteArgs { class EditRealmRouteArgs {
const EditRealmRouteArgs({this.key, this.slug}); const EditRealmRouteArgs({this.key, this.slug});
final _i23.Key? key; final _i24.Key? key;
final String? slug; final String? slug;
@ -345,12 +346,12 @@ class EditRealmRouteArgs {
/// generated route for /// generated route for
/// [_i10.EditStickerPacksScreen] /// [_i10.EditStickerPacksScreen]
class EditStickerPacksRoute class EditStickerPacksRoute
extends _i22.PageRouteInfo<EditStickerPacksRouteArgs> { extends _i23.PageRouteInfo<EditStickerPacksRouteArgs> {
EditStickerPacksRoute({ EditStickerPacksRoute({
_i23.Key? key, _i24.Key? key,
required String pubName, required String pubName,
String? packId, String? packId,
List<_i22.PageRouteInfo>? children, List<_i23.PageRouteInfo>? children,
}) : super( }) : super(
EditStickerPacksRoute.name, EditStickerPacksRoute.name,
args: EditStickerPacksRouteArgs( args: EditStickerPacksRouteArgs(
@ -364,7 +365,7 @@ class EditStickerPacksRoute
static const String name = 'EditStickerPacksRoute'; static const String name = 'EditStickerPacksRoute';
static _i22.PageInfo page = _i22.PageInfo( static _i23.PageInfo page = _i23.PageInfo(
name, name,
builder: (data) { builder: (data) {
final pathParams = data.inheritedPathParams; final pathParams = data.inheritedPathParams;
@ -391,7 +392,7 @@ class EditStickerPacksRouteArgs {
this.packId, this.packId,
}); });
final _i23.Key? key; final _i24.Key? key;
final String pubName; final String pubName;
@ -405,12 +406,12 @@ class EditStickerPacksRouteArgs {
/// generated route for /// generated route for
/// [_i11.EditStickersScreen] /// [_i11.EditStickersScreen]
class EditStickersRoute extends _i22.PageRouteInfo<EditStickersRouteArgs> { class EditStickersRoute extends _i23.PageRouteInfo<EditStickersRouteArgs> {
EditStickersRoute({ EditStickersRoute({
_i23.Key? key, _i24.Key? key,
required String packId, required String packId,
required String? id, required String? id,
List<_i22.PageRouteInfo>? children, List<_i23.PageRouteInfo>? children,
}) : super( }) : super(
EditStickersRoute.name, EditStickersRoute.name,
args: EditStickersRouteArgs(key: key, packId: packId, id: id), args: EditStickersRouteArgs(key: key, packId: packId, id: id),
@ -420,7 +421,7 @@ class EditStickersRoute extends _i22.PageRouteInfo<EditStickersRouteArgs> {
static const String name = 'EditStickersRoute'; static const String name = 'EditStickersRoute';
static _i22.PageInfo page = _i22.PageInfo( static _i23.PageInfo page = _i23.PageInfo(
name, name,
builder: (data) { builder: (data) {
final pathParams = data.inheritedPathParams; final pathParams = data.inheritedPathParams;
@ -447,7 +448,7 @@ class EditStickersRouteArgs {
required this.id, required this.id,
}); });
final _i23.Key? key; final _i24.Key? key;
final String packId; final String packId;
@ -461,13 +462,13 @@ class EditStickersRouteArgs {
/// generated route for /// generated route for
/// [_i12.ExploreScreen] /// [_i12.ExploreScreen]
class ExploreRoute extends _i22.PageRouteInfo<void> { class ExploreRoute extends _i23.PageRouteInfo<void> {
const ExploreRoute({List<_i22.PageRouteInfo>? children}) const ExploreRoute({List<_i23.PageRouteInfo>? children})
: super(ExploreRoute.name, initialChildren: children); : super(ExploreRoute.name, initialChildren: children);
static const String name = 'ExploreRoute'; static const String name = 'ExploreRoute';
static _i22.PageInfo page = _i22.PageInfo( static _i23.PageInfo page = _i23.PageInfo(
name, name,
builder: (data) { builder: (data) {
return const _i12.ExploreScreen(); return const _i12.ExploreScreen();
@ -477,13 +478,13 @@ class ExploreRoute extends _i22.PageRouteInfo<void> {
/// generated route for /// generated route for
/// [_i13.LoginScreen] /// [_i13.LoginScreen]
class LoginRoute extends _i22.PageRouteInfo<void> { class LoginRoute extends _i23.PageRouteInfo<void> {
const LoginRoute({List<_i22.PageRouteInfo>? children}) const LoginRoute({List<_i23.PageRouteInfo>? children})
: super(LoginRoute.name, initialChildren: children); : super(LoginRoute.name, initialChildren: children);
static const String name = 'LoginRoute'; static const String name = 'LoginRoute';
static _i22.PageInfo page = _i22.PageInfo( static _i23.PageInfo page = _i23.PageInfo(
name, name,
builder: (data) { builder: (data) {
return const _i13.LoginScreen(); return const _i13.LoginScreen();
@ -493,13 +494,13 @@ class LoginRoute extends _i22.PageRouteInfo<void> {
/// generated route for /// generated route for
/// [_i8.ManagedPublisherScreen] /// [_i8.ManagedPublisherScreen]
class ManagedPublisherRoute extends _i22.PageRouteInfo<void> { class ManagedPublisherRoute extends _i23.PageRouteInfo<void> {
const ManagedPublisherRoute({List<_i22.PageRouteInfo>? children}) const ManagedPublisherRoute({List<_i23.PageRouteInfo>? children})
: super(ManagedPublisherRoute.name, initialChildren: children); : super(ManagedPublisherRoute.name, initialChildren: children);
static const String name = 'ManagedPublisherRoute'; static const String name = 'ManagedPublisherRoute';
static _i22.PageInfo page = _i22.PageInfo( static _i23.PageInfo page = _i23.PageInfo(
name, name,
builder: (data) { builder: (data) {
return const _i8.ManagedPublisherScreen(); return const _i8.ManagedPublisherScreen();
@ -509,13 +510,13 @@ class ManagedPublisherRoute extends _i22.PageRouteInfo<void> {
/// generated route for /// generated route for
/// [_i14.MyselfEventCalendarScreen] /// [_i14.MyselfEventCalendarScreen]
class MyselfEventCalendarRoute extends _i22.PageRouteInfo<void> { class MyselfEventCalendarRoute extends _i23.PageRouteInfo<void> {
const MyselfEventCalendarRoute({List<_i22.PageRouteInfo>? children}) const MyselfEventCalendarRoute({List<_i23.PageRouteInfo>? children})
: super(MyselfEventCalendarRoute.name, initialChildren: children); : super(MyselfEventCalendarRoute.name, initialChildren: children);
static const String name = 'MyselfEventCalendarRoute'; static const String name = 'MyselfEventCalendarRoute';
static _i22.PageInfo page = _i22.PageInfo( static _i23.PageInfo page = _i23.PageInfo(
name, name,
builder: (data) { builder: (data) {
return const _i14.MyselfEventCalendarScreen(); return const _i14.MyselfEventCalendarScreen();
@ -525,13 +526,13 @@ class MyselfEventCalendarRoute extends _i22.PageRouteInfo<void> {
/// generated route for /// generated route for
/// [_i15.MyselfProfileScreen] /// [_i15.MyselfProfileScreen]
class MyselfProfileRoute extends _i22.PageRouteInfo<void> { class MyselfProfileRoute extends _i23.PageRouteInfo<void> {
const MyselfProfileRoute({List<_i22.PageRouteInfo>? children}) const MyselfProfileRoute({List<_i23.PageRouteInfo>? children})
: super(MyselfProfileRoute.name, initialChildren: children); : super(MyselfProfileRoute.name, initialChildren: children);
static const String name = 'MyselfProfileRoute'; static const String name = 'MyselfProfileRoute';
static _i22.PageInfo page = _i22.PageInfo( static _i23.PageInfo page = _i23.PageInfo(
name, name,
builder: (data) { builder: (data) {
return const _i15.MyselfProfileScreen(); return const _i15.MyselfProfileScreen();
@ -541,13 +542,13 @@ class MyselfProfileRoute extends _i22.PageRouteInfo<void> {
/// generated route for /// generated route for
/// [_i4.NewChatScreen] /// [_i4.NewChatScreen]
class NewChatRoute extends _i22.PageRouteInfo<void> { class NewChatRoute extends _i23.PageRouteInfo<void> {
const NewChatRoute({List<_i22.PageRouteInfo>? children}) const NewChatRoute({List<_i23.PageRouteInfo>? children})
: super(NewChatRoute.name, initialChildren: children); : super(NewChatRoute.name, initialChildren: children);
static const String name = 'NewChatRoute'; static const String name = 'NewChatRoute';
static _i22.PageInfo page = _i22.PageInfo( static _i23.PageInfo page = _i23.PageInfo(
name, name,
builder: (data) { builder: (data) {
return const _i4.NewChatScreen(); return const _i4.NewChatScreen();
@ -557,13 +558,13 @@ class NewChatRoute extends _i22.PageRouteInfo<void> {
/// generated route for /// generated route for
/// [_i8.NewPublisherScreen] /// [_i8.NewPublisherScreen]
class NewPublisherRoute extends _i22.PageRouteInfo<void> { class NewPublisherRoute extends _i23.PageRouteInfo<void> {
const NewPublisherRoute({List<_i22.PageRouteInfo>? children}) const NewPublisherRoute({List<_i23.PageRouteInfo>? children})
: super(NewPublisherRoute.name, initialChildren: children); : super(NewPublisherRoute.name, initialChildren: children);
static const String name = 'NewPublisherRoute'; static const String name = 'NewPublisherRoute';
static _i22.PageInfo page = _i22.PageInfo( static _i23.PageInfo page = _i23.PageInfo(
name, name,
builder: (data) { builder: (data) {
return const _i8.NewPublisherScreen(); return const _i8.NewPublisherScreen();
@ -573,13 +574,13 @@ class NewPublisherRoute extends _i22.PageRouteInfo<void> {
/// generated route for /// generated route for
/// [_i9.NewRealmScreen] /// [_i9.NewRealmScreen]
class NewRealmRoute extends _i22.PageRouteInfo<void> { class NewRealmRoute extends _i23.PageRouteInfo<void> {
const NewRealmRoute({List<_i22.PageRouteInfo>? children}) const NewRealmRoute({List<_i23.PageRouteInfo>? children})
: super(NewRealmRoute.name, initialChildren: children); : super(NewRealmRoute.name, initialChildren: children);
static const String name = 'NewRealmRoute'; static const String name = 'NewRealmRoute';
static _i22.PageInfo page = _i22.PageInfo( static _i23.PageInfo page = _i23.PageInfo(
name, name,
builder: (data) { builder: (data) {
return const _i9.NewRealmScreen(); return const _i9.NewRealmScreen();
@ -590,11 +591,11 @@ class NewRealmRoute extends _i22.PageRouteInfo<void> {
/// generated route for /// generated route for
/// [_i10.NewStickerPacksScreen] /// [_i10.NewStickerPacksScreen]
class NewStickerPacksRoute class NewStickerPacksRoute
extends _i22.PageRouteInfo<NewStickerPacksRouteArgs> { extends _i23.PageRouteInfo<NewStickerPacksRouteArgs> {
NewStickerPacksRoute({ NewStickerPacksRoute({
_i23.Key? key, _i24.Key? key,
required String pubName, required String pubName,
List<_i22.PageRouteInfo>? children, List<_i23.PageRouteInfo>? children,
}) : super( }) : super(
NewStickerPacksRoute.name, NewStickerPacksRoute.name,
args: NewStickerPacksRouteArgs(key: key, pubName: pubName), args: NewStickerPacksRouteArgs(key: key, pubName: pubName),
@ -604,7 +605,7 @@ class NewStickerPacksRoute
static const String name = 'NewStickerPacksRoute'; static const String name = 'NewStickerPacksRoute';
static _i22.PageInfo page = _i22.PageInfo( static _i23.PageInfo page = _i23.PageInfo(
name, name,
builder: (data) { builder: (data) {
final pathParams = data.inheritedPathParams; final pathParams = data.inheritedPathParams;
@ -621,7 +622,7 @@ class NewStickerPacksRoute
class NewStickerPacksRouteArgs { class NewStickerPacksRouteArgs {
const NewStickerPacksRouteArgs({this.key, required this.pubName}); const NewStickerPacksRouteArgs({this.key, required this.pubName});
final _i23.Key? key; final _i24.Key? key;
final String pubName; final String pubName;
@ -633,11 +634,11 @@ class NewStickerPacksRouteArgs {
/// generated route for /// generated route for
/// [_i11.NewStickersScreen] /// [_i11.NewStickersScreen]
class NewStickersRoute extends _i22.PageRouteInfo<NewStickersRouteArgs> { class NewStickersRoute extends _i23.PageRouteInfo<NewStickersRouteArgs> {
NewStickersRoute({ NewStickersRoute({
_i23.Key? key, _i24.Key? key,
required String packId, required String packId,
List<_i22.PageRouteInfo>? children, List<_i23.PageRouteInfo>? children,
}) : super( }) : super(
NewStickersRoute.name, NewStickersRoute.name,
args: NewStickersRouteArgs(key: key, packId: packId), args: NewStickersRouteArgs(key: key, packId: packId),
@ -647,7 +648,7 @@ class NewStickersRoute extends _i22.PageRouteInfo<NewStickersRouteArgs> {
static const String name = 'NewStickersRoute'; static const String name = 'NewStickersRoute';
static _i22.PageInfo page = _i22.PageInfo( static _i23.PageInfo page = _i23.PageInfo(
name, name,
builder: (data) { builder: (data) {
final pathParams = data.inheritedPathParams; final pathParams = data.inheritedPathParams;
@ -663,7 +664,7 @@ class NewStickersRoute extends _i22.PageRouteInfo<NewStickersRouteArgs> {
class NewStickersRouteArgs { class NewStickersRouteArgs {
const NewStickersRouteArgs({this.key, required this.packId}); const NewStickersRouteArgs({this.key, required this.packId});
final _i23.Key? key; final _i24.Key? key;
final String packId; final String packId;
@ -675,11 +676,11 @@ class NewStickersRouteArgs {
/// generated route for /// generated route for
/// [_i16.PostComposeScreen] /// [_i16.PostComposeScreen]
class PostComposeRoute extends _i22.PageRouteInfo<PostComposeRouteArgs> { class PostComposeRoute extends _i23.PageRouteInfo<PostComposeRouteArgs> {
PostComposeRoute({ PostComposeRoute({
_i23.Key? key, _i24.Key? key,
_i24.SnPost? originalPost, _i25.SnPost? originalPost,
List<_i22.PageRouteInfo>? children, List<_i23.PageRouteInfo>? children,
}) : super( }) : super(
PostComposeRoute.name, PostComposeRoute.name,
args: PostComposeRouteArgs(key: key, originalPost: originalPost), args: PostComposeRouteArgs(key: key, originalPost: originalPost),
@ -688,7 +689,7 @@ class PostComposeRoute extends _i22.PageRouteInfo<PostComposeRouteArgs> {
static const String name = 'PostComposeRoute'; static const String name = 'PostComposeRoute';
static _i22.PageInfo page = _i22.PageInfo( static _i23.PageInfo page = _i23.PageInfo(
name, name,
builder: (data) { builder: (data) {
final args = data.argsAs<PostComposeRouteArgs>( final args = data.argsAs<PostComposeRouteArgs>(
@ -705,9 +706,9 @@ class PostComposeRoute extends _i22.PageRouteInfo<PostComposeRouteArgs> {
class PostComposeRouteArgs { class PostComposeRouteArgs {
const PostComposeRouteArgs({this.key, this.originalPost}); const PostComposeRouteArgs({this.key, this.originalPost});
final _i23.Key? key; final _i24.Key? key;
final _i24.SnPost? originalPost; final _i25.SnPost? originalPost;
@override @override
String toString() { String toString() {
@ -717,11 +718,11 @@ class PostComposeRouteArgs {
/// generated route for /// generated route for
/// [_i17.PostDetailScreen] /// [_i17.PostDetailScreen]
class PostDetailRoute extends _i22.PageRouteInfo<PostDetailRouteArgs> { class PostDetailRoute extends _i23.PageRouteInfo<PostDetailRouteArgs> {
PostDetailRoute({ PostDetailRoute({
_i23.Key? key, _i24.Key? key,
required int id, required int id,
List<_i22.PageRouteInfo>? children, List<_i23.PageRouteInfo>? children,
}) : super( }) : super(
PostDetailRoute.name, PostDetailRoute.name,
args: PostDetailRouteArgs(key: key, id: id), args: PostDetailRouteArgs(key: key, id: id),
@ -731,7 +732,7 @@ class PostDetailRoute extends _i22.PageRouteInfo<PostDetailRouteArgs> {
static const String name = 'PostDetailRoute'; static const String name = 'PostDetailRoute';
static _i22.PageInfo page = _i22.PageInfo( static _i23.PageInfo page = _i23.PageInfo(
name, name,
builder: (data) { builder: (data) {
final pathParams = data.inheritedPathParams; final pathParams = data.inheritedPathParams;
@ -746,7 +747,7 @@ class PostDetailRoute extends _i22.PageRouteInfo<PostDetailRouteArgs> {
class PostDetailRouteArgs { class PostDetailRouteArgs {
const PostDetailRouteArgs({this.key, required this.id}); const PostDetailRouteArgs({this.key, required this.id});
final _i23.Key? key; final _i24.Key? key;
final int id; final int id;
@ -758,11 +759,11 @@ class PostDetailRouteArgs {
/// generated route for /// generated route for
/// [_i16.PostEditScreen] /// [_i16.PostEditScreen]
class PostEditRoute extends _i22.PageRouteInfo<PostEditRouteArgs> { class PostEditRoute extends _i23.PageRouteInfo<PostEditRouteArgs> {
PostEditRoute({ PostEditRoute({
_i23.Key? key, _i24.Key? key,
required int id, required int id,
List<_i22.PageRouteInfo>? children, List<_i23.PageRouteInfo>? children,
}) : super( }) : super(
PostEditRoute.name, PostEditRoute.name,
args: PostEditRouteArgs(key: key, id: id), args: PostEditRouteArgs(key: key, id: id),
@ -772,7 +773,7 @@ class PostEditRoute extends _i22.PageRouteInfo<PostEditRouteArgs> {
static const String name = 'PostEditRoute'; static const String name = 'PostEditRoute';
static _i22.PageInfo page = _i22.PageInfo( static _i23.PageInfo page = _i23.PageInfo(
name, name,
builder: (data) { builder: (data) {
final pathParams = data.inheritedPathParams; final pathParams = data.inheritedPathParams;
@ -787,7 +788,7 @@ class PostEditRoute extends _i22.PageRouteInfo<PostEditRouteArgs> {
class PostEditRouteArgs { class PostEditRouteArgs {
const PostEditRouteArgs({this.key, required this.id}); const PostEditRouteArgs({this.key, required this.id});
final _i23.Key? key; final _i24.Key? key;
final int id; final int id;
@ -798,12 +799,55 @@ class PostEditRouteArgs {
} }
/// generated route for /// generated route for
/// [_i18.RealmDetailScreen] /// [_i18.PublisherProfileScreen]
class RealmDetailRoute extends _i22.PageRouteInfo<RealmDetailRouteArgs> { class PublisherProfileRoute
extends _i23.PageRouteInfo<PublisherProfileRouteArgs> {
PublisherProfileRoute({
_i24.Key? key,
required String name,
List<_i23.PageRouteInfo>? children,
}) : super(
PublisherProfileRoute.name,
args: PublisherProfileRouteArgs(key: key, name: name),
rawPathParams: {'name': name},
initialChildren: children,
);
static const String name = 'PublisherProfileRoute';
static _i23.PageInfo page = _i23.PageInfo(
name,
builder: (data) {
final pathParams = data.inheritedPathParams;
final args = data.argsAs<PublisherProfileRouteArgs>(
orElse:
() => PublisherProfileRouteArgs(name: pathParams.getString('name')),
);
return _i18.PublisherProfileScreen(key: args.key, name: args.name);
},
);
}
class PublisherProfileRouteArgs {
const PublisherProfileRouteArgs({this.key, required this.name});
final _i24.Key? key;
final String name;
@override
String toString() {
return 'PublisherProfileRouteArgs{key: $key, name: $name}';
}
}
/// generated route for
/// [_i19.RealmDetailScreen]
class RealmDetailRoute extends _i23.PageRouteInfo<RealmDetailRouteArgs> {
RealmDetailRoute({ RealmDetailRoute({
_i23.Key? key, _i24.Key? key,
required String slug, required String slug,
List<_i22.PageRouteInfo>? children, List<_i23.PageRouteInfo>? children,
}) : super( }) : super(
RealmDetailRoute.name, RealmDetailRoute.name,
args: RealmDetailRouteArgs(key: key, slug: slug), args: RealmDetailRouteArgs(key: key, slug: slug),
@ -813,14 +857,14 @@ class RealmDetailRoute extends _i22.PageRouteInfo<RealmDetailRouteArgs> {
static const String name = 'RealmDetailRoute'; static const String name = 'RealmDetailRoute';
static _i22.PageInfo page = _i22.PageInfo( static _i23.PageInfo page = _i23.PageInfo(
name, name,
builder: (data) { builder: (data) {
final pathParams = data.inheritedPathParams; final pathParams = data.inheritedPathParams;
final args = data.argsAs<RealmDetailRouteArgs>( final args = data.argsAs<RealmDetailRouteArgs>(
orElse: () => RealmDetailRouteArgs(slug: pathParams.getString('slug')), orElse: () => RealmDetailRouteArgs(slug: pathParams.getString('slug')),
); );
return _i18.RealmDetailScreen(key: args.key, slug: args.slug); return _i19.RealmDetailScreen(key: args.key, slug: args.slug);
}, },
); );
} }
@ -828,7 +872,7 @@ class RealmDetailRoute extends _i22.PageRouteInfo<RealmDetailRouteArgs> {
class RealmDetailRouteArgs { class RealmDetailRouteArgs {
const RealmDetailRouteArgs({this.key, required this.slug}); const RealmDetailRouteArgs({this.key, required this.slug});
final _i23.Key? key; final _i24.Key? key;
final String slug; final String slug;
@ -840,13 +884,13 @@ class RealmDetailRouteArgs {
/// generated route for /// generated route for
/// [_i9.RealmListScreen] /// [_i9.RealmListScreen]
class RealmListRoute extends _i22.PageRouteInfo<void> { class RealmListRoute extends _i23.PageRouteInfo<void> {
const RealmListRoute({List<_i22.PageRouteInfo>? children}) const RealmListRoute({List<_i23.PageRouteInfo>? children})
: super(RealmListRoute.name, initialChildren: children); : super(RealmListRoute.name, initialChildren: children);
static const String name = 'RealmListRoute'; static const String name = 'RealmListRoute';
static _i22.PageInfo page = _i22.PageInfo( static _i23.PageInfo page = _i23.PageInfo(
name, name,
builder: (data) { builder: (data) {
return const _i9.RealmListScreen(); return const _i9.RealmListScreen();
@ -855,17 +899,17 @@ class RealmListRoute extends _i22.PageRouteInfo<void> {
} }
/// generated route for /// generated route for
/// [_i19.SettingsScreen] /// [_i20.SettingsScreen]
class SettingsRoute extends _i22.PageRouteInfo<void> { class SettingsRoute extends _i23.PageRouteInfo<void> {
const SettingsRoute({List<_i22.PageRouteInfo>? children}) const SettingsRoute({List<_i23.PageRouteInfo>? children})
: super(SettingsRoute.name, initialChildren: children); : super(SettingsRoute.name, initialChildren: children);
static const String name = 'SettingsRoute'; static const String name = 'SettingsRoute';
static _i22.PageInfo page = _i22.PageInfo( static _i23.PageInfo page = _i23.PageInfo(
name, name,
builder: (data) { builder: (data) {
return const _i19.SettingsScreen(); return const _i20.SettingsScreen();
}, },
); );
} }
@ -873,12 +917,12 @@ class SettingsRoute extends _i22.PageRouteInfo<void> {
/// generated route for /// generated route for
/// [_i11.StickerPackDetailScreen] /// [_i11.StickerPackDetailScreen]
class StickerPackDetailRoute class StickerPackDetailRoute
extends _i22.PageRouteInfo<StickerPackDetailRouteArgs> { extends _i23.PageRouteInfo<StickerPackDetailRouteArgs> {
StickerPackDetailRoute({ StickerPackDetailRoute({
_i23.Key? key, _i24.Key? key,
required String pubName, required String pubName,
required String id, required String id,
List<_i22.PageRouteInfo>? children, List<_i23.PageRouteInfo>? children,
}) : super( }) : super(
StickerPackDetailRoute.name, StickerPackDetailRoute.name,
args: StickerPackDetailRouteArgs(key: key, pubName: pubName, id: id), args: StickerPackDetailRouteArgs(key: key, pubName: pubName, id: id),
@ -888,7 +932,7 @@ class StickerPackDetailRoute
static const String name = 'StickerPackDetailRoute'; static const String name = 'StickerPackDetailRoute';
static _i22.PageInfo page = _i22.PageInfo( static _i23.PageInfo page = _i23.PageInfo(
name, name,
builder: (data) { builder: (data) {
final pathParams = data.inheritedPathParams; final pathParams = data.inheritedPathParams;
@ -915,7 +959,7 @@ class StickerPackDetailRouteArgs {
required this.id, required this.id,
}); });
final _i23.Key? key; final _i24.Key? key;
final String pubName; final String pubName;
@ -929,11 +973,11 @@ class StickerPackDetailRouteArgs {
/// generated route for /// generated route for
/// [_i10.StickersScreen] /// [_i10.StickersScreen]
class StickersRoute extends _i22.PageRouteInfo<StickersRouteArgs> { class StickersRoute extends _i23.PageRouteInfo<StickersRouteArgs> {
StickersRoute({ StickersRoute({
_i23.Key? key, _i24.Key? key,
required String pubName, required String pubName,
List<_i22.PageRouteInfo>? children, List<_i23.PageRouteInfo>? children,
}) : super( }) : super(
StickersRoute.name, StickersRoute.name,
args: StickersRouteArgs(key: key, pubName: pubName), args: StickersRouteArgs(key: key, pubName: pubName),
@ -943,7 +987,7 @@ class StickersRoute extends _i22.PageRouteInfo<StickersRouteArgs> {
static const String name = 'StickersRoute'; static const String name = 'StickersRoute';
static _i22.PageInfo page = _i22.PageInfo( static _i23.PageInfo page = _i23.PageInfo(
name, name,
builder: (data) { builder: (data) {
final pathParams = data.inheritedPathParams; final pathParams = data.inheritedPathParams;
@ -958,7 +1002,7 @@ class StickersRoute extends _i22.PageRouteInfo<StickersRouteArgs> {
class StickersRouteArgs { class StickersRouteArgs {
const StickersRouteArgs({this.key, required this.pubName}); const StickersRouteArgs({this.key, required this.pubName});
final _i23.Key? key; final _i24.Key? key;
final String pubName; final String pubName;
@ -969,33 +1013,33 @@ class StickersRouteArgs {
} }
/// generated route for /// generated route for
/// [_i20.TabsScreen] /// [_i21.TabsScreen]
class TabsRoute extends _i22.PageRouteInfo<void> { class TabsRoute extends _i23.PageRouteInfo<void> {
const TabsRoute({List<_i22.PageRouteInfo>? children}) const TabsRoute({List<_i23.PageRouteInfo>? children})
: super(TabsRoute.name, initialChildren: children); : super(TabsRoute.name, initialChildren: children);
static const String name = 'TabsRoute'; static const String name = 'TabsRoute';
static _i22.PageInfo page = _i22.PageInfo( static _i23.PageInfo page = _i23.PageInfo(
name, name,
builder: (data) { builder: (data) {
return const _i20.TabsScreen(); return const _i21.TabsScreen();
}, },
); );
} }
/// generated route for /// generated route for
/// [_i21.UpdateProfileScreen] /// [_i22.UpdateProfileScreen]
class UpdateProfileRoute extends _i22.PageRouteInfo<void> { class UpdateProfileRoute extends _i23.PageRouteInfo<void> {
const UpdateProfileRoute({List<_i22.PageRouteInfo>? children}) const UpdateProfileRoute({List<_i23.PageRouteInfo>? children})
: super(UpdateProfileRoute.name, initialChildren: children); : super(UpdateProfileRoute.name, initialChildren: children);
static const String name = 'UpdateProfileRoute'; static const String name = 'UpdateProfileRoute';
static _i22.PageInfo page = _i22.PageInfo( static _i23.PageInfo page = _i23.PageInfo(
name, name,
builder: (data) { builder: (data) {
return const _i21.UpdateProfileScreen(); return const _i22.UpdateProfileScreen();
}, },
); );
} }

View File

@ -272,7 +272,11 @@ class EditPublisherScreen extends HookConsumerWidget {
try { try {
final client = ref.watch(apiClientProvider); final client = ref.watch(apiClientProvider);
final resp = await client.request( final resp = await client.request(
name == null ? '/publishers/individual' : '/publishers/$name', name == null
? currentRealm.value == null
? '/publishers/individual'
: '/publishers/organization/${currentRealm.value!.slug}'
: '/publishers/$name',
data: { data: {
'name': nameController.text, 'name': nameController.text,
'nick': nickController.text, 'nick': nickController.text,

View File

@ -31,7 +31,7 @@ class AccountProfileScreen extends HookConsumerWidget {
@override @override
Widget build(BuildContext context, WidgetRef ref) { Widget build(BuildContext context, WidgetRef ref) {
final accountAsync = ref.watch(accountProvider(name)); final account = ref.watch(accountProvider(name));
final iconShadow = Shadow( final iconShadow = Shadow(
color: Colors.black54, color: Colors.black54,
@ -39,7 +39,7 @@ class AccountProfileScreen extends HookConsumerWidget {
offset: Offset(1.0, 1.0), offset: Offset(1.0, 1.0),
); );
return accountAsync.when( return account.when(
data: data:
(data) => AppScaffold( (data) => AppScaffold(
body: CustomScrollView( body: CustomScrollView(
@ -110,17 +110,16 @@ class AccountProfileScreen extends HookConsumerWidget {
SliverToBoxAdapter( SliverToBoxAdapter(
child: const Divider(height: 1).padding(bottom: 24), child: const Divider(height: 1).padding(bottom: 24),
), ),
SliverToBoxAdapter( if (data.profile.bio != null && data.profile.bio!.isNotEmpty)
child: Column( SliverToBoxAdapter(
crossAxisAlignment: CrossAxisAlignment.stretch, child: Column(
children: [ crossAxisAlignment: CrossAxisAlignment.stretch,
Text('bio').tr().bold(), children: [
if (data.profile.bio != null && Text('bio').tr().bold(),
data.profile.bio!.isNotEmpty)
Text(data.profile.bio!), Text(data.profile.bio!),
], ],
).padding(horizontal: 24), ).padding(horizontal: 24),
), ),
], ],
), ),
), ),

View File

@ -0,0 +1,135 @@
import 'package:auto_route/annotations.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/widgets/account/status.dart';
import 'package:island/widgets/app_scaffold.dart';
import 'package:island/widgets/content/cloud_files.dart';
import 'package:island/widgets/post/post_list.dart';
import 'package:riverpod_annotation/riverpod_annotation.dart';
import 'package:styled_widget/styled_widget.dart';
part 'pub_profile.g.dart';
@riverpod
Future<SnPublisher> publisher(Ref ref, String uname) async {
final apiClient = ref.watch(apiClientProvider);
final resp = await apiClient.get("/publishers/$uname");
return SnPublisher.fromJson(resp.data);
}
@RoutePage()
class PublisherProfileScreen extends HookConsumerWidget {
final String name;
const PublisherProfileScreen({
super.key,
@PathParam("name") required this.name,
});
@override
Widget build(BuildContext context, WidgetRef ref) {
final publisher = ref.watch(publisherProvider(name));
final iconShadow = Shadow(
color: Colors.black54,
blurRadius: 5.0,
offset: Offset(1.0, 1.0),
);
return publisher.when(
data:
(data) => AppScaffold(
body: CustomScrollView(
slivers: [
SliverAppBar(
expandedHeight: 180,
pinned: true,
leading: PageBackButton(shadows: [iconShadow]),
flexibleSpace: FlexibleSpaceBar(
background:
data.backgroundId != null
? CloudImageWidget(fileId: data.backgroundId!)
: Container(
color:
Theme.of(context).appBarTheme.backgroundColor,
),
title: Text(
data.nick,
style: TextStyle(
color: Theme.of(context).appBarTheme.foregroundColor,
shadows: [iconShadow],
),
),
),
),
SliverToBoxAdapter(
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
spacing: 20,
children: [
ProfilePictureWidget(fileId: data.pictureId!, radius: 32),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Row(
spacing: 6,
children: [
Text(data.nick).fontSize(20),
Text(
'@${data.name}',
).fontSize(14).opacity(0.85),
],
),
if (data.publisherType == 0)
AccountStatusWidget(
uname: name,
padding: EdgeInsets.zero,
),
],
),
),
],
).padding(horizontal: 24, top: 24, bottom: 24),
),
// if (data.badges.isNotEmpty)
// SliverToBoxAdapter(
// child: BadgeList(
// badges: data.badges,
// ).padding(horizontal: 24, bottom: 24),
// )
// else
// const Gap(16),
SliverToBoxAdapter(child: const Divider(height: 1)),
if (data.bio.isNotEmpty)
SliverToBoxAdapter(
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [Text('bio').tr().bold(), Text(data.bio)],
).padding(horizontal: 24, top: 24),
),
if (data.bio.isNotEmpty)
SliverToBoxAdapter(
child: const Divider(height: 1).padding(top: 24),
),
SliverPostList(pubName: name),
SliverGap(MediaQuery.of(context).padding.bottom + 16),
],
),
),
error:
(error, stackTrace) => AppScaffold(
appBar: AppBar(leading: const PageBackButton()),
body: Center(child: Text(error.toString())),
),
loading:
() => AppScaffold(
appBar: AppBar(leading: const PageBackButton()),
body: Center(child: CircularProgressIndicator()),
),
);
}
}

View File

@ -0,0 +1,149 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'pub_profile.dart';
// **************************************************************************
// RiverpodGenerator
// **************************************************************************
String _$publisherHash() => r'3a7ae4d48765170aea42c7d6f4502d68f984dfab';
/// Copied from Dart SDK
class _SystemHash {
_SystemHash._();
static int combine(int hash, int value) {
// ignore: parameter_assignments
hash = 0x1fffffff & (hash + value);
// ignore: parameter_assignments
hash = 0x1fffffff & (hash + ((0x0007ffff & hash) << 10));
return hash ^ (hash >> 6);
}
static int finish(int hash) {
// ignore: parameter_assignments
hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3));
// ignore: parameter_assignments
hash = hash ^ (hash >> 11);
return 0x1fffffff & (hash + ((0x00003fff & hash) << 15));
}
}
/// See also [publisher].
@ProviderFor(publisher)
const publisherProvider = PublisherFamily();
/// See also [publisher].
class PublisherFamily extends Family<AsyncValue<SnPublisher>> {
/// See also [publisher].
const PublisherFamily();
/// See also [publisher].
PublisherProvider call(String uname) {
return PublisherProvider(uname);
}
@override
PublisherProvider getProviderOverride(covariant PublisherProvider provider) {
return call(provider.uname);
}
static const Iterable<ProviderOrFamily>? _dependencies = null;
@override
Iterable<ProviderOrFamily>? get dependencies => _dependencies;
static const Iterable<ProviderOrFamily>? _allTransitiveDependencies = null;
@override
Iterable<ProviderOrFamily>? get allTransitiveDependencies =>
_allTransitiveDependencies;
@override
String? get name => r'publisherProvider';
}
/// See also [publisher].
class PublisherProvider extends AutoDisposeFutureProvider<SnPublisher> {
/// See also [publisher].
PublisherProvider(String uname)
: this._internal(
(ref) => publisher(ref as PublisherRef, uname),
from: publisherProvider,
name: r'publisherProvider',
debugGetCreateSourceHash:
const bool.fromEnvironment('dart.vm.product')
? null
: _$publisherHash,
dependencies: PublisherFamily._dependencies,
allTransitiveDependencies: PublisherFamily._allTransitiveDependencies,
uname: uname,
);
PublisherProvider._internal(
super._createNotifier, {
required super.name,
required super.dependencies,
required super.allTransitiveDependencies,
required super.debugGetCreateSourceHash,
required super.from,
required this.uname,
}) : super.internal();
final String uname;
@override
Override overrideWith(
FutureOr<SnPublisher> Function(PublisherRef provider) create,
) {
return ProviderOverride(
origin: this,
override: PublisherProvider._internal(
(ref) => create(ref as PublisherRef),
from: from,
name: null,
dependencies: null,
allTransitiveDependencies: null,
debugGetCreateSourceHash: null,
uname: uname,
),
);
}
@override
AutoDisposeFutureProviderElement<SnPublisher> createElement() {
return _PublisherProviderElement(this);
}
@override
bool operator ==(Object other) {
return other is PublisherProvider && other.uname == uname;
}
@override
int get hashCode {
var hash = _SystemHash.combine(0, runtimeType.hashCode);
hash = _SystemHash.combine(hash, uname.hashCode);
return _SystemHash.finish(hash);
}
}
@Deprecated('Will be removed in 3.0. Use Ref instead')
// ignore: unused_element
mixin PublisherRef on AutoDisposeFutureProviderRef<SnPublisher> {
/// The parameter `uname` of this provider.
String get uname;
}
class _PublisherProviderElement
extends AutoDisposeFutureProviderElement<SnPublisher>
with PublisherRef {
_PublisherProviderElement(super.provider);
@override
String get uname => (origin as PublisherProvider).uname;
}
// ignore_for_file: type=lint
// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package

View File

@ -106,7 +106,16 @@ class PostItem extends HookConsumerWidget {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
spacing: 12, spacing: 12,
children: [ children: [
ProfilePictureWidget(fileId: item.publisher.pictureId), GestureDetector(
child: ProfilePictureWidget(
fileId: item.publisher.pictureId,
),
onTap: () {
context.router.push(
PublisherProfileRoute(name: item.publisher.name),
);
},
),
Expanded( Expanded(
child: GestureDetector( child: GestureDetector(
child: Column( child: Column(

View File

@ -0,0 +1,130 @@
import 'package:flutter/material.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:dio/dio.dart';
import 'package:island/models/post.dart';
import 'package:island/pods/network.dart';
import 'package:island/widgets/post/post_item.dart';
import 'package:styled_widget/styled_widget.dart';
import 'package:very_good_infinite_list/very_good_infinite_list.dart';
// State class to hold posts and pagination info
class PostListState {
final List<SnPost> posts;
final bool isLoading;
final String? error;
final int total;
final bool hasMore;
const PostListState({
this.posts = const [],
this.isLoading = false,
this.error,
this.total = 0,
this.hasMore = true,
});
PostListState copyWith({
List<SnPost>? posts,
bool? isLoading,
String? error,
int? total,
bool? hasMore,
}) {
return PostListState(
posts: posts ?? this.posts,
isLoading: isLoading ?? this.isLoading,
error: error,
total: total ?? this.total,
hasMore: hasMore ?? this.hasMore,
);
}
}
// Provider for managing post list state
final postListProvider =
StateNotifierProvider.family<PostListNotifier, PostListState, String?>((
ref,
pubName,
) {
final dio = ref.watch(apiClientProvider);
return PostListNotifier(dio, pubName);
});
class PostListNotifier extends StateNotifier<PostListState> {
final Dio _dio;
final String? pubName;
static const int _pageSize = 20;
PostListNotifier(this._dio, this.pubName) : super(const PostListState()) {
loadInitialPosts();
}
Future<void> loadInitialPosts() async {
state = state.copyWith(isLoading: true, error: null);
try {
final result = await _fetchPosts(0);
state = PostListState(
posts: result.posts,
total: result.total,
hasMore: result.posts.length < result.total,
isLoading: false,
);
} catch (e) {
state = state.copyWith(isLoading: false, error: e.toString());
}
}
Future<void> loadMorePosts() async {
if (state.isLoading || !state.hasMore) return;
state = state.copyWith(isLoading: true, error: null);
try {
final result = await _fetchPosts(state.posts.length);
state = state.copyWith(
posts: [...state.posts, ...result.posts],
total: result.total,
hasMore: state.posts.length + result.posts.length < result.total,
isLoading: false,
);
} catch (e) {
state = state.copyWith(isLoading: false, error: e.toString());
}
}
Future<({List<SnPost> posts, int total})> _fetchPosts(int offset) async {
final queryParams = {
'offset': offset,
'take': _pageSize,
if (pubName != null) 'pub': pubName,
};
final response = await _dio.get('/posts', queryParameters: queryParams);
final total = int.parse(response.headers.value('X-Total') ?? '0');
final List<dynamic> data = response.data;
final posts = data.map((json) => SnPost.fromJson(json)).toList();
return (posts: posts, total: total);
}
}
class SliverPostList extends HookConsumerWidget {
final String? pubName;
const SliverPostList({super.key, this.pubName});
@override
Widget build(BuildContext context, WidgetRef ref) {
final state = ref.watch(postListProvider(pubName));
final notifier = ref.read(postListProvider(pubName).notifier);
return SliverInfiniteList(
onFetchData: notifier.loadMorePosts,
itemCount: state.posts.length,
hasReachedMax: !state.hasMore,
isLoading: state.isLoading,
itemBuilder: (context, index) {
return PostItem(item: state.posts[index]);
},
separatorBuilder: (_, __) => const Divider(height: 1),
);
}
}