Compare commits
No commits in common. "edd86eda776d47c75efdc80182b321fdd705bc4f" and "30184d08b100bfc7927b07b9acec36bf615dc65d" have entirely different histories.
edd86eda77
...
30184d08b1
@ -626,7 +626,6 @@
|
|||||||
"realmJoin": "Join Realm",
|
"realmJoin": "Join Realm",
|
||||||
"realmCommunityHint": "This realm is a community realm, you can freely join.",
|
"realmCommunityHint": "This realm is a community realm, you can freely join.",
|
||||||
"realmCommunityPublicChannelsHint": "The public channels in this realm",
|
"realmCommunityPublicChannelsHint": "The public channels in this realm",
|
||||||
"realmCommunityPublishersHint": "The publishers in this realm",
|
|
||||||
"realmJoined": "Joined realm {}.",
|
"realmJoined": "Joined realm {}.",
|
||||||
"join": "Join",
|
"join": "Join",
|
||||||
"pollEditorNew": "New Poll",
|
"pollEditorNew": "New Poll",
|
||||||
@ -672,8 +671,5 @@
|
|||||||
"attachmentBillingDiscount": "Free space",
|
"attachmentBillingDiscount": "Free space",
|
||||||
"attachmentBillingRatio": "Usage",
|
"attachmentBillingRatio": "Usage",
|
||||||
"attachmentBillingHint": "Sliding Window Pricing®\nFees will only apply if the size of the file uploaded within 24 hours exceeds the free space.",
|
"attachmentBillingHint": "Sliding Window Pricing®\nFees will only apply if the size of the file uploaded within 24 hours exceeds the free space.",
|
||||||
"postThumbnail": "Post Thumbnail",
|
"postThumbnail": "Post Thumbnail"
|
||||||
"accountRealms": "Realms",
|
|
||||||
"postInGlobal": "Global",
|
|
||||||
"postInGlobalDescription": "Do not link this post with any realm."
|
|
||||||
}
|
}
|
||||||
|
@ -625,7 +625,6 @@
|
|||||||
"realmJoin": "加入领域",
|
"realmJoin": "加入领域",
|
||||||
"realmCommunityHint": "该领域是一个社区领域,你可以自由加入。",
|
"realmCommunityHint": "该领域是一个社区领域,你可以自由加入。",
|
||||||
"realmCommunityPublicChannelsHint": "该领域包含的公共频道",
|
"realmCommunityPublicChannelsHint": "该领域包含的公共频道",
|
||||||
"realmCommunityPublishersHint": "该领域的发布者",
|
|
||||||
"realmJoined": "已加入领域 {}。",
|
"realmJoined": "已加入领域 {}。",
|
||||||
"join": "加入",
|
"join": "加入",
|
||||||
"pollEditorNew": "新投票",
|
"pollEditorNew": "新投票",
|
||||||
@ -670,8 +669,5 @@
|
|||||||
"attachmentBillingUploaded": "已占用的字节数",
|
"attachmentBillingUploaded": "已占用的字节数",
|
||||||
"attachmentBillingDiscount": "免费的字节数",
|
"attachmentBillingDiscount": "免费的字节数",
|
||||||
"attachmentBillingHint": "滑动窗口计价®\n在24小时内上传的文件大小超出免费空间才会适用扣费。",
|
"attachmentBillingHint": "滑动窗口计价®\n在24小时内上传的文件大小超出免费空间才会适用扣费。",
|
||||||
"postThumbnail": "帖子缩略图",
|
"postThumbnail": "帖子缩略图"
|
||||||
"accountRealms": "领域",
|
|
||||||
"postInGlobal": "全站",
|
|
||||||
"postInGlobalDescription": "不关联此帖子与任何领域。"
|
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,6 @@ import 'package:surface/providers/sn_network.dart';
|
|||||||
import 'package:surface/types/attachment.dart';
|
import 'package:surface/types/attachment.dart';
|
||||||
import 'package:surface/types/poll.dart';
|
import 'package:surface/types/poll.dart';
|
||||||
import 'package:surface/types/post.dart';
|
import 'package:surface/types/post.dart';
|
||||||
import 'package:surface/types/realm.dart';
|
|
||||||
import 'package:surface/widgets/dialog.dart';
|
import 'package:surface/widgets/dialog.dart';
|
||||||
import 'package:surface/widgets/universal_image.dart';
|
import 'package:surface/widgets/universal_image.dart';
|
||||||
import 'package:video_compress/video_compress.dart';
|
import 'package:video_compress/video_compress.dart';
|
||||||
@ -198,7 +197,6 @@ class PostWriteController extends ChangeNotifier {
|
|||||||
bool isLoading = false, isBusy = false;
|
bool isLoading = false, isBusy = false;
|
||||||
double? progress;
|
double? progress;
|
||||||
|
|
||||||
SnRealm? realm;
|
|
||||||
SnPublisher? publisher;
|
SnPublisher? publisher;
|
||||||
SnPost? editingPost, repostingPost, replyingPost;
|
SnPost? editingPost, repostingPost, replyingPost;
|
||||||
|
|
||||||
@ -247,9 +245,6 @@ class PostWriteController extends ChangeNotifier {
|
|||||||
if (post.preload?.thumbnail != null && (post.preload?.thumbnail?.rid.isNotEmpty ?? false)) {
|
if (post.preload?.thumbnail != null && (post.preload?.thumbnail?.rid.isNotEmpty ?? false)) {
|
||||||
thumbnail = PostWriteMedia(post.preload!.thumbnail);
|
thumbnail = PostWriteMedia(post.preload!.thumbnail);
|
||||||
}
|
}
|
||||||
if (post.preload?.realm != null) {
|
|
||||||
realm = post.preload!.realm!;
|
|
||||||
}
|
|
||||||
|
|
||||||
editingPost = post;
|
editingPost = post;
|
||||||
}
|
}
|
||||||
@ -385,7 +380,6 @@ class PostWriteController extends ChangeNotifier {
|
|||||||
if (replyingPost != null) 'reply_to': replyingPost!.toJson(),
|
if (replyingPost != null) 'reply_to': replyingPost!.toJson(),
|
||||||
if (repostingPost != null) 'repost_to': repostingPost!.toJson(),
|
if (repostingPost != null) 'repost_to': repostingPost!.toJson(),
|
||||||
if (poll != null) 'poll': poll!.toJson(),
|
if (poll != null) 'poll': poll!.toJson(),
|
||||||
if (realm != null) 'realm': realm!.toJson(),
|
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
@ -416,7 +410,6 @@ class PostWriteController extends ChangeNotifier {
|
|||||||
replyingPost = data['reply_to'] != null ? SnPost.fromJson(data['reply_to']) : null;
|
replyingPost = data['reply_to'] != null ? SnPost.fromJson(data['reply_to']) : null;
|
||||||
repostingPost = data['repost_to'] != null ? SnPost.fromJson(data['repost_to']) : null;
|
repostingPost = data['repost_to'] != null ? SnPost.fromJson(data['repost_to']) : null;
|
||||||
poll = data['poll'] != null ? SnPoll.fromJson(data['poll']) : null;
|
poll = data['poll'] != null ? SnPoll.fromJson(data['poll']) : null;
|
||||||
realm = data['realm'] != null ? SnRealm.fromJson(data['realm']) : null;
|
|
||||||
temporaryRestored = true;
|
temporaryRestored = true;
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
});
|
});
|
||||||
@ -533,7 +526,6 @@ class PostWriteController extends ChangeNotifier {
|
|||||||
if (reward != null) 'reward': reward,
|
if (reward != null) 'reward': reward,
|
||||||
if (videoAttachment != null) 'video': videoAttachment!.rid,
|
if (videoAttachment != null) 'video': videoAttachment!.rid,
|
||||||
if (poll != null) 'poll': poll!.id,
|
if (poll != null) 'poll': poll!.id,
|
||||||
if (realm != null) 'realm': realm!.id,
|
|
||||||
},
|
},
|
||||||
onSendProgress: (count, total) {
|
onSendProgress: (count, total) {
|
||||||
progress = baseProgressVal + (count / total) * (kPostingProgressWeight / 2);
|
progress = baseProgressVal + (count / total) * (kPostingProgressWeight / 2);
|
||||||
@ -633,11 +625,6 @@ class PostWriteController extends ChangeNotifier {
|
|||||||
notifyListeners();
|
notifyListeners();
|
||||||
}
|
}
|
||||||
|
|
||||||
void setRealm(SnRealm? value) {
|
|
||||||
realm = value;
|
|
||||||
notifyListeners();
|
|
||||||
}
|
|
||||||
|
|
||||||
void setProgress(double? value) {
|
void setProgress(double? value) {
|
||||||
progress = value;
|
progress = value;
|
||||||
_temporaryPlanSave();
|
_temporaryPlanSave();
|
||||||
|
@ -31,7 +31,6 @@ import 'package:surface/providers/post.dart';
|
|||||||
import 'package:surface/providers/relationship.dart';
|
import 'package:surface/providers/relationship.dart';
|
||||||
import 'package:surface/providers/sn_attachment.dart';
|
import 'package:surface/providers/sn_attachment.dart';
|
||||||
import 'package:surface/providers/sn_network.dart';
|
import 'package:surface/providers/sn_network.dart';
|
||||||
import 'package:surface/providers/sn_realm.dart';
|
|
||||||
import 'package:surface/providers/sn_sticker.dart';
|
import 'package:surface/providers/sn_sticker.dart';
|
||||||
import 'package:surface/providers/special_day.dart';
|
import 'package:surface/providers/special_day.dart';
|
||||||
import 'package:surface/providers/theme.dart';
|
import 'package:surface/providers/theme.dart';
|
||||||
@ -156,7 +155,6 @@ class SolianApp extends StatelessWidget {
|
|||||||
Provider(create: (ctx) => SnNetworkProvider(ctx)),
|
Provider(create: (ctx) => SnNetworkProvider(ctx)),
|
||||||
Provider(create: (ctx) => UserDirectoryProvider(ctx)),
|
Provider(create: (ctx) => UserDirectoryProvider(ctx)),
|
||||||
Provider(create: (ctx) => SnAttachmentProvider(ctx)),
|
Provider(create: (ctx) => SnAttachmentProvider(ctx)),
|
||||||
Provider(create: (ctx) => SnRealmProvider(ctx)),
|
|
||||||
Provider(create: (ctx) => SnPostContentProvider(ctx)),
|
Provider(create: (ctx) => SnPostContentProvider(ctx)),
|
||||||
Provider(create: (ctx) => SnRelationshipProvider(ctx)),
|
Provider(create: (ctx) => SnRelationshipProvider(ctx)),
|
||||||
Provider(create: (ctx) => SnLinkPreviewProvider(ctx)),
|
Provider(create: (ctx) => SnLinkPreviewProvider(ctx)),
|
||||||
|
@ -2,23 +2,19 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
import 'package:surface/providers/sn_attachment.dart';
|
import 'package:surface/providers/sn_attachment.dart';
|
||||||
import 'package:surface/providers/sn_network.dart';
|
import 'package:surface/providers/sn_network.dart';
|
||||||
import 'package:surface/providers/sn_realm.dart';
|
|
||||||
import 'package:surface/providers/user_directory.dart';
|
import 'package:surface/providers/user_directory.dart';
|
||||||
import 'package:surface/types/poll.dart';
|
import 'package:surface/types/poll.dart';
|
||||||
import 'package:surface/types/post.dart';
|
import 'package:surface/types/post.dart';
|
||||||
import 'package:surface/types/realm.dart';
|
|
||||||
|
|
||||||
class SnPostContentProvider {
|
class SnPostContentProvider {
|
||||||
late final SnNetworkProvider _sn;
|
late final SnNetworkProvider _sn;
|
||||||
late final UserDirectoryProvider _ud;
|
late final UserDirectoryProvider _ud;
|
||||||
late final SnAttachmentProvider _attach;
|
late final SnAttachmentProvider _attach;
|
||||||
late final SnRealmProvider _realm;
|
|
||||||
|
|
||||||
SnPostContentProvider(BuildContext context) {
|
SnPostContentProvider(BuildContext context) {
|
||||||
_sn = context.read<SnNetworkProvider>();
|
_sn = context.read<SnNetworkProvider>();
|
||||||
_ud = context.read<UserDirectoryProvider>();
|
_ud = context.read<UserDirectoryProvider>();
|
||||||
_attach = context.read<SnAttachmentProvider>();
|
_attach = context.read<SnAttachmentProvider>();
|
||||||
_realm = context.read<SnRealmProvider>();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<SnPoll> _fetchPoll(int id) async {
|
Future<SnPoll> _fetchPoll(int id) async {
|
||||||
@ -46,13 +42,9 @@ class SnPostContentProvider {
|
|||||||
final attachments = await _attach.getMultiple(rids.toList());
|
final attachments = await _attach.getMultiple(rids.toList());
|
||||||
for (var i = 0; i < out.length; i++) {
|
for (var i = 0; i < out.length; i++) {
|
||||||
SnPoll? poll;
|
SnPoll? poll;
|
||||||
SnRealm? realm;
|
|
||||||
if (out[i].pollId != null) {
|
if (out[i].pollId != null) {
|
||||||
poll = await _fetchPoll(out[i].pollId!);
|
poll = await _fetchPoll(out[i].pollId!);
|
||||||
}
|
}
|
||||||
if (out[i].realmId != null) {
|
|
||||||
realm = await _realm.getRealm(out[i].realmId!);
|
|
||||||
}
|
|
||||||
|
|
||||||
out[i] = out[i].copyWith(
|
out[i] = out[i].copyWith(
|
||||||
preload: SnPostPreload(
|
preload: SnPostPreload(
|
||||||
@ -60,7 +52,6 @@ class SnPostContentProvider {
|
|||||||
attachments: attachments.where((ele) => out[i].body['attachments']?.contains(ele?.rid) ?? false).toList(),
|
attachments: attachments.where((ele) => out[i].body['attachments']?.contains(ele?.rid) ?? false).toList(),
|
||||||
video: attachments.where((ele) => ele?.rid == out[i].body['video']).firstOrNull,
|
video: attachments.where((ele) => ele?.rid == out[i].body['video']).firstOrNull,
|
||||||
poll: poll,
|
poll: poll,
|
||||||
realm: realm,
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -90,13 +81,9 @@ class SnPostContentProvider {
|
|||||||
final attachments = await _attach.getMultiple(rids.toList());
|
final attachments = await _attach.getMultiple(rids.toList());
|
||||||
|
|
||||||
SnPoll? poll;
|
SnPoll? poll;
|
||||||
SnRealm? realm;
|
|
||||||
if (out.pollId != null) {
|
if (out.pollId != null) {
|
||||||
poll = await _fetchPoll(out.pollId!);
|
poll = await _fetchPoll(out.pollId!);
|
||||||
}
|
}
|
||||||
if (out.realmId != null) {
|
|
||||||
realm = await _realm.getRealm(out.realmId!);
|
|
||||||
}
|
|
||||||
|
|
||||||
out = out.copyWith(
|
out = out.copyWith(
|
||||||
preload: SnPostPreload(
|
preload: SnPostPreload(
|
||||||
@ -104,7 +91,6 @@ class SnPostContentProvider {
|
|||||||
attachments: attachments.where((ele) => out.body['attachments']?.contains(ele?.rid) ?? false).toList(),
|
attachments: attachments.where((ele) => out.body['attachments']?.contains(ele?.rid) ?? false).toList(),
|
||||||
video: attachments.where((ele) => ele?.rid == out.body['video']).firstOrNull,
|
video: attachments.where((ele) => ele?.rid == out.body['video']).firstOrNull,
|
||||||
poll: poll,
|
poll: poll,
|
||||||
realm: realm,
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -126,7 +112,6 @@ class SnPostContentProvider {
|
|||||||
String? author,
|
String? author,
|
||||||
Iterable<String>? categories,
|
Iterable<String>? categories,
|
||||||
Iterable<String>? tags,
|
Iterable<String>? tags,
|
||||||
String? realm,
|
|
||||||
}) async {
|
}) async {
|
||||||
final resp = await _sn.client.get('/cgi/co/posts', queryParameters: {
|
final resp = await _sn.client.get('/cgi/co/posts', queryParameters: {
|
||||||
'take': take,
|
'take': take,
|
||||||
@ -135,7 +120,6 @@ class SnPostContentProvider {
|
|||||||
if (author != null) 'author': author,
|
if (author != null) 'author': author,
|
||||||
if (tags?.isNotEmpty ?? false) 'tags': tags!.join(','),
|
if (tags?.isNotEmpty ?? false) 'tags': tags!.join(','),
|
||||||
if (categories?.isNotEmpty ?? false) 'categories': categories!.join(','),
|
if (categories?.isNotEmpty ?? false) 'categories': categories!.join(','),
|
||||||
if (realm != null) 'realm': realm,
|
|
||||||
});
|
});
|
||||||
final List<SnPost> out = await _preloadRelatedDataInBatch(
|
final List<SnPost> out = await _preloadRelatedDataInBatch(
|
||||||
List.from(resp.data['data']?.map((e) => SnPost.fromJson(e)) ?? []),
|
List.from(resp.data['data']?.map((e) => SnPost.fromJson(e)) ?? []),
|
||||||
|
@ -1,37 +0,0 @@
|
|||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:provider/provider.dart';
|
|
||||||
import 'package:surface/providers/sn_network.dart';
|
|
||||||
import 'package:surface/types/realm.dart';
|
|
||||||
|
|
||||||
class SnRealmProvider {
|
|
||||||
late final SnNetworkProvider _sn;
|
|
||||||
|
|
||||||
SnRealmProvider(BuildContext context) {
|
|
||||||
_sn = context.read<SnNetworkProvider>();
|
|
||||||
}
|
|
||||||
|
|
||||||
final Map<String, SnRealm> _cache = {};
|
|
||||||
|
|
||||||
Future<List<SnRealm>> listAvailableRealms() async {
|
|
||||||
final resp = await _sn.client.get('/cgi/id/realms/me/available');
|
|
||||||
final out = List<SnRealm>.from(
|
|
||||||
resp.data?.map((e) => SnRealm.fromJson(e)) ?? [],
|
|
||||||
);
|
|
||||||
for (final realm in out) {
|
|
||||||
_cache[realm.alias] = realm;
|
|
||||||
_cache[realm.id.toString()] = realm;
|
|
||||||
}
|
|
||||||
return out;
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<SnRealm> getRealm(dynamic aliasOrId) async {
|
|
||||||
if (_cache.containsKey(aliasOrId.toString())) {
|
|
||||||
return _cache[aliasOrId.toString()]!;
|
|
||||||
}
|
|
||||||
final resp = await _sn.client.get('/cgi/id/realms/$aliasOrId');
|
|
||||||
final out = SnRealm.fromJson(resp.data);
|
|
||||||
_cache[out.alias] = out;
|
|
||||||
_cache[out.id.toString()] = out;
|
|
||||||
return out;
|
|
||||||
}
|
|
||||||
}
|
|
@ -104,7 +104,7 @@ class _ChannelDetailScreenState extends State<ChannelDetailScreen> {
|
|||||||
try {
|
try {
|
||||||
final sn = context.read<SnNetworkProvider>();
|
final sn = context.read<SnNetworkProvider>();
|
||||||
await sn.client.delete(
|
await sn.client.delete(
|
||||||
'/cgi/im/channels/${_channel!.realm?.alias ?? 'global'}/${_channel!.alias}/me',
|
'/cgi/im/channels/${_channel!.realm?.alias ?? 'global'}/${_channel!.alias}/members/me',
|
||||||
);
|
);
|
||||||
if (!mounted) return;
|
if (!mounted) return;
|
||||||
Navigator.pop(context, false);
|
Navigator.pop(context, false);
|
||||||
|
@ -58,7 +58,6 @@ class _ChatRoomScreenState extends State<ChatRoomScreen> {
|
|||||||
|
|
||||||
StreamSubscription? _wsSubscription;
|
StreamSubscription? _wsSubscription;
|
||||||
|
|
||||||
// TODO fetch user identity and ask them to join the channel or not
|
|
||||||
Future<void> _fetchChannel() async {
|
Future<void> _fetchChannel() async {
|
||||||
setState(() => _isBusy = true);
|
setState(() => _isBusy = true);
|
||||||
|
|
||||||
|
@ -20,7 +20,6 @@ import 'package:surface/providers/sn_attachment.dart';
|
|||||||
import 'package:surface/providers/sn_network.dart';
|
import 'package:surface/providers/sn_network.dart';
|
||||||
import 'package:surface/types/attachment.dart';
|
import 'package:surface/types/attachment.dart';
|
||||||
import 'package:surface/types/post.dart';
|
import 'package:surface/types/post.dart';
|
||||||
import 'package:surface/types/realm.dart';
|
|
||||||
import 'package:surface/widgets/account/account_image.dart';
|
import 'package:surface/widgets/account/account_image.dart';
|
||||||
import 'package:surface/widgets/attachment/attachment_input.dart';
|
import 'package:surface/widgets/attachment/attachment_input.dart';
|
||||||
import 'package:surface/widgets/attachment/attachment_item.dart';
|
import 'package:surface/widgets/attachment/attachment_item.dart';
|
||||||
@ -36,8 +35,6 @@ import 'package:provider/provider.dart';
|
|||||||
import 'package:surface/widgets/post/post_poll_editor.dart';
|
import 'package:surface/widgets/post/post_poll_editor.dart';
|
||||||
import 'package:uuid/uuid.dart';
|
import 'package:uuid/uuid.dart';
|
||||||
|
|
||||||
import '../../providers/sn_realm.dart';
|
|
||||||
|
|
||||||
class PostEditorExtra {
|
class PostEditorExtra {
|
||||||
final String? text;
|
final String? text;
|
||||||
final String? title;
|
final String? title;
|
||||||
@ -82,7 +79,6 @@ class _PostEditorScreenState extends State<PostEditorScreen> {
|
|||||||
bool get _isLoading => _isFetching || _writeController.isLoading;
|
bool get _isLoading => _isFetching || _writeController.isLoading;
|
||||||
|
|
||||||
List<SnPublisher>? _publishers;
|
List<SnPublisher>? _publishers;
|
||||||
List<SnRealm>? _realms;
|
|
||||||
|
|
||||||
Future<void> _fetchPublishers() async {
|
Future<void> _fetchPublishers() async {
|
||||||
setState(() => _isFetching = true);
|
setState(() => _isFetching = true);
|
||||||
@ -105,16 +101,6 @@ class _PostEditorScreenState extends State<PostEditorScreen> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _fetchRealms() async {
|
|
||||||
final rels = context.read<SnRealmProvider>();
|
|
||||||
try {
|
|
||||||
_realms = await rels.listAvailableRealms();
|
|
||||||
} catch (err) {
|
|
||||||
if (!mounted) return;
|
|
||||||
context.showErrorDialog(err);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void _updateMeta() {
|
void _updateMeta() {
|
||||||
showModalBottomSheet(
|
showModalBottomSheet(
|
||||||
context: context,
|
context: context,
|
||||||
@ -158,19 +144,6 @@ class _PostEditorScreenState extends State<PostEditorScreen> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _showRealmPopup() {
|
|
||||||
showModalBottomSheet(
|
|
||||||
context: context,
|
|
||||||
builder: (context) => _PostRealmPopup(
|
|
||||||
controller: _writeController,
|
|
||||||
realms: _realms,
|
|
||||||
onUpdate: () {
|
|
||||||
_fetchRealms();
|
|
||||||
},
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
void _showPollEditorDialog() async {
|
void _showPollEditorDialog() async {
|
||||||
final poll = await showDialog<dynamic>(
|
final poll = await showDialog<dynamic>(
|
||||||
context: context,
|
context: context,
|
||||||
@ -221,7 +194,6 @@ class _PostEditorScreenState extends State<PostEditorScreen> {
|
|||||||
} else {
|
} else {
|
||||||
_writeController.setMode(widget.mode);
|
_writeController.setMode(widget.mode);
|
||||||
}
|
}
|
||||||
_fetchRealms();
|
|
||||||
_fetchPublishers();
|
_fetchPublishers();
|
||||||
_writeController.fetchRelatedPost(
|
_writeController.fetchRelatedPost(
|
||||||
context,
|
context,
|
||||||
@ -363,22 +335,18 @@ class _PostEditorScreenState extends State<PostEditorScreen> {
|
|||||||
'stories' => _PostStoryEditor(
|
'stories' => _PostStoryEditor(
|
||||||
controller: _writeController,
|
controller: _writeController,
|
||||||
onTapPublisher: _showPublisherPopup,
|
onTapPublisher: _showPublisherPopup,
|
||||||
onTapRealm: _showRealmPopup,
|
|
||||||
),
|
),
|
||||||
'articles' => _PostArticleEditor(
|
'articles' => _PostArticleEditor(
|
||||||
controller: _writeController,
|
controller: _writeController,
|
||||||
onTapPublisher: _showPublisherPopup,
|
onTapPublisher: _showPublisherPopup,
|
||||||
onTapRealm: _showRealmPopup,
|
|
||||||
),
|
),
|
||||||
'questions' => _PostQuestionEditor(
|
'questions' => _PostQuestionEditor(
|
||||||
controller: _writeController,
|
controller: _writeController,
|
||||||
onTapPublisher: _showPublisherPopup,
|
onTapPublisher: _showPublisherPopup,
|
||||||
onTapRealm: _showRealmPopup,
|
|
||||||
),
|
),
|
||||||
'videos' => _PostVideoEditor(
|
'videos' => _PostVideoEditor(
|
||||||
controller: _writeController,
|
controller: _writeController,
|
||||||
onTapPublisher: _showPublisherPopup,
|
onTapPublisher: _showPublisherPopup,
|
||||||
onTapRealm: _showRealmPopup,
|
|
||||||
),
|
),
|
||||||
_ => const Placeholder(),
|
_ => const Placeholder(),
|
||||||
})
|
})
|
||||||
@ -497,7 +465,7 @@ class _PostEditorScreenState extends State<PostEditorScreen> {
|
|||||||
),
|
),
|
||||||
if (_writeController.mode == 'articles')
|
if (_writeController.mode == 'articles')
|
||||||
IconButton(
|
IconButton(
|
||||||
icon: Icon(Symbols.full_coverage, color: Theme.of(context).colorScheme.primary),
|
icon: Icon(Symbols.image, color: Theme.of(context).colorScheme.primary),
|
||||||
style: ButtonStyle(
|
style: ButtonStyle(
|
||||||
backgroundColor: _writeController.thumbnail == null
|
backgroundColor: _writeController.thumbnail == null
|
||||||
? null
|
? null
|
||||||
@ -607,65 +575,11 @@ class _PostPublisherPopup extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class _PostRealmPopup extends StatelessWidget {
|
|
||||||
final PostWriteController controller;
|
|
||||||
final List<SnRealm>? realms;
|
|
||||||
final Function onUpdate;
|
|
||||||
|
|
||||||
const _PostRealmPopup({required this.controller, this.realms, required this.onUpdate});
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return Column(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
Row(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
|
||||||
children: [
|
|
||||||
const Icon(Symbols.face, size: 24),
|
|
||||||
const Gap(16),
|
|
||||||
Text('accountRealms', style: Theme.of(context).textTheme.titleLarge).tr(),
|
|
||||||
],
|
|
||||||
).padding(horizontal: 20, top: 16, bottom: 12),
|
|
||||||
ListTile(
|
|
||||||
leading: const Icon(Symbols.close),
|
|
||||||
title: Text('postInGlobal').tr(),
|
|
||||||
subtitle: Text('postInGlobalDescription').tr(),
|
|
||||||
contentPadding: const EdgeInsets.symmetric(horizontal: 24),
|
|
||||||
onTap: () {
|
|
||||||
controller.setRealm(null);
|
|
||||||
Navigator.pop(context, true);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
const Divider(height: 1),
|
|
||||||
Expanded(
|
|
||||||
child: ListView.builder(
|
|
||||||
itemCount: realms?.length ?? 0,
|
|
||||||
itemBuilder: (context, idx) {
|
|
||||||
final realm = realms![idx];
|
|
||||||
return ListTile(
|
|
||||||
title: Text(realm.name),
|
|
||||||
subtitle: Text('@${realm.alias}'),
|
|
||||||
leading: AccountImage(content: realm.avatar, radius: 18),
|
|
||||||
onTap: () {
|
|
||||||
controller.setRealm(realm);
|
|
||||||
Navigator.pop(context, true);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class _PostStoryEditor extends StatelessWidget {
|
class _PostStoryEditor extends StatelessWidget {
|
||||||
final PostWriteController controller;
|
final PostWriteController controller;
|
||||||
final Function? onTapPublisher;
|
final Function? onTapPublisher;
|
||||||
final Function? onTapRealm;
|
|
||||||
|
|
||||||
const _PostStoryEditor({required this.controller, this.onTapPublisher, this.onTapRealm});
|
const _PostStoryEditor({required this.controller, this.onTapPublisher});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@ -675,36 +589,17 @@ class _PostStoryEditor extends StatelessWidget {
|
|||||||
child: Row(
|
child: Row(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Column(
|
Material(
|
||||||
children: [
|
elevation: 2,
|
||||||
Material(
|
borderRadius: const BorderRadius.all(Radius.circular(24)),
|
||||||
elevation: 2,
|
child: GestureDetector(
|
||||||
borderRadius: const BorderRadius.all(Radius.circular(24)),
|
onTap: () {
|
||||||
child: GestureDetector(
|
onTapPublisher?.call();
|
||||||
onTap: () {
|
},
|
||||||
onTapPublisher?.call();
|
child: AccountImage(
|
||||||
},
|
content: controller.publisher?.avatar,
|
||||||
child: AccountImage(
|
|
||||||
content: controller.publisher?.avatar,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
const Gap(11),
|
),
|
||||||
Material(
|
|
||||||
elevation: 1,
|
|
||||||
borderRadius: const BorderRadius.all(Radius.circular(24)),
|
|
||||||
child: GestureDetector(
|
|
||||||
onTap: () {
|
|
||||||
onTapRealm?.call();
|
|
||||||
},
|
|
||||||
child: AccountImage(
|
|
||||||
content: controller.realm?.avatar,
|
|
||||||
fallbackWidget: const Icon(Symbols.globe, size: 20),
|
|
||||||
radius: 14,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Column(
|
child: Column(
|
||||||
@ -747,9 +642,8 @@ class _PostStoryEditor extends StatelessWidget {
|
|||||||
class _PostArticleEditor extends StatelessWidget {
|
class _PostArticleEditor extends StatelessWidget {
|
||||||
final PostWriteController controller;
|
final PostWriteController controller;
|
||||||
final Function? onTapPublisher;
|
final Function? onTapPublisher;
|
||||||
final Function? onTapRealm;
|
|
||||||
|
|
||||||
const _PostArticleEditor({required this.controller, this.onTapPublisher, this.onTapRealm});
|
const _PostArticleEditor({required this.controller, this.onTapPublisher});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@ -770,21 +664,6 @@ class _PostArticleEditor extends StatelessWidget {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Material(
|
|
||||||
elevation: 1,
|
|
||||||
borderRadius: const BorderRadius.all(Radius.circular(24)),
|
|
||||||
child: GestureDetector(
|
|
||||||
onTap: () {
|
|
||||||
onTapRealm?.call();
|
|
||||||
},
|
|
||||||
child: AccountImage(
|
|
||||||
content: controller.realm?.avatar,
|
|
||||||
fallbackWidget: const Icon(Symbols.globe, size: 20),
|
|
||||||
radius: 14,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const Gap(8),
|
|
||||||
],
|
],
|
||||||
).padding(horizontal: 12, vertical: 8),
|
).padding(horizontal: 12, vertical: 8),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
@ -904,9 +783,8 @@ class _PostArticleEditor extends StatelessWidget {
|
|||||||
class _PostQuestionEditor extends StatelessWidget {
|
class _PostQuestionEditor extends StatelessWidget {
|
||||||
final PostWriteController controller;
|
final PostWriteController controller;
|
||||||
final Function? onTapPublisher;
|
final Function? onTapPublisher;
|
||||||
final Function? onTapRealm;
|
|
||||||
|
|
||||||
const _PostQuestionEditor({required this.controller, this.onTapPublisher, this.onTapRealm});
|
const _PostQuestionEditor({required this.controller, this.onTapPublisher});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@ -916,36 +794,17 @@ class _PostQuestionEditor extends StatelessWidget {
|
|||||||
child: Row(
|
child: Row(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Column(
|
Material(
|
||||||
children: [
|
elevation: 1,
|
||||||
Material(
|
borderRadius: const BorderRadius.all(Radius.circular(24)),
|
||||||
elevation: 2,
|
child: GestureDetector(
|
||||||
borderRadius: const BorderRadius.all(Radius.circular(24)),
|
onTap: () {
|
||||||
child: GestureDetector(
|
onTapPublisher?.call();
|
||||||
onTap: () {
|
},
|
||||||
onTapPublisher?.call();
|
child: AccountImage(
|
||||||
},
|
content: controller.publisher?.avatar,
|
||||||
child: AccountImage(
|
|
||||||
content: controller.publisher?.avatar,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
const Gap(11),
|
),
|
||||||
Material(
|
|
||||||
elevation: 1,
|
|
||||||
borderRadius: const BorderRadius.all(Radius.circular(24)),
|
|
||||||
child: GestureDetector(
|
|
||||||
onTap: () {
|
|
||||||
onTapRealm?.call();
|
|
||||||
},
|
|
||||||
child: AccountImage(
|
|
||||||
content: controller.realm?.avatar,
|
|
||||||
fallbackWidget: const Icon(Symbols.globe, size: 20),
|
|
||||||
radius: 14,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Column(
|
child: Column(
|
||||||
@ -999,9 +858,8 @@ class _PostQuestionEditor extends StatelessWidget {
|
|||||||
class _PostVideoEditor extends StatelessWidget {
|
class _PostVideoEditor extends StatelessWidget {
|
||||||
final PostWriteController controller;
|
final PostWriteController controller;
|
||||||
final Function? onTapPublisher;
|
final Function? onTapPublisher;
|
||||||
final Function? onTapRealm;
|
|
||||||
|
|
||||||
const _PostVideoEditor({required this.controller, this.onTapPublisher, this.onTapRealm});
|
const _PostVideoEditor({required this.controller, this.onTapPublisher});
|
||||||
|
|
||||||
void _selectVideo(BuildContext context) async {
|
void _selectVideo(BuildContext context) async {
|
||||||
final video = await showDialog<SnAttachment?>(
|
final video = await showDialog<SnAttachment?>(
|
||||||
@ -1089,36 +947,28 @@ class _PostVideoEditor extends StatelessWidget {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Column(
|
return Column(
|
||||||
children: [
|
children: [
|
||||||
Column(
|
Material(
|
||||||
children: [
|
color: Theme.of(context).colorScheme.surfaceContainerHigh,
|
||||||
Material(
|
child: InkWell(
|
||||||
elevation: 2,
|
child: Row(
|
||||||
borderRadius: const BorderRadius.all(Radius.circular(24)),
|
children: [
|
||||||
child: GestureDetector(
|
AccountImage(content: controller.publisher?.avatar, radius: 20),
|
||||||
onTap: () {
|
const Gap(8),
|
||||||
onTapPublisher?.call();
|
Expanded(
|
||||||
},
|
child: Column(
|
||||||
child: AccountImage(
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
content: controller.publisher?.avatar,
|
children: [
|
||||||
|
Text(controller.publisher?.nick ?? 'loading'.tr()).bold(),
|
||||||
|
Text('@${controller.publisher?.name}'),
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
],
|
||||||
),
|
).padding(horizontal: 12, vertical: 8),
|
||||||
const Gap(11),
|
onTap: () {
|
||||||
Material(
|
onTapPublisher?.call();
|
||||||
elevation: 1,
|
},
|
||||||
borderRadius: const BorderRadius.all(Radius.circular(24)),
|
),
|
||||||
child: GestureDetector(
|
|
||||||
onTap: () {
|
|
||||||
onTapRealm?.call();
|
|
||||||
},
|
|
||||||
child: AccountImage(
|
|
||||||
content: controller.realm?.avatar,
|
|
||||||
fallbackWidget: const Icon(Symbols.globe, size: 20),
|
|
||||||
radius: 14,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
const Gap(16),
|
const Gap(16),
|
||||||
TextField(
|
TextField(
|
||||||
|
@ -5,19 +5,16 @@ import 'package:go_router/go_router.dart';
|
|||||||
import 'package:material_symbols_icons/symbols.dart';
|
import 'package:material_symbols_icons/symbols.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
import 'package:styled_widget/styled_widget.dart';
|
import 'package:styled_widget/styled_widget.dart';
|
||||||
import 'package:surface/providers/post.dart';
|
|
||||||
import 'package:surface/providers/sn_network.dart';
|
import 'package:surface/providers/sn_network.dart';
|
||||||
import 'package:surface/providers/user_directory.dart';
|
import 'package:surface/providers/user_directory.dart';
|
||||||
import 'package:surface/providers/userinfo.dart';
|
import 'package:surface/providers/userinfo.dart';
|
||||||
import 'package:surface/types/account.dart';
|
import 'package:surface/types/account.dart';
|
||||||
import 'package:surface/types/chat.dart';
|
|
||||||
import 'package:surface/types/post.dart';
|
import 'package:surface/types/post.dart';
|
||||||
import 'package:surface/types/realm.dart';
|
import 'package:surface/types/realm.dart';
|
||||||
import 'package:surface/widgets/account/account_image.dart';
|
import 'package:surface/widgets/account/account_image.dart';
|
||||||
import 'package:surface/widgets/account/account_select.dart';
|
import 'package:surface/widgets/account/account_select.dart';
|
||||||
import 'package:surface/widgets/dialog.dart';
|
import 'package:surface/widgets/dialog.dart';
|
||||||
import 'package:surface/widgets/navigation/app_scaffold.dart';
|
import 'package:surface/widgets/navigation/app_scaffold.dart';
|
||||||
import 'package:surface/widgets/post/post_item.dart';
|
|
||||||
import 'package:very_good_infinite_list/very_good_infinite_list.dart';
|
import 'package:very_good_infinite_list/very_good_infinite_list.dart';
|
||||||
|
|
||||||
class RealmDetailScreen extends StatefulWidget {
|
class RealmDetailScreen extends StatefulWidget {
|
||||||
@ -63,36 +60,18 @@ class _RealmDetailScreenState extends State<RealmDetailScreen> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
List<SnChannel>? _channels;
|
|
||||||
|
|
||||||
Future<void> _fetchChannels() async {
|
|
||||||
try {
|
|
||||||
final sn = context.read<SnNetworkProvider>();
|
|
||||||
final resp = await sn.client.get('/cgi/im/channels/${widget.alias}/public');
|
|
||||||
_channels = List<SnChannel>.from(
|
|
||||||
resp.data.map((e) => SnChannel.fromJson(e)).cast<SnChannel>(),
|
|
||||||
);
|
|
||||||
} catch (err) {
|
|
||||||
if (mounted) context.showErrorDialog(err);
|
|
||||||
rethrow;
|
|
||||||
} finally {
|
|
||||||
setState(() {});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
_fetchRealm().then((_) {
|
_fetchRealm().then((_) {
|
||||||
_fetchPublishers();
|
_fetchPublishers();
|
||||||
_fetchChannels();
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return DefaultTabController(
|
return DefaultTabController(
|
||||||
length: 4,
|
length: 3,
|
||||||
child: AppScaffold(
|
child: AppScaffold(
|
||||||
body: NestedScrollView(
|
body: NestedScrollView(
|
||||||
headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) {
|
headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) {
|
||||||
@ -104,7 +83,6 @@ class _RealmDetailScreenState extends State<RealmDetailScreen> {
|
|||||||
bottom: TabBar(
|
bottom: TabBar(
|
||||||
tabs: [
|
tabs: [
|
||||||
Tab(icon: Icon(Symbols.home, color: Theme.of(context).appBarTheme.foregroundColor)),
|
Tab(icon: Icon(Symbols.home, color: Theme.of(context).appBarTheme.foregroundColor)),
|
||||||
Tab(icon: Icon(Symbols.explore, color: Theme.of(context).appBarTheme.foregroundColor)),
|
|
||||||
Tab(icon: Icon(Symbols.group, color: Theme.of(context).appBarTheme.foregroundColor)),
|
Tab(icon: Icon(Symbols.group, color: Theme.of(context).appBarTheme.foregroundColor)),
|
||||||
Tab(icon: Icon(Symbols.settings, color: Theme.of(context).appBarTheme.foregroundColor)),
|
Tab(icon: Icon(Symbols.settings, color: Theme.of(context).appBarTheme.foregroundColor)),
|
||||||
],
|
],
|
||||||
@ -115,8 +93,7 @@ class _RealmDetailScreenState extends State<RealmDetailScreen> {
|
|||||||
},
|
},
|
||||||
body: TabBarView(
|
body: TabBarView(
|
||||||
children: [
|
children: [
|
||||||
_RealmDetailHomeWidget(realm: _realm, publishers: _publishers, channels: _channels),
|
_RealmDetailHomeWidget(realm: _realm, publishers: _publishers),
|
||||||
_RealmPostListWidget(realm: _realm),
|
|
||||||
_RealmMemberListWidget(realm: _realm),
|
_RealmMemberListWidget(realm: _realm),
|
||||||
_RealmSettingsWidget(
|
_RealmSettingsWidget(
|
||||||
realm: _realm,
|
realm: _realm,
|
||||||
@ -135,9 +112,8 @@ class _RealmDetailScreenState extends State<RealmDetailScreen> {
|
|||||||
class _RealmDetailHomeWidget extends StatelessWidget {
|
class _RealmDetailHomeWidget extends StatelessWidget {
|
||||||
final SnRealm? realm;
|
final SnRealm? realm;
|
||||||
final List<SnPublisher>? publishers;
|
final List<SnPublisher>? publishers;
|
||||||
final List<SnChannel>? channels;
|
|
||||||
|
|
||||||
const _RealmDetailHomeWidget({required this.realm, this.publishers, this.channels});
|
const _RealmDetailHomeWidget({required this.realm, this.publishers});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@ -159,76 +135,30 @@ class _RealmDetailHomeWidget extends StatelessWidget {
|
|||||||
],
|
],
|
||||||
).padding(horizontal: 24),
|
).padding(horizontal: 24),
|
||||||
const Gap(16),
|
const Gap(16),
|
||||||
const Divider(height: 1),
|
const Divider(),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: CustomScrollView(
|
child: ListView.builder(
|
||||||
slivers: [
|
padding: EdgeInsets.zero,
|
||||||
if (publishers?.isNotEmpty ?? false)
|
itemCount: publishers?.length ?? 0,
|
||||||
SliverToBoxAdapter(
|
itemBuilder: (context, idx) {
|
||||||
child: Container(
|
final ele = publishers![idx];
|
||||||
width: double.infinity,
|
return ListTile(
|
||||||
color: Theme.of(context).colorScheme.surfaceContainerHigh,
|
contentPadding: const EdgeInsets.symmetric(horizontal: 20),
|
||||||
child: Text('realmCommunityPublishersHint'.tr(), style: Theme.of(context).textTheme.bodyMedium)
|
leading: AccountImage(
|
||||||
.padding(horizontal: 24, vertical: 8),
|
content: ele.avatar,
|
||||||
),
|
fallbackWidget: const Icon(Symbols.group, size: 24),
|
||||||
),
|
),
|
||||||
SliverList.builder(
|
title: Text(ele.nick),
|
||||||
itemCount: publishers?.length ?? 0,
|
subtitle: Text('@${ele.name}'),
|
||||||
itemBuilder: (context, idx) {
|
trailing: const Icon(Symbols.chevron_right),
|
||||||
final ele = publishers![idx];
|
onTap: () {
|
||||||
return ListTile(
|
GoRouter.of(context).pushNamed(
|
||||||
contentPadding: const EdgeInsets.symmetric(horizontal: 20),
|
'postPublisher',
|
||||||
leading: AccountImage(
|
pathParameters: {'name': ele.name},
|
||||||
content: ele.avatar,
|
|
||||||
fallbackWidget: const Icon(Symbols.group, size: 24),
|
|
||||||
),
|
|
||||||
title: Text(ele.nick),
|
|
||||||
subtitle: Text('@${ele.name}'),
|
|
||||||
trailing: const Icon(Symbols.chevron_right),
|
|
||||||
onTap: () {
|
|
||||||
GoRouter.of(context).pushNamed(
|
|
||||||
'postPublisher',
|
|
||||||
pathParameters: {'name': ele.name},
|
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
);
|
||||||
if (channels?.isNotEmpty ?? false)
|
},
|
||||||
SliverToBoxAdapter(
|
|
||||||
child: Container(
|
|
||||||
width: double.infinity,
|
|
||||||
color: Theme.of(context).colorScheme.surfaceContainerHigh,
|
|
||||||
child: Text('realmCommunityPublicChannelsHint'.tr(), style: Theme.of(context).textTheme.bodyMedium)
|
|
||||||
.padding(horizontal: 24, vertical: 8),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
SliverList.builder(
|
|
||||||
itemCount: channels?.length ?? 0,
|
|
||||||
itemBuilder: (context, idx) {
|
|
||||||
final ele = channels![idx];
|
|
||||||
return ListTile(
|
|
||||||
contentPadding: const EdgeInsets.symmetric(horizontal: 20),
|
|
||||||
leading: AccountImage(
|
|
||||||
content: null,
|
|
||||||
fallbackWidget: const Icon(Symbols.chat, size: 20),
|
|
||||||
),
|
|
||||||
title: Text(ele.name),
|
|
||||||
subtitle: Text('#${ele.alias}'),
|
|
||||||
trailing: const Icon(Symbols.chevron_right),
|
|
||||||
onTap: () {
|
|
||||||
GoRouter.of(context).pushNamed(
|
|
||||||
'chatRoom',
|
|
||||||
pathParameters: {
|
|
||||||
'scope': realm?.alias ?? 'global',
|
|
||||||
'alias': ele.alias,
|
|
||||||
},
|
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@ -236,72 +166,6 @@ class _RealmDetailHomeWidget extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class _RealmPostListWidget extends StatefulWidget {
|
|
||||||
final SnRealm? realm;
|
|
||||||
|
|
||||||
const _RealmPostListWidget({this.realm});
|
|
||||||
|
|
||||||
@override
|
|
||||||
State<_RealmPostListWidget> createState() => _RealmPostListWidgetState();
|
|
||||||
}
|
|
||||||
|
|
||||||
class _RealmPostListWidgetState extends State<_RealmPostListWidget> {
|
|
||||||
bool _isBusy = false;
|
|
||||||
int? _totalCount;
|
|
||||||
final List<SnPost> _posts = List.empty(growable: true);
|
|
||||||
|
|
||||||
Future<void> _fetchPosts() async {
|
|
||||||
setState(() => _isBusy = true);
|
|
||||||
|
|
||||||
try {
|
|
||||||
final pt = context.read<SnPostContentProvider>();
|
|
||||||
final out = await pt.listPosts(
|
|
||||||
take: 10,
|
|
||||||
offset: _posts.length,
|
|
||||||
realm: widget.realm?.id.toString(),
|
|
||||||
);
|
|
||||||
_totalCount = out.$2;
|
|
||||||
_posts.addAll(out.$1);
|
|
||||||
} catch (err) {
|
|
||||||
if (!mounted) return;
|
|
||||||
context.showErrorDialog(err);
|
|
||||||
} finally {
|
|
||||||
setState(() => _isBusy = false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return MediaQuery.removePadding(
|
|
||||||
context: context,
|
|
||||||
removeTop: true,
|
|
||||||
child: RefreshIndicator(
|
|
||||||
onRefresh: _fetchPosts,
|
|
||||||
child: InfiniteList(
|
|
||||||
itemCount: _posts.length,
|
|
||||||
isLoading: _isBusy,
|
|
||||||
hasReachedMax: _totalCount != null && _posts.length >= _totalCount!,
|
|
||||||
onFetchData: _fetchPosts,
|
|
||||||
itemBuilder: (context, idx) {
|
|
||||||
final post = _posts[idx];
|
|
||||||
return OpenablePostItem(
|
|
||||||
data: post,
|
|
||||||
maxWidth: 640,
|
|
||||||
onChanged: (data) {
|
|
||||||
setState(() => _posts[idx] = data);
|
|
||||||
},
|
|
||||||
onDeleted: () {
|
|
||||||
setState(() => _posts.removeAt(idx));
|
|
||||||
},
|
|
||||||
);
|
|
||||||
},
|
|
||||||
separatorBuilder: (_, __) => const Gap(8),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
).padding(top: 8);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class _RealmMemberListWidget extends StatefulWidget {
|
class _RealmMemberListWidget extends StatefulWidget {
|
||||||
final SnRealm? realm;
|
final SnRealm? realm;
|
||||||
|
|
||||||
@ -501,7 +365,7 @@ class _RealmSettingsWidgetState extends State<_RealmSettingsWidget> {
|
|||||||
final sn = context.read<SnNetworkProvider>();
|
final sn = context.read<SnNetworkProvider>();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await sn.client.delete('/cgi/id/realms/${widget.realm!.alias}/me');
|
await sn.client.delete('/cgi/id/realms/${widget.realm!.alias}/members/me');
|
||||||
if (!mounted) return;
|
if (!mounted) return;
|
||||||
Navigator.pop(context, true);
|
Navigator.pop(context, true);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
@ -14,6 +14,7 @@ import 'package:surface/widgets/dialog.dart';
|
|||||||
import 'package:surface/widgets/loading_indicator.dart';
|
import 'package:surface/widgets/loading_indicator.dart';
|
||||||
import 'package:surface/widgets/navigation/app_scaffold.dart';
|
import 'package:surface/widgets/navigation/app_scaffold.dart';
|
||||||
import 'package:surface/widgets/realm/realm_item.dart';
|
import 'package:surface/widgets/realm/realm_item.dart';
|
||||||
|
import 'package:surface/widgets/universal_image.dart';
|
||||||
|
|
||||||
class RealmDiscoveryScreen extends StatefulWidget {
|
class RealmDiscoveryScreen extends StatefulWidget {
|
||||||
const RealmDiscoveryScreen({super.key});
|
const RealmDiscoveryScreen({super.key});
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||||
import 'package:surface/types/attachment.dart';
|
import 'package:surface/types/attachment.dart';
|
||||||
import 'package:surface/types/poll.dart';
|
import 'package:surface/types/poll.dart';
|
||||||
import 'package:surface/types/realm.dart';
|
|
||||||
|
|
||||||
part 'post.freezed.dart';
|
part 'post.freezed.dart';
|
||||||
part 'post.g.dart';
|
part 'post.g.dart';
|
||||||
@ -25,7 +24,6 @@ class SnPost with _$SnPost {
|
|||||||
required List<SnPost>? replies,
|
required List<SnPost>? replies,
|
||||||
required int? replyId,
|
required int? replyId,
|
||||||
required int? repostId,
|
required int? repostId,
|
||||||
required int? realmId,
|
|
||||||
required SnPost? replyTo,
|
required SnPost? replyTo,
|
||||||
required SnPost? repostTo,
|
required SnPost? repostTo,
|
||||||
required List<int>? visibleUsersList,
|
required List<int>? visibleUsersList,
|
||||||
@ -97,7 +95,6 @@ class SnPostPreload with _$SnPostPreload {
|
|||||||
required List<SnAttachment?>? attachments,
|
required List<SnAttachment?>? attachments,
|
||||||
required SnAttachment? video,
|
required SnAttachment? video,
|
||||||
required SnPoll? poll,
|
required SnPoll? poll,
|
||||||
required SnRealm? realm,
|
|
||||||
}) = _SnPostPreload;
|
}) = _SnPostPreload;
|
||||||
|
|
||||||
factory SnPostPreload.fromJson(Map<String, Object?> json) =>
|
factory SnPostPreload.fromJson(Map<String, Object?> json) =>
|
||||||
|
@ -34,7 +34,6 @@ mixin _$SnPost {
|
|||||||
List<SnPost>? get replies => throw _privateConstructorUsedError;
|
List<SnPost>? get replies => throw _privateConstructorUsedError;
|
||||||
int? get replyId => throw _privateConstructorUsedError;
|
int? get replyId => throw _privateConstructorUsedError;
|
||||||
int? get repostId => throw _privateConstructorUsedError;
|
int? get repostId => throw _privateConstructorUsedError;
|
||||||
int? get realmId => throw _privateConstructorUsedError;
|
|
||||||
SnPost? get replyTo => throw _privateConstructorUsedError;
|
SnPost? get replyTo => throw _privateConstructorUsedError;
|
||||||
SnPost? get repostTo => throw _privateConstructorUsedError;
|
SnPost? get repostTo => throw _privateConstructorUsedError;
|
||||||
List<int>? get visibleUsersList => throw _privateConstructorUsedError;
|
List<int>? get visibleUsersList => throw _privateConstructorUsedError;
|
||||||
@ -85,7 +84,6 @@ abstract class $SnPostCopyWith<$Res> {
|
|||||||
List<SnPost>? replies,
|
List<SnPost>? replies,
|
||||||
int? replyId,
|
int? replyId,
|
||||||
int? repostId,
|
int? repostId,
|
||||||
int? realmId,
|
|
||||||
SnPost? replyTo,
|
SnPost? replyTo,
|
||||||
SnPost? repostTo,
|
SnPost? repostTo,
|
||||||
List<int>? visibleUsersList,
|
List<int>? visibleUsersList,
|
||||||
@ -143,7 +141,6 @@ class _$SnPostCopyWithImpl<$Res, $Val extends SnPost>
|
|||||||
Object? replies = freezed,
|
Object? replies = freezed,
|
||||||
Object? replyId = freezed,
|
Object? replyId = freezed,
|
||||||
Object? repostId = freezed,
|
Object? repostId = freezed,
|
||||||
Object? realmId = freezed,
|
|
||||||
Object? replyTo = freezed,
|
Object? replyTo = freezed,
|
||||||
Object? repostTo = freezed,
|
Object? repostTo = freezed,
|
||||||
Object? visibleUsersList = freezed,
|
Object? visibleUsersList = freezed,
|
||||||
@ -222,10 +219,6 @@ class _$SnPostCopyWithImpl<$Res, $Val extends SnPost>
|
|||||||
? _value.repostId
|
? _value.repostId
|
||||||
: repostId // ignore: cast_nullable_to_non_nullable
|
: repostId // ignore: cast_nullable_to_non_nullable
|
||||||
as int?,
|
as int?,
|
||||||
realmId: freezed == realmId
|
|
||||||
? _value.realmId
|
|
||||||
: realmId // ignore: cast_nullable_to_non_nullable
|
|
||||||
as int?,
|
|
||||||
replyTo: freezed == replyTo
|
replyTo: freezed == replyTo
|
||||||
? _value.replyTo
|
? _value.replyTo
|
||||||
: replyTo // ignore: cast_nullable_to_non_nullable
|
: replyTo // ignore: cast_nullable_to_non_nullable
|
||||||
@ -394,7 +387,6 @@ abstract class _$$SnPostImplCopyWith<$Res> implements $SnPostCopyWith<$Res> {
|
|||||||
List<SnPost>? replies,
|
List<SnPost>? replies,
|
||||||
int? replyId,
|
int? replyId,
|
||||||
int? repostId,
|
int? repostId,
|
||||||
int? realmId,
|
|
||||||
SnPost? replyTo,
|
SnPost? replyTo,
|
||||||
SnPost? repostTo,
|
SnPost? repostTo,
|
||||||
List<int>? visibleUsersList,
|
List<int>? visibleUsersList,
|
||||||
@ -455,7 +447,6 @@ class __$$SnPostImplCopyWithImpl<$Res>
|
|||||||
Object? replies = freezed,
|
Object? replies = freezed,
|
||||||
Object? replyId = freezed,
|
Object? replyId = freezed,
|
||||||
Object? repostId = freezed,
|
Object? repostId = freezed,
|
||||||
Object? realmId = freezed,
|
|
||||||
Object? replyTo = freezed,
|
Object? replyTo = freezed,
|
||||||
Object? repostTo = freezed,
|
Object? repostTo = freezed,
|
||||||
Object? visibleUsersList = freezed,
|
Object? visibleUsersList = freezed,
|
||||||
@ -534,10 +525,6 @@ class __$$SnPostImplCopyWithImpl<$Res>
|
|||||||
? _value.repostId
|
? _value.repostId
|
||||||
: repostId // ignore: cast_nullable_to_non_nullable
|
: repostId // ignore: cast_nullable_to_non_nullable
|
||||||
as int?,
|
as int?,
|
||||||
realmId: freezed == realmId
|
|
||||||
? _value.realmId
|
|
||||||
: realmId // ignore: cast_nullable_to_non_nullable
|
|
||||||
as int?,
|
|
||||||
replyTo: freezed == replyTo
|
replyTo: freezed == replyTo
|
||||||
? _value.replyTo
|
? _value.replyTo
|
||||||
: replyTo // ignore: cast_nullable_to_non_nullable
|
: replyTo // ignore: cast_nullable_to_non_nullable
|
||||||
@ -640,7 +627,6 @@ class _$SnPostImpl extends _SnPost {
|
|||||||
required final List<SnPost>? replies,
|
required final List<SnPost>? replies,
|
||||||
required this.replyId,
|
required this.replyId,
|
||||||
required this.repostId,
|
required this.repostId,
|
||||||
required this.realmId,
|
|
||||||
required this.replyTo,
|
required this.replyTo,
|
||||||
required this.repostTo,
|
required this.repostTo,
|
||||||
required final List<int>? visibleUsersList,
|
required final List<int>? visibleUsersList,
|
||||||
@ -729,8 +715,6 @@ class _$SnPostImpl extends _SnPost {
|
|||||||
@override
|
@override
|
||||||
final int? repostId;
|
final int? repostId;
|
||||||
@override
|
@override
|
||||||
final int? realmId;
|
|
||||||
@override
|
|
||||||
final SnPost? replyTo;
|
final SnPost? replyTo;
|
||||||
@override
|
@override
|
||||||
final SnPost? repostTo;
|
final SnPost? repostTo;
|
||||||
@ -793,7 +777,7 @@ class _$SnPostImpl extends _SnPost {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() {
|
String toString() {
|
||||||
return 'SnPost(id: $id, createdAt: $createdAt, updatedAt: $updatedAt, deletedAt: $deletedAt, type: $type, body: $body, language: $language, alias: $alias, aliasPrefix: $aliasPrefix, tags: $tags, categories: $categories, replies: $replies, replyId: $replyId, repostId: $repostId, realmId: $realmId, replyTo: $replyTo, repostTo: $repostTo, visibleUsersList: $visibleUsersList, invisibleUsersList: $invisibleUsersList, visibility: $visibility, editedAt: $editedAt, pinnedAt: $pinnedAt, lockedAt: $lockedAt, isDraft: $isDraft, publishedAt: $publishedAt, publishedUntil: $publishedUntil, totalUpvote: $totalUpvote, totalDownvote: $totalDownvote, totalViews: $totalViews, totalAggregatedViews: $totalAggregatedViews, publisherId: $publisherId, pollId: $pollId, publisher: $publisher, metric: $metric, preload: $preload)';
|
return 'SnPost(id: $id, createdAt: $createdAt, updatedAt: $updatedAt, deletedAt: $deletedAt, type: $type, body: $body, language: $language, alias: $alias, aliasPrefix: $aliasPrefix, tags: $tags, categories: $categories, replies: $replies, replyId: $replyId, repostId: $repostId, replyTo: $replyTo, repostTo: $repostTo, visibleUsersList: $visibleUsersList, invisibleUsersList: $invisibleUsersList, visibility: $visibility, editedAt: $editedAt, pinnedAt: $pinnedAt, lockedAt: $lockedAt, isDraft: $isDraft, publishedAt: $publishedAt, publishedUntil: $publishedUntil, totalUpvote: $totalUpvote, totalDownvote: $totalDownvote, totalViews: $totalViews, totalAggregatedViews: $totalAggregatedViews, publisherId: $publisherId, pollId: $pollId, publisher: $publisher, metric: $metric, preload: $preload)';
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -822,7 +806,6 @@ class _$SnPostImpl extends _SnPost {
|
|||||||
(identical(other.replyId, replyId) || other.replyId == replyId) &&
|
(identical(other.replyId, replyId) || other.replyId == replyId) &&
|
||||||
(identical(other.repostId, repostId) ||
|
(identical(other.repostId, repostId) ||
|
||||||
other.repostId == repostId) &&
|
other.repostId == repostId) &&
|
||||||
(identical(other.realmId, realmId) || other.realmId == realmId) &&
|
|
||||||
(identical(other.replyTo, replyTo) || other.replyTo == replyTo) &&
|
(identical(other.replyTo, replyTo) || other.replyTo == replyTo) &&
|
||||||
(identical(other.repostTo, repostTo) ||
|
(identical(other.repostTo, repostTo) ||
|
||||||
other.repostTo == repostTo) &&
|
other.repostTo == repostTo) &&
|
||||||
@ -878,7 +861,6 @@ class _$SnPostImpl extends _SnPost {
|
|||||||
const DeepCollectionEquality().hash(_replies),
|
const DeepCollectionEquality().hash(_replies),
|
||||||
replyId,
|
replyId,
|
||||||
repostId,
|
repostId,
|
||||||
realmId,
|
|
||||||
replyTo,
|
replyTo,
|
||||||
repostTo,
|
repostTo,
|
||||||
const DeepCollectionEquality().hash(_visibleUsersList),
|
const DeepCollectionEquality().hash(_visibleUsersList),
|
||||||
@ -933,7 +915,6 @@ abstract class _SnPost extends SnPost {
|
|||||||
required final List<SnPost>? replies,
|
required final List<SnPost>? replies,
|
||||||
required final int? replyId,
|
required final int? replyId,
|
||||||
required final int? repostId,
|
required final int? repostId,
|
||||||
required final int? realmId,
|
|
||||||
required final SnPost? replyTo,
|
required final SnPost? replyTo,
|
||||||
required final SnPost? repostTo,
|
required final SnPost? repostTo,
|
||||||
required final List<int>? visibleUsersList,
|
required final List<int>? visibleUsersList,
|
||||||
@ -987,8 +968,6 @@ abstract class _SnPost extends SnPost {
|
|||||||
@override
|
@override
|
||||||
int? get repostId;
|
int? get repostId;
|
||||||
@override
|
@override
|
||||||
int? get realmId;
|
|
||||||
@override
|
|
||||||
SnPost? get replyTo;
|
SnPost? get replyTo;
|
||||||
@override
|
@override
|
||||||
SnPost? get repostTo;
|
SnPost? get repostTo;
|
||||||
@ -1657,7 +1636,6 @@ mixin _$SnPostPreload {
|
|||||||
List<SnAttachment?>? get attachments => throw _privateConstructorUsedError;
|
List<SnAttachment?>? get attachments => throw _privateConstructorUsedError;
|
||||||
SnAttachment? get video => throw _privateConstructorUsedError;
|
SnAttachment? get video => throw _privateConstructorUsedError;
|
||||||
SnPoll? get poll => throw _privateConstructorUsedError;
|
SnPoll? get poll => throw _privateConstructorUsedError;
|
||||||
SnRealm? get realm => throw _privateConstructorUsedError;
|
|
||||||
|
|
||||||
/// Serializes this SnPostPreload to a JSON map.
|
/// Serializes this SnPostPreload to a JSON map.
|
||||||
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
|
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
|
||||||
@ -1679,13 +1657,11 @@ abstract class $SnPostPreloadCopyWith<$Res> {
|
|||||||
{SnAttachment? thumbnail,
|
{SnAttachment? thumbnail,
|
||||||
List<SnAttachment?>? attachments,
|
List<SnAttachment?>? attachments,
|
||||||
SnAttachment? video,
|
SnAttachment? video,
|
||||||
SnPoll? poll,
|
SnPoll? poll});
|
||||||
SnRealm? realm});
|
|
||||||
|
|
||||||
$SnAttachmentCopyWith<$Res>? get thumbnail;
|
$SnAttachmentCopyWith<$Res>? get thumbnail;
|
||||||
$SnAttachmentCopyWith<$Res>? get video;
|
$SnAttachmentCopyWith<$Res>? get video;
|
||||||
$SnPollCopyWith<$Res>? get poll;
|
$SnPollCopyWith<$Res>? get poll;
|
||||||
$SnRealmCopyWith<$Res>? get realm;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @nodoc
|
/// @nodoc
|
||||||
@ -1707,7 +1683,6 @@ class _$SnPostPreloadCopyWithImpl<$Res, $Val extends SnPostPreload>
|
|||||||
Object? attachments = freezed,
|
Object? attachments = freezed,
|
||||||
Object? video = freezed,
|
Object? video = freezed,
|
||||||
Object? poll = freezed,
|
Object? poll = freezed,
|
||||||
Object? realm = freezed,
|
|
||||||
}) {
|
}) {
|
||||||
return _then(_value.copyWith(
|
return _then(_value.copyWith(
|
||||||
thumbnail: freezed == thumbnail
|
thumbnail: freezed == thumbnail
|
||||||
@ -1726,10 +1701,6 @@ class _$SnPostPreloadCopyWithImpl<$Res, $Val extends SnPostPreload>
|
|||||||
? _value.poll
|
? _value.poll
|
||||||
: poll // ignore: cast_nullable_to_non_nullable
|
: poll // ignore: cast_nullable_to_non_nullable
|
||||||
as SnPoll?,
|
as SnPoll?,
|
||||||
realm: freezed == realm
|
|
||||||
? _value.realm
|
|
||||||
: realm // ignore: cast_nullable_to_non_nullable
|
|
||||||
as SnRealm?,
|
|
||||||
) as $Val);
|
) as $Val);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1774,20 +1745,6 @@ class _$SnPostPreloadCopyWithImpl<$Res, $Val extends SnPostPreload>
|
|||||||
return _then(_value.copyWith(poll: value) as $Val);
|
return _then(_value.copyWith(poll: value) as $Val);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Create a copy of SnPostPreload
|
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
|
||||||
@override
|
|
||||||
@pragma('vm:prefer-inline')
|
|
||||||
$SnRealmCopyWith<$Res>? get realm {
|
|
||||||
if (_value.realm == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $SnRealmCopyWith<$Res>(_value.realm!, (value) {
|
|
||||||
return _then(_value.copyWith(realm: value) as $Val);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @nodoc
|
/// @nodoc
|
||||||
@ -1802,8 +1759,7 @@ abstract class _$$SnPostPreloadImplCopyWith<$Res>
|
|||||||
{SnAttachment? thumbnail,
|
{SnAttachment? thumbnail,
|
||||||
List<SnAttachment?>? attachments,
|
List<SnAttachment?>? attachments,
|
||||||
SnAttachment? video,
|
SnAttachment? video,
|
||||||
SnPoll? poll,
|
SnPoll? poll});
|
||||||
SnRealm? realm});
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
$SnAttachmentCopyWith<$Res>? get thumbnail;
|
$SnAttachmentCopyWith<$Res>? get thumbnail;
|
||||||
@ -1811,8 +1767,6 @@ abstract class _$$SnPostPreloadImplCopyWith<$Res>
|
|||||||
$SnAttachmentCopyWith<$Res>? get video;
|
$SnAttachmentCopyWith<$Res>? get video;
|
||||||
@override
|
@override
|
||||||
$SnPollCopyWith<$Res>? get poll;
|
$SnPollCopyWith<$Res>? get poll;
|
||||||
@override
|
|
||||||
$SnRealmCopyWith<$Res>? get realm;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @nodoc
|
/// @nodoc
|
||||||
@ -1832,7 +1786,6 @@ class __$$SnPostPreloadImplCopyWithImpl<$Res>
|
|||||||
Object? attachments = freezed,
|
Object? attachments = freezed,
|
||||||
Object? video = freezed,
|
Object? video = freezed,
|
||||||
Object? poll = freezed,
|
Object? poll = freezed,
|
||||||
Object? realm = freezed,
|
|
||||||
}) {
|
}) {
|
||||||
return _then(_$SnPostPreloadImpl(
|
return _then(_$SnPostPreloadImpl(
|
||||||
thumbnail: freezed == thumbnail
|
thumbnail: freezed == thumbnail
|
||||||
@ -1851,10 +1804,6 @@ class __$$SnPostPreloadImplCopyWithImpl<$Res>
|
|||||||
? _value.poll
|
? _value.poll
|
||||||
: poll // ignore: cast_nullable_to_non_nullable
|
: poll // ignore: cast_nullable_to_non_nullable
|
||||||
as SnPoll?,
|
as SnPoll?,
|
||||||
realm: freezed == realm
|
|
||||||
? _value.realm
|
|
||||||
: realm // ignore: cast_nullable_to_non_nullable
|
|
||||||
as SnRealm?,
|
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1866,8 +1815,7 @@ class _$SnPostPreloadImpl implements _SnPostPreload {
|
|||||||
{required this.thumbnail,
|
{required this.thumbnail,
|
||||||
required final List<SnAttachment?>? attachments,
|
required final List<SnAttachment?>? attachments,
|
||||||
required this.video,
|
required this.video,
|
||||||
required this.poll,
|
required this.poll})
|
||||||
required this.realm})
|
|
||||||
: _attachments = attachments;
|
: _attachments = attachments;
|
||||||
|
|
||||||
factory _$SnPostPreloadImpl.fromJson(Map<String, dynamic> json) =>
|
factory _$SnPostPreloadImpl.fromJson(Map<String, dynamic> json) =>
|
||||||
@ -1889,12 +1837,10 @@ class _$SnPostPreloadImpl implements _SnPostPreload {
|
|||||||
final SnAttachment? video;
|
final SnAttachment? video;
|
||||||
@override
|
@override
|
||||||
final SnPoll? poll;
|
final SnPoll? poll;
|
||||||
@override
|
|
||||||
final SnRealm? realm;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() {
|
String toString() {
|
||||||
return 'SnPostPreload(thumbnail: $thumbnail, attachments: $attachments, video: $video, poll: $poll, realm: $realm)';
|
return 'SnPostPreload(thumbnail: $thumbnail, attachments: $attachments, video: $video, poll: $poll)';
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -1907,14 +1853,13 @@ class _$SnPostPreloadImpl implements _SnPostPreload {
|
|||||||
const DeepCollectionEquality()
|
const DeepCollectionEquality()
|
||||||
.equals(other._attachments, _attachments) &&
|
.equals(other._attachments, _attachments) &&
|
||||||
(identical(other.video, video) || other.video == video) &&
|
(identical(other.video, video) || other.video == video) &&
|
||||||
(identical(other.poll, poll) || other.poll == poll) &&
|
(identical(other.poll, poll) || other.poll == poll));
|
||||||
(identical(other.realm, realm) || other.realm == realm));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
@override
|
@override
|
||||||
int get hashCode => Object.hash(runtimeType, thumbnail,
|
int get hashCode => Object.hash(runtimeType, thumbnail,
|
||||||
const DeepCollectionEquality().hash(_attachments), video, poll, realm);
|
const DeepCollectionEquality().hash(_attachments), video, poll);
|
||||||
|
|
||||||
/// Create a copy of SnPostPreload
|
/// Create a copy of SnPostPreload
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
@ -1937,8 +1882,7 @@ abstract class _SnPostPreload implements SnPostPreload {
|
|||||||
{required final SnAttachment? thumbnail,
|
{required final SnAttachment? thumbnail,
|
||||||
required final List<SnAttachment?>? attachments,
|
required final List<SnAttachment?>? attachments,
|
||||||
required final SnAttachment? video,
|
required final SnAttachment? video,
|
||||||
required final SnPoll? poll,
|
required final SnPoll? poll}) = _$SnPostPreloadImpl;
|
||||||
required final SnRealm? realm}) = _$SnPostPreloadImpl;
|
|
||||||
|
|
||||||
factory _SnPostPreload.fromJson(Map<String, dynamic> json) =
|
factory _SnPostPreload.fromJson(Map<String, dynamic> json) =
|
||||||
_$SnPostPreloadImpl.fromJson;
|
_$SnPostPreloadImpl.fromJson;
|
||||||
@ -1951,8 +1895,6 @@ abstract class _SnPostPreload implements SnPostPreload {
|
|||||||
SnAttachment? get video;
|
SnAttachment? get video;
|
||||||
@override
|
@override
|
||||||
SnPoll? get poll;
|
SnPoll? get poll;
|
||||||
@override
|
|
||||||
SnRealm? get realm;
|
|
||||||
|
|
||||||
/// Create a copy of SnPostPreload
|
/// Create a copy of SnPostPreload
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@ -31,7 +31,6 @@ _$SnPostImpl _$$SnPostImplFromJson(Map<String, dynamic> json) => _$SnPostImpl(
|
|||||||
.toList(),
|
.toList(),
|
||||||
replyId: (json['reply_id'] as num?)?.toInt(),
|
replyId: (json['reply_id'] as num?)?.toInt(),
|
||||||
repostId: (json['repost_id'] as num?)?.toInt(),
|
repostId: (json['repost_id'] as num?)?.toInt(),
|
||||||
realmId: (json['realm_id'] as num?)?.toInt(),
|
|
||||||
replyTo: json['reply_to'] == null
|
replyTo: json['reply_to'] == null
|
||||||
? null
|
? null
|
||||||
: SnPost.fromJson(json['reply_to'] as Map<String, dynamic>),
|
: SnPost.fromJson(json['reply_to'] as Map<String, dynamic>),
|
||||||
@ -92,7 +91,6 @@ Map<String, dynamic> _$$SnPostImplToJson(_$SnPostImpl instance) =>
|
|||||||
'replies': instance.replies?.map((e) => e.toJson()).toList(),
|
'replies': instance.replies?.map((e) => e.toJson()).toList(),
|
||||||
'reply_id': instance.replyId,
|
'reply_id': instance.replyId,
|
||||||
'repost_id': instance.repostId,
|
'repost_id': instance.repostId,
|
||||||
'realm_id': instance.realmId,
|
|
||||||
'reply_to': instance.replyTo?.toJson(),
|
'reply_to': instance.replyTo?.toJson(),
|
||||||
'repost_to': instance.repostTo?.toJson(),
|
'repost_to': instance.repostTo?.toJson(),
|
||||||
'visible_users_list': instance.visibleUsersList,
|
'visible_users_list': instance.visibleUsersList,
|
||||||
@ -180,9 +178,6 @@ _$SnPostPreloadImpl _$$SnPostPreloadImplFromJson(Map<String, dynamic> json) =>
|
|||||||
poll: json['poll'] == null
|
poll: json['poll'] == null
|
||||||
? null
|
? null
|
||||||
: SnPoll.fromJson(json['poll'] as Map<String, dynamic>),
|
: SnPoll.fromJson(json['poll'] as Map<String, dynamic>),
|
||||||
realm: json['realm'] == null
|
|
||||||
? null
|
|
||||||
: SnRealm.fromJson(json['realm'] as Map<String, dynamic>),
|
|
||||||
);
|
);
|
||||||
|
|
||||||
Map<String, dynamic> _$$SnPostPreloadImplToJson(_$SnPostPreloadImpl instance) =>
|
Map<String, dynamic> _$$SnPostPreloadImplToJson(_$SnPostPreloadImpl instance) =>
|
||||||
@ -191,7 +186,6 @@ Map<String, dynamic> _$$SnPostPreloadImplToJson(_$SnPostPreloadImpl instance) =>
|
|||||||
'attachments': instance.attachments?.map((e) => e?.toJson()).toList(),
|
'attachments': instance.attachments?.map((e) => e?.toJson()).toList(),
|
||||||
'video': instance.video?.toJson(),
|
'video': instance.video?.toJson(),
|
||||||
'poll': instance.poll?.toJson(),
|
'poll': instance.poll?.toJson(),
|
||||||
'realm': instance.realm?.toJson(),
|
|
||||||
};
|
};
|
||||||
|
|
||||||
_$SnBodyImpl _$$SnBodyImplFromJson(Map<String, dynamic> json) => _$SnBodyImpl(
|
_$SnBodyImpl _$$SnBodyImplFromJson(Map<String, dynamic> json) => _$SnBodyImpl(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user