Compare commits
5 Commits
Author | SHA1 | Date | |
---|---|---|---|
81a616157e | |||
52312662fb | |||
ca18d6ade4 | |||
af7cc8dab0 | |||
382e3c4a4c |
13
.roadsignrc
Normal file
13
.roadsignrc
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
{
|
||||||
|
"sync": {
|
||||||
|
"region": "solian",
|
||||||
|
"configPath": "roadsign.toml"
|
||||||
|
},
|
||||||
|
"deployments": [
|
||||||
|
{
|
||||||
|
"region": "solian",
|
||||||
|
"site": "solian-web",
|
||||||
|
"path": "build/web"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
@ -1,9 +1,12 @@
|
|||||||
|
import 'dart:async';
|
||||||
import 'dart:math';
|
import 'dart:math';
|
||||||
|
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:infinite_scroll_pagination/infinite_scroll_pagination.dart';
|
import 'package:infinite_scroll_pagination/infinite_scroll_pagination.dart';
|
||||||
|
import 'package:solian/models/attachment.dart';
|
||||||
import 'package:solian/models/pagination.dart';
|
import 'package:solian/models/pagination.dart';
|
||||||
import 'package:solian/models/post.dart';
|
import 'package:solian/models/post.dart';
|
||||||
|
import 'package:solian/providers/content/attachment.dart';
|
||||||
import 'package:solian/providers/content/posts.dart';
|
import 'package:solian/providers/content/posts.dart';
|
||||||
import 'package:solian/providers/last_read.dart';
|
import 'package:solian/providers/last_read.dart';
|
||||||
|
|
||||||
@ -31,9 +34,18 @@ class PostListController extends GetxController {
|
|||||||
pagingController.addPageRequestListener(_onPagingControllerRequest);
|
pagingController.addPageRequestListener(_onPagingControllerRequest);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Completer<void>? _pagingLoadCompleter;
|
||||||
|
|
||||||
Future<void> _onPagingControllerRequest(int pageKey) async {
|
Future<void> _onPagingControllerRequest(int pageKey) async {
|
||||||
try {
|
try {
|
||||||
|
if (_pagingLoadCompleter != null) {
|
||||||
|
await _pagingLoadCompleter!.future;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_pagingLoadCompleter = Completer();
|
||||||
final result = await loadMore();
|
final result = await loadMore();
|
||||||
|
_pagingLoadCompleter!.complete();
|
||||||
|
_pagingLoadCompleter = null;
|
||||||
|
|
||||||
if (result != null && hasMore.value) {
|
if (result != null && hasMore.value) {
|
||||||
pagingController.appendPage(result, nextPageKey.value);
|
pagingController.appendPage(result, nextPageKey.value);
|
||||||
@ -97,9 +109,6 @@ class PostListController extends GetxController {
|
|||||||
hasMore.value = false;
|
hasMore.value = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
final idx = <dynamic>{};
|
|
||||||
postList.retainWhere((x) => idx.add(x.id));
|
|
||||||
|
|
||||||
if (postList.isNotEmpty) {
|
if (postList.isNotEmpty) {
|
||||||
var lastId = postList.map((x) => x.id).reduce(max);
|
var lastId = postList.map((x) => x.id).reduce(max);
|
||||||
Get.find<LastReadProvider>().feedLastReadAt = lastId;
|
Get.find<LastReadProvider>().feedLastReadAt = lastId;
|
||||||
@ -111,35 +120,39 @@ class PostListController extends GetxController {
|
|||||||
Future<List<Post>?> _loadPosts(int pageKey) async {
|
Future<List<Post>?> _loadPosts(int pageKey) async {
|
||||||
isBusy.value = true;
|
isBusy.value = true;
|
||||||
|
|
||||||
final PostProvider provider = Get.find();
|
final PostProvider posts = Get.find();
|
||||||
|
|
||||||
Response resp;
|
Response resp;
|
||||||
try {
|
try {
|
||||||
if (author != null) {
|
if (author != null) {
|
||||||
resp = await provider.listPost(
|
resp = await posts.listPost(
|
||||||
pageKey,
|
pageKey,
|
||||||
author: author,
|
author: author,
|
||||||
|
take: 10,
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
switch (mode.value) {
|
switch (mode.value) {
|
||||||
case 2:
|
case 2:
|
||||||
resp = await provider.listRecommendations(
|
resp = await posts.listRecommendations(
|
||||||
pageKey,
|
pageKey,
|
||||||
channel: 'shuffle',
|
channel: 'shuffle',
|
||||||
realm: realm,
|
realm: realm,
|
||||||
|
take: 10,
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
resp = await provider.listRecommendations(
|
resp = await posts.listRecommendations(
|
||||||
pageKey,
|
pageKey,
|
||||||
channel: 'friends',
|
channel: 'friends',
|
||||||
realm: realm,
|
realm: realm,
|
||||||
|
take: 10,
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
resp = await provider.listRecommendations(
|
resp = await posts.listRecommendations(
|
||||||
pageKey,
|
pageKey,
|
||||||
realm: realm,
|
realm: realm,
|
||||||
|
take: 10,
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -153,6 +166,27 @@ class PostListController extends GetxController {
|
|||||||
final result = PaginationResult.fromJson(resp.body);
|
final result = PaginationResult.fromJson(resp.body);
|
||||||
final out = result.data?.map((e) => Post.fromJson(e)).toList();
|
final out = result.data?.map((e) => Post.fromJson(e)).toList();
|
||||||
|
|
||||||
|
final AttachmentProvider attach = Get.find();
|
||||||
|
|
||||||
|
if (out != null) {
|
||||||
|
final attachmentIds = out
|
||||||
|
.mapMany((x) => x.body['attachments'] ?? [])
|
||||||
|
.cast<String>()
|
||||||
|
.toSet()
|
||||||
|
.toList();
|
||||||
|
final attachmentOut = await attach.listMetadata(attachmentIds);
|
||||||
|
|
||||||
|
for (var idx = 0; idx < out.length; idx++) {
|
||||||
|
final rids = List<String>.from(out[idx].body['attachments'] ?? []);
|
||||||
|
out[idx].preload = PostPreload(
|
||||||
|
attachments: attachmentOut
|
||||||
|
.where((x) => x != null && rids.contains(x.rid))
|
||||||
|
.cast<Attachment>()
|
||||||
|
.toList(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
postTotal.value = result.count;
|
postTotal.value = result.count;
|
||||||
|
|
||||||
return out;
|
return out;
|
||||||
|
@ -1,10 +1,19 @@
|
|||||||
import 'package:json_annotation/json_annotation.dart';
|
import 'package:json_annotation/json_annotation.dart';
|
||||||
import 'package:solian/models/account.dart';
|
import 'package:solian/models/account.dart';
|
||||||
|
import 'package:solian/models/attachment.dart';
|
||||||
import 'package:solian/models/post_categories.dart';
|
import 'package:solian/models/post_categories.dart';
|
||||||
import 'package:solian/models/realm.dart';
|
import 'package:solian/models/realm.dart';
|
||||||
|
|
||||||
part 'post.g.dart';
|
part 'post.g.dart';
|
||||||
|
|
||||||
|
class PostPreload {
|
||||||
|
List<Attachment> attachments;
|
||||||
|
|
||||||
|
PostPreload({
|
||||||
|
required this.attachments,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
@JsonSerializable()
|
@JsonSerializable()
|
||||||
class Post {
|
class Post {
|
||||||
int id;
|
int id;
|
||||||
@ -33,6 +42,9 @@ class Post {
|
|||||||
Account author;
|
Account author;
|
||||||
PostMetric? metric;
|
PostMetric? metric;
|
||||||
|
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
PostPreload? preload;
|
||||||
|
|
||||||
Post({
|
Post({
|
||||||
required this.id,
|
required this.id,
|
||||||
required this.createdAt,
|
required this.createdAt,
|
||||||
|
@ -125,7 +125,7 @@ class AuthProvider extends GetConnect {
|
|||||||
userAgent: await ServiceFinder.getUserAgent(),
|
userAgent: await ServiceFinder.getUserAgent(),
|
||||||
sendUserAgent: true,
|
sendUserAgent: true,
|
||||||
);
|
);
|
||||||
client.httpClient.addAuthenticator(requestAuthenticator);
|
client.httpClient.addRequestModifier(requestAuthenticator);
|
||||||
client.httpClient.baseUrl = ServiceFinder.buildUrl(service, null);
|
client.httpClient.baseUrl = ServiceFinder.buildUrl(service, null);
|
||||||
|
|
||||||
return client;
|
return client;
|
||||||
|
@ -41,25 +41,27 @@ class AttachmentProvider extends GetConnect {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final resp = await get(
|
if (pendingQuery.isNotEmpty) {
|
||||||
'/attachments?take=${pendingQuery.length}&id=${pendingQuery.join(',')}',
|
final resp = await get(
|
||||||
);
|
'/attachments?take=${pendingQuery.length}&id=${pendingQuery.join(',')}',
|
||||||
if (resp.statusCode != 200) return result;
|
);
|
||||||
|
if (resp.statusCode != 200) return result;
|
||||||
|
|
||||||
final rawOut = PaginationResult.fromJson(resp.body);
|
final rawOut = PaginationResult.fromJson(resp.body);
|
||||||
if (rawOut.data == null) return result;
|
if (rawOut.data == null) return result;
|
||||||
|
|
||||||
final List<Attachment> out =
|
final List<Attachment> out =
|
||||||
rawOut.data!.map((x) => Attachment.fromJson(x)).toList();
|
rawOut.data!.map((x) => Attachment.fromJson(x)).toList();
|
||||||
for (final item in out) {
|
for (final item in out) {
|
||||||
if (item.destination != 0 && item.isAnalyzed) {
|
if (item.destination != 0 && item.isAnalyzed) {
|
||||||
_cachedResponses[item.rid] = item;
|
_cachedResponses[item.rid] = item;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
for (var i = 0; i < out.length; i++) {
|
||||||
for (var i = 0; i < out.length; i++) {
|
for (var j = 0; j < rid.length; j++) {
|
||||||
for (var j = 0; j < rid.length; j++) {
|
if (out[i].rid == rid[j]) {
|
||||||
if (out[i].rid == rid[j]) {
|
result[j] = out[i];
|
||||||
result[j] = out[i];
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,22 +3,11 @@ import 'package:solian/exceptions/request.dart';
|
|||||||
import 'package:solian/exceptions/unauthorized.dart';
|
import 'package:solian/exceptions/unauthorized.dart';
|
||||||
import 'package:solian/models/post.dart';
|
import 'package:solian/models/post.dart';
|
||||||
import 'package:solian/providers/auth.dart';
|
import 'package:solian/providers/auth.dart';
|
||||||
import 'package:solian/services.dart';
|
|
||||||
|
|
||||||
class PostProvider extends GetConnect {
|
|
||||||
@override
|
|
||||||
void onInit() {
|
|
||||||
httpClient.baseUrl = ServiceFinder.buildUrl('interactive', null);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
class PostProvider extends GetxController {
|
||||||
Future<Response> seeWhatsNew(int pivot) async {
|
Future<Response> seeWhatsNew(int pivot) async {
|
||||||
GetConnect client;
|
|
||||||
final AuthProvider auth = Get.find();
|
final AuthProvider auth = Get.find();
|
||||||
if (auth.isAuthorized.value) {
|
final client = await auth.configureClient('co');
|
||||||
client = await auth.configureClient('co');
|
|
||||||
} else {
|
|
||||||
client = await ServiceFinder.configureClient('co');
|
|
||||||
}
|
|
||||||
final resp = await client.get('/whats-new?pivot=$pivot');
|
final resp = await client.get('/whats-new?pivot=$pivot');
|
||||||
if (resp.statusCode != 200) {
|
if (resp.statusCode != 200) {
|
||||||
throw RequestException(resp);
|
throw RequestException(resp);
|
||||||
@ -28,19 +17,14 @@ class PostProvider extends GetConnect {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<Response> listRecommendations(int page,
|
Future<Response> listRecommendations(int page,
|
||||||
{String? realm, String? channel}) async {
|
{String? realm, String? channel, int take = 10}) async {
|
||||||
GetConnect client;
|
|
||||||
final AuthProvider auth = Get.find();
|
|
||||||
final queries = [
|
final queries = [
|
||||||
'take=${10}',
|
'take=$take',
|
||||||
'offset=$page',
|
'offset=$page',
|
||||||
if (realm != null) 'realm=$realm',
|
if (realm != null) 'realm=$realm',
|
||||||
];
|
];
|
||||||
if (auth.isAuthorized.value) {
|
final AuthProvider auth = Get.find();
|
||||||
client = await auth.configureClient('co');
|
final client = await auth.configureClient('interactive');
|
||||||
} else {
|
|
||||||
client = await ServiceFinder.configureClient('co');
|
|
||||||
}
|
|
||||||
final resp = await client.get(
|
final resp = await client.get(
|
||||||
channel == null
|
channel == null
|
||||||
? '/recommendations?${queries.join('&')}'
|
? '/recommendations?${queries.join('&')}'
|
||||||
@ -71,16 +55,18 @@ class PostProvider extends GetConnect {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<Response> listPost(int page,
|
Future<Response> listPost(int page,
|
||||||
{String? realm, String? author, tag, category}) async {
|
{String? realm, String? author, tag, category, int take = 10}) async {
|
||||||
final queries = [
|
final queries = [
|
||||||
'take=${10}',
|
'take=$take',
|
||||||
'offset=$page',
|
'offset=$page',
|
||||||
if (tag != null) 'tag=$tag',
|
if (tag != null) 'tag=$tag',
|
||||||
if (category != null) 'category=$category',
|
if (category != null) 'category=$category',
|
||||||
if (author != null) 'author=$author',
|
if (author != null) 'author=$author',
|
||||||
if (realm != null) 'realm=$realm',
|
if (realm != null) 'realm=$realm',
|
||||||
];
|
];
|
||||||
final resp = await get('/posts?${queries.join('&')}');
|
final AuthProvider auth = Get.find();
|
||||||
|
final client = await auth.configureClient('co');
|
||||||
|
final resp = await client.get('/posts?${queries.join('&')}');
|
||||||
if (resp.statusCode != 200) {
|
if (resp.statusCode != 200) {
|
||||||
throw RequestException(resp);
|
throw RequestException(resp);
|
||||||
}
|
}
|
||||||
@ -89,7 +75,10 @@ class PostProvider extends GetConnect {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<Response> listPostReplies(String alias, int page) async {
|
Future<Response> listPostReplies(String alias, int page) async {
|
||||||
final resp = await get('/posts/$alias/replies?take=${10}&offset=$page');
|
final AuthProvider auth = Get.find();
|
||||||
|
final client = await auth.configureClient('co');
|
||||||
|
final resp =
|
||||||
|
await client.get('/posts/$alias/replies?take=${10}&offset=$page');
|
||||||
if (resp.statusCode != 200) {
|
if (resp.statusCode != 200) {
|
||||||
throw RequestException(resp);
|
throw RequestException(resp);
|
||||||
}
|
}
|
||||||
@ -98,7 +87,9 @@ class PostProvider extends GetConnect {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<List<Post>> listPostFeaturedReply(String alias, {int take = 1}) async {
|
Future<List<Post>> listPostFeaturedReply(String alias, {int take = 1}) async {
|
||||||
final resp = await get('/posts/$alias/replies/featured?take=$take');
|
final AuthProvider auth = Get.find();
|
||||||
|
final client = await auth.configureClient('co');
|
||||||
|
final resp = await client.get('/posts/$alias/replies/featured?take=$take');
|
||||||
if (resp.statusCode != 200) {
|
if (resp.statusCode != 200) {
|
||||||
throw RequestException(resp);
|
throw RequestException(resp);
|
||||||
}
|
}
|
||||||
@ -107,16 +98,9 @@ class PostProvider extends GetConnect {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<Response> getPost(String alias) async {
|
Future<Response> getPost(String alias) async {
|
||||||
final resp = await get('/posts/$alias');
|
final AuthProvider auth = Get.find();
|
||||||
if (resp.statusCode != 200) {
|
final client = await auth.configureClient('co');
|
||||||
throw RequestException(resp);
|
final resp = await client.get('/posts/$alias');
|
||||||
}
|
|
||||||
|
|
||||||
return resp;
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<Response> getArticle(String alias) async {
|
|
||||||
final resp = await get('/articles/$alias');
|
|
||||||
if (resp.statusCode != 200) {
|
if (resp.statusCode != 200) {
|
||||||
throw RequestException(resp);
|
throw RequestException(resp);
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,6 @@ import 'package:solian/widgets/app_bar_leading.dart';
|
|||||||
import 'package:solian/widgets/attachments/attachment_list.dart';
|
import 'package:solian/widgets/attachments/attachment_list.dart';
|
||||||
import 'package:solian/widgets/daily_sign/history_chart.dart';
|
import 'package:solian/widgets/daily_sign/history_chart.dart';
|
||||||
import 'package:solian/widgets/posts/post_list.dart';
|
import 'package:solian/widgets/posts/post_list.dart';
|
||||||
import 'package:solian/widgets/posts/post_warped_list.dart';
|
|
||||||
import 'package:solian/widgets/reports/abuse_report.dart';
|
import 'package:solian/widgets/reports/abuse_report.dart';
|
||||||
import 'package:solian/widgets/root_container.dart';
|
import 'package:solian/widgets/root_container.dart';
|
||||||
import 'package:solian/widgets/sized_container.dart';
|
import 'package:solian/widgets/sized_container.dart';
|
||||||
@ -609,7 +608,7 @@ class _AccountProfilePageState extends State<AccountProfilePage> {
|
|||||||
child: Center(child: CircularProgressIndicator()),
|
child: Center(child: CircularProgressIndicator()),
|
||||||
),
|
),
|
||||||
if (_userinfo != null)
|
if (_userinfo != null)
|
||||||
PostWarpedListWidget(
|
ControlledPostListWidget(
|
||||||
isPinned: false,
|
isPinned: false,
|
||||||
controller: _postController.pagingController,
|
controller: _postController.pagingController,
|
||||||
onUpdate: () => _postController.reloadAllOver(),
|
onUpdate: () => _postController.reloadAllOver(),
|
||||||
|
@ -69,6 +69,8 @@ class _ChatListState extends State<ChatList> {
|
|||||||
|
|
||||||
late final ChannelProvider _channels = Get.find();
|
late final ChannelProvider _channels = Get.find();
|
||||||
|
|
||||||
|
bool _isBusy = true;
|
||||||
|
|
||||||
List<Channel> _sortChannels(List<Channel> channels) {
|
List<Channel> _sortChannels(List<Channel> channels) {
|
||||||
channels.sort(
|
channels.sort(
|
||||||
(a, b) =>
|
(a, b) =>
|
||||||
@ -130,7 +132,12 @@ class _ChatListState extends State<ChatList> {
|
|||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
_loadLastMessages().then((_) {
|
_loadLastMessages().then((_) {
|
||||||
_loadAllChannels();
|
if (!mounted) return;
|
||||||
|
_loadAllChannels().then((_) {
|
||||||
|
if (mounted) {
|
||||||
|
setState(() => _isBusy = false);
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -145,16 +152,7 @@ class _ChatListState extends State<ChatList> {
|
|||||||
child: ResponsiveRootContainer(
|
child: ResponsiveRootContainer(
|
||||||
child: Scaffold(
|
child: Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
leading: Obx(() {
|
leading: AppBarLeadingButton.adaptive(context),
|
||||||
final adaptive = AppBarLeadingButton.adaptive(context);
|
|
||||||
if (adaptive != null) return adaptive;
|
|
||||||
if (_channels.isLoading.value) {
|
|
||||||
return const CircularProgressIndicator(
|
|
||||||
strokeWidth: 3,
|
|
||||||
).paddingAll(18);
|
|
||||||
}
|
|
||||||
return const SizedBox.shrink();
|
|
||||||
}),
|
|
||||||
title: AppBarTitle('chat'.tr),
|
title: AppBarTitle('chat'.tr),
|
||||||
centerTitle: true,
|
centerTitle: true,
|
||||||
toolbarHeight: AppTheme.toolbarHeight(context),
|
toolbarHeight: AppTheme.toolbarHeight(context),
|
||||||
@ -282,6 +280,26 @@ class _ChatListState extends State<ChatList> {
|
|||||||
return Column(
|
return Column(
|
||||||
children: [
|
children: [
|
||||||
const ChatCallCurrentIndicator(),
|
const ChatCallCurrentIndicator(),
|
||||||
|
if (_isBusy)
|
||||||
|
Container(
|
||||||
|
color: Theme.of(context)
|
||||||
|
.colorScheme
|
||||||
|
.surfaceContainerLow
|
||||||
|
.withOpacity(0.8),
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
const SizedBox(
|
||||||
|
height: 16,
|
||||||
|
width: 16,
|
||||||
|
child: CircularProgressIndicator(strokeWidth: 2.5),
|
||||||
|
),
|
||||||
|
const Gap(8),
|
||||||
|
Text('loading'.tr)
|
||||||
|
],
|
||||||
|
).paddingSymmetric(vertical: 8),
|
||||||
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: TabBarView(
|
child: TabBarView(
|
||||||
children: [
|
children: [
|
||||||
|
@ -75,10 +75,12 @@ class _DashboardScreenState extends State<DashboardScreen> {
|
|||||||
final src = Get.find<MessagesFetchingProvider>();
|
final src = Get.find<MessagesFetchingProvider>();
|
||||||
final out = await src.getWhatsNewEvents(_lastRead.messagesLastReadAt!);
|
final out = await src.getWhatsNewEvents(_lastRead.messagesLastReadAt!);
|
||||||
if (out == null) return;
|
if (out == null) return;
|
||||||
setState(() {
|
if (mounted) {
|
||||||
_currentMessages = out.$1;
|
setState(() {
|
||||||
_currentMessagesCount = out.$2;
|
_currentMessages = out.$1;
|
||||||
});
|
_currentMessagesCount = out.$2;
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool _signingDaily = true;
|
bool _signingDaily = true;
|
||||||
|
@ -13,8 +13,8 @@ import 'package:solian/widgets/account/signin_required_overlay.dart';
|
|||||||
import 'package:solian/widgets/current_state_action.dart';
|
import 'package:solian/widgets/current_state_action.dart';
|
||||||
import 'package:solian/widgets/app_bar_leading.dart';
|
import 'package:solian/widgets/app_bar_leading.dart';
|
||||||
import 'package:solian/widgets/navigation/realm_switcher.dart';
|
import 'package:solian/widgets/navigation/realm_switcher.dart';
|
||||||
|
import 'package:solian/widgets/posts/post_list.dart';
|
||||||
import 'package:solian/widgets/posts/post_shuffle_swiper.dart';
|
import 'package:solian/widgets/posts/post_shuffle_swiper.dart';
|
||||||
import 'package:solian/widgets/posts/post_warped_list.dart';
|
|
||||||
import 'package:solian/widgets/root_container.dart';
|
import 'package:solian/widgets/root_container.dart';
|
||||||
|
|
||||||
class ExploreScreen extends StatefulWidget {
|
class ExploreScreen extends StatefulWidget {
|
||||||
@ -80,62 +80,85 @@ class _ExploreScreenState extends State<ExploreScreen>
|
|||||||
body: NestedScrollView(
|
body: NestedScrollView(
|
||||||
headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) {
|
headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) {
|
||||||
return [
|
return [
|
||||||
SliverAppBar(
|
SliverLayoutBuilder(
|
||||||
flexibleSpace: SizedBox(
|
builder: (context, constraints) {
|
||||||
height: 48,
|
final scrollOffset = constraints.scrollOffset;
|
||||||
child: const Row(
|
final colorChangeOffset = 120;
|
||||||
children: [
|
|
||||||
RealmSwitcher(),
|
final scrollProgress =
|
||||||
|
(scrollOffset / colorChangeOffset).clamp(0.0, 1.0);
|
||||||
|
final backgroundColor = Color.lerp(
|
||||||
|
Theme.of(context)
|
||||||
|
.colorScheme
|
||||||
|
.surfaceContainerLow
|
||||||
|
.withOpacity(0),
|
||||||
|
Theme.of(context)
|
||||||
|
.colorScheme
|
||||||
|
.surfaceContainerLow
|
||||||
|
.withOpacity(0.9),
|
||||||
|
scrollProgress,
|
||||||
|
);
|
||||||
|
|
||||||
|
return SliverAppBar(
|
||||||
|
backgroundColor: backgroundColor,
|
||||||
|
flexibleSpace: SizedBox(
|
||||||
|
height: 48,
|
||||||
|
child: const Row(
|
||||||
|
children: [
|
||||||
|
RealmSwitcher(),
|
||||||
|
],
|
||||||
|
).paddingSymmetric(horizontal: 8),
|
||||||
|
).paddingOnly(top: MediaQuery.of(context).padding.top),
|
||||||
|
snap: true,
|
||||||
|
floating: true,
|
||||||
|
toolbarHeight: AppTheme.toolbarHeight(context),
|
||||||
|
leading: AppBarLeadingButton.adaptive(context),
|
||||||
|
actions: [
|
||||||
|
const BackgroundStateWidget(),
|
||||||
|
const NotificationButton(),
|
||||||
|
SizedBox(
|
||||||
|
width: AppTheme.isLargeScreen(context) ? 8 : 16,
|
||||||
|
),
|
||||||
],
|
],
|
||||||
).paddingSymmetric(horizontal: 8),
|
bottom: TabBar(
|
||||||
).paddingOnly(top: MediaQuery.of(context).padding.top),
|
controller: _tabController,
|
||||||
floating: true,
|
dividerHeight: 0.3,
|
||||||
toolbarHeight: AppTheme.toolbarHeight(context),
|
tabAlignment: TabAlignment.fill,
|
||||||
leading: AppBarLeadingButton.adaptive(context),
|
tabs: [
|
||||||
actions: [
|
Tab(
|
||||||
const BackgroundStateWidget(),
|
child: Row(
|
||||||
const NotificationButton(),
|
mainAxisSize: MainAxisSize.min,
|
||||||
SizedBox(
|
children: [
|
||||||
width: AppTheme.isLargeScreen(context) ? 8 : 16,
|
const Icon(Icons.feed, size: 20),
|
||||||
),
|
const Gap(8),
|
||||||
],
|
Text('postListNews'.tr),
|
||||||
bottom: TabBar(
|
],
|
||||||
controller: _tabController,
|
),
|
||||||
dividerHeight: 0.3,
|
),
|
||||||
tabAlignment: TabAlignment.fill,
|
Tab(
|
||||||
tabs: [
|
child: Row(
|
||||||
Tab(
|
mainAxisSize: MainAxisSize.min,
|
||||||
child: Row(
|
children: [
|
||||||
mainAxisSize: MainAxisSize.min,
|
const Icon(Icons.people, size: 20),
|
||||||
children: [
|
const Gap(8),
|
||||||
const Icon(Icons.feed, size: 20),
|
Text('postListFriends'.tr),
|
||||||
const Gap(8),
|
],
|
||||||
Text('postListNews'.tr),
|
),
|
||||||
],
|
),
|
||||||
),
|
Tab(
|
||||||
|
child: Row(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
const Icon(Icons.shuffle_on_outlined, size: 20),
|
||||||
|
const Gap(8),
|
||||||
|
Text('postListShuffle'.tr),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
Tab(
|
);
|
||||||
child: Row(
|
},
|
||||||
mainAxisSize: MainAxisSize.min,
|
|
||||||
children: [
|
|
||||||
const Icon(Icons.people, size: 20),
|
|
||||||
const Gap(8),
|
|
||||||
Text('postListFriends'.tr),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Tab(
|
|
||||||
child: Row(
|
|
||||||
mainAxisSize: MainAxisSize.min,
|
|
||||||
children: [
|
|
||||||
const Icon(Icons.shuffle_on_outlined, size: 20),
|
|
||||||
const Gap(8),
|
|
||||||
Text('postListShuffle'.tr),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
)
|
)
|
||||||
];
|
];
|
||||||
},
|
},
|
||||||
@ -156,7 +179,7 @@ class _ExploreScreenState extends State<ExploreScreen>
|
|||||||
RefreshIndicator(
|
RefreshIndicator(
|
||||||
onRefresh: () => _postController.reloadAllOver(),
|
onRefresh: () => _postController.reloadAllOver(),
|
||||||
child: CustomScrollView(slivers: [
|
child: CustomScrollView(slivers: [
|
||||||
PostWarpedListWidget(
|
ControlledPostListWidget(
|
||||||
controller: _postController.pagingController,
|
controller: _postController.pagingController,
|
||||||
onUpdate: () => _postController.reloadAllOver(),
|
onUpdate: () => _postController.reloadAllOver(),
|
||||||
),
|
),
|
||||||
@ -167,7 +190,7 @@ class _ExploreScreenState extends State<ExploreScreen>
|
|||||||
return RefreshIndicator(
|
return RefreshIndicator(
|
||||||
onRefresh: () => _postController.reloadAllOver(),
|
onRefresh: () => _postController.reloadAllOver(),
|
||||||
child: CustomScrollView(slivers: [
|
child: CustomScrollView(slivers: [
|
||||||
PostWarpedListWidget(
|
ControlledPostListWidget(
|
||||||
controller: _postController.pagingController,
|
controller: _postController.pagingController,
|
||||||
onUpdate: () => _postController.reloadAllOver(),
|
onUpdate: () => _postController.reloadAllOver(),
|
||||||
),
|
),
|
||||||
|
@ -3,7 +3,7 @@ import 'package:get/get.dart';
|
|||||||
import 'package:infinite_scroll_pagination/infinite_scroll_pagination.dart';
|
import 'package:infinite_scroll_pagination/infinite_scroll_pagination.dart';
|
||||||
import 'package:solian/models/pagination.dart';
|
import 'package:solian/models/pagination.dart';
|
||||||
import 'package:solian/providers/content/posts.dart';
|
import 'package:solian/providers/content/posts.dart';
|
||||||
import 'package:solian/widgets/posts/post_warped_list.dart';
|
import 'package:solian/widgets/posts/post_list.dart';
|
||||||
|
|
||||||
import '../../models/post.dart';
|
import '../../models/post.dart';
|
||||||
|
|
||||||
@ -77,7 +77,7 @@ class _FeedSearchScreenState extends State<FeedSearchScreen> {
|
|||||||
onRefresh: () => Future.sync(() => _pagingController.refresh()),
|
onRefresh: () => Future.sync(() => _pagingController.refresh()),
|
||||||
child: CustomScrollView(
|
child: CustomScrollView(
|
||||||
slivers: [
|
slivers: [
|
||||||
PostWarpedListWidget(
|
ControlledPostListWidget(
|
||||||
controller: _pagingController,
|
controller: _pagingController,
|
||||||
onUpdate: () => _pagingController.refresh(),
|
onUpdate: () => _pagingController.refresh(),
|
||||||
),
|
),
|
||||||
|
@ -546,7 +546,6 @@ class _PostEditorTextField extends StatelessWidget {
|
|||||||
final Function onUpdate;
|
final Function onUpdate;
|
||||||
|
|
||||||
const _PostEditorTextField({
|
const _PostEditorTextField({
|
||||||
super.key,
|
|
||||||
required this.focusNode,
|
required this.focusNode,
|
||||||
required this.controller,
|
required this.controller,
|
||||||
required this.onUpdate,
|
required this.onUpdate,
|
||||||
|
@ -15,7 +15,8 @@ import 'package:solian/widgets/sized_container.dart';
|
|||||||
|
|
||||||
class AttachmentList extends StatefulWidget {
|
class AttachmentList extends StatefulWidget {
|
||||||
final String parentId;
|
final String parentId;
|
||||||
final List<String> attachmentsId;
|
final List<String>? attachmentIds;
|
||||||
|
final List<Attachment>? attachments;
|
||||||
final bool isGrid;
|
final bool isGrid;
|
||||||
final bool isColumn;
|
final bool isColumn;
|
||||||
final bool isForceGrid;
|
final bool isForceGrid;
|
||||||
@ -29,7 +30,8 @@ class AttachmentList extends StatefulWidget {
|
|||||||
const AttachmentList({
|
const AttachmentList({
|
||||||
super.key,
|
super.key,
|
||||||
required this.parentId,
|
required this.parentId,
|
||||||
required this.attachmentsId,
|
this.attachmentIds,
|
||||||
|
this.attachments,
|
||||||
this.isGrid = false,
|
this.isGrid = false,
|
||||||
this.isColumn = false,
|
this.isColumn = false,
|
||||||
this.isForceGrid = false,
|
this.isForceGrid = false,
|
||||||
@ -50,21 +52,21 @@ class _AttachmentListState extends State<AttachmentList> {
|
|||||||
|
|
||||||
double _aspectRatio = 1;
|
double _aspectRatio = 1;
|
||||||
|
|
||||||
List<Attachment?> _attachmentsMeta = List.empty();
|
List<Attachment?> _attachments = List.empty();
|
||||||
|
|
||||||
void _getMetadataList() {
|
void _getMetadataList() {
|
||||||
final AttachmentProvider attach = Get.find();
|
final AttachmentProvider attach = Get.find();
|
||||||
|
|
||||||
if (widget.attachmentsId.isEmpty) {
|
if (widget.attachmentIds?.isEmpty ?? false) {
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
_attachmentsMeta = List.filled(widget.attachmentsId.length, null);
|
_attachments = List.filled(widget.attachmentIds!.length, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
attach.listMetadata(widget.attachmentsId).then((result) {
|
attach.listMetadata(widget.attachmentIds!).then((result) {
|
||||||
if (mounted) {
|
if (mounted) {
|
||||||
setState(() {
|
setState(() {
|
||||||
_attachmentsMeta = result;
|
_attachments = result;
|
||||||
_isLoading = false;
|
_isLoading = false;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -76,7 +78,7 @@ class _AttachmentListState extends State<AttachmentList> {
|
|||||||
bool isConsistent = true;
|
bool isConsistent = true;
|
||||||
double? consistentValue;
|
double? consistentValue;
|
||||||
int portrait = 0, square = 0, landscape = 0;
|
int portrait = 0, square = 0, landscape = 0;
|
||||||
for (var entry in _attachmentsMeta) {
|
for (var entry in _attachments) {
|
||||||
if (entry == null) continue;
|
if (entry == null) continue;
|
||||||
if (entry.metadata?['ratio'] != null) {
|
if (entry.metadata?['ratio'] != null) {
|
||||||
if (entry.metadata?['ratio'] is int) {
|
if (entry.metadata?['ratio'] is int) {
|
||||||
@ -117,10 +119,9 @@ class _AttachmentListState extends State<AttachmentList> {
|
|||||||
item: element,
|
item: element,
|
||||||
parentId: widget.parentId,
|
parentId: widget.parentId,
|
||||||
width: width ?? widget.width,
|
width: width ?? widget.width,
|
||||||
badgeContent: '${idx + 1}/${_attachmentsMeta.length}',
|
badgeContent: '${idx + 1}/${_attachments.length}',
|
||||||
showBadge:
|
showBadge: _attachments.length > 1 && !widget.isGrid && !widget.isColumn,
|
||||||
_attachmentsMeta.length > 1 && !widget.isGrid && !widget.isColumn,
|
showBorder: _attachments.length > 1,
|
||||||
showBorder: widget.attachmentsId.length > 1,
|
|
||||||
showMature: _showMature,
|
showMature: _showMature,
|
||||||
autoload: widget.autoload,
|
autoload: widget.autoload,
|
||||||
onReveal: (value) {
|
onReveal: (value) {
|
||||||
@ -132,7 +133,16 @@ class _AttachmentListState extends State<AttachmentList> {
|
|||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
_getMetadataList();
|
assert(widget.attachmentIds != null || widget.attachments != null);
|
||||||
|
if (widget.attachments == null) {
|
||||||
|
_getMetadataList();
|
||||||
|
} else {
|
||||||
|
setState(() {
|
||||||
|
_attachments = widget.attachments!;
|
||||||
|
_isLoading = false;
|
||||||
|
});
|
||||||
|
_calculateAspectRatio();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Color get _unFocusColor =>
|
Color get _unFocusColor =>
|
||||||
@ -140,7 +150,7 @@ class _AttachmentListState extends State<AttachmentList> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
if (widget.attachmentsId.isEmpty) {
|
if (widget.attachmentIds?.isEmpty ?? widget.attachments!.isEmpty) {
|
||||||
return const SizedBox.shrink();
|
return const SizedBox.shrink();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -154,7 +164,7 @@ class _AttachmentListState extends State<AttachmentList> {
|
|||||||
).paddingOnly(right: 5),
|
).paddingOnly(right: 5),
|
||||||
Text(
|
Text(
|
||||||
'attachmentHint'.trParams(
|
'attachmentHint'.trParams(
|
||||||
{'count': widget.attachmentsId.length.toString()},
|
{'count': _attachments.toString()},
|
||||||
),
|
),
|
||||||
style: TextStyle(color: _unFocusColor, fontSize: 12),
|
style: TextStyle(color: _unFocusColor, fontSize: 12),
|
||||||
)
|
)
|
||||||
@ -171,8 +181,8 @@ class _AttachmentListState extends State<AttachmentList> {
|
|||||||
return Wrap(
|
return Wrap(
|
||||||
spacing: 8,
|
spacing: 8,
|
||||||
runSpacing: 8,
|
runSpacing: 8,
|
||||||
children: widget.attachmentsId.map((x) {
|
children: _attachments.map((x) {
|
||||||
final element = _attachmentsMeta[idx];
|
final element = _attachments[idx];
|
||||||
idx++;
|
idx++;
|
||||||
if (element == null) return const SizedBox.shrink();
|
if (element == null) return const SizedBox.shrink();
|
||||||
double ratio = element.metadata?['ratio']?.toDouble() ?? 16 / 9;
|
double ratio = element.metadata?['ratio']?.toDouble() ?? 16 / 9;
|
||||||
@ -202,7 +212,7 @@ class _AttachmentListState extends State<AttachmentList> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
final isNotPureImage = _attachmentsMeta.any(
|
final isNotPureImage = _attachments.any(
|
||||||
(x) => x?.mimetype.split('/').firstOrNull != 'image',
|
(x) => x?.mimetype.split('/').firstOrNull != 'image',
|
||||||
);
|
);
|
||||||
if (widget.isGrid && (widget.isForceGrid || !isNotPureImage)) {
|
if (widget.isGrid && (widget.isForceGrid || !isNotPureImage)) {
|
||||||
@ -213,13 +223,13 @@ class _AttachmentListState extends State<AttachmentList> {
|
|||||||
physics: const NeverScrollableScrollPhysics(),
|
physics: const NeverScrollableScrollPhysics(),
|
||||||
shrinkWrap: true,
|
shrinkWrap: true,
|
||||||
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
||||||
crossAxisCount: math.min(3, widget.attachmentsId.length),
|
crossAxisCount: math.min(3, _attachments.length),
|
||||||
mainAxisSpacing: 8.0,
|
mainAxisSpacing: 8.0,
|
||||||
crossAxisSpacing: 8.0,
|
crossAxisSpacing: 8.0,
|
||||||
),
|
),
|
||||||
itemCount: widget.attachmentsId.length,
|
itemCount: _attachments.length,
|
||||||
itemBuilder: (context, idx) {
|
itemBuilder: (context, idx) {
|
||||||
final element = _attachmentsMeta[idx];
|
final element = _attachments[idx];
|
||||||
return Container(
|
return Container(
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: Theme.of(context).colorScheme.surfaceContainerHigh,
|
color: Theme.of(context).colorScheme.surfaceContainerHigh,
|
||||||
@ -257,12 +267,12 @@ class _AttachmentListState extends State<AttachmentList> {
|
|||||||
animateToClosest: true,
|
animateToClosest: true,
|
||||||
aspectRatio: _aspectRatio,
|
aspectRatio: _aspectRatio,
|
||||||
viewportFraction:
|
viewportFraction:
|
||||||
widget.viewport ?? (widget.attachmentsId.length > 1 ? 0.95 : 1),
|
widget.viewport ?? (_attachments.length > 1 ? 0.95 : 1),
|
||||||
enableInfiniteScroll: false,
|
enableInfiniteScroll: false,
|
||||||
),
|
),
|
||||||
itemCount: _attachmentsMeta.length,
|
itemCount: _attachments.length,
|
||||||
itemBuilder: (context, idx, _) {
|
itemBuilder: (context, idx, _) {
|
||||||
final element = _attachmentsMeta[idx];
|
final element = _attachments[idx];
|
||||||
return _buildEntry(element, idx);
|
return _buildEntry(element, idx);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
@ -78,7 +78,7 @@ class ChatEvent extends StatelessWidget {
|
|||||||
child: AttachmentList(
|
child: AttachmentList(
|
||||||
key: Key('m${item.uuid}attachments'),
|
key: Key('m${item.uuid}attachments'),
|
||||||
parentId: item.uuid,
|
parentId: item.uuid,
|
||||||
attachmentsId: attachments,
|
attachmentIds: attachments,
|
||||||
isColumn: true,
|
isColumn: true,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
@ -455,14 +455,16 @@ class _PostAttachmentWidget extends StatelessWidget {
|
|||||||
if (attachments.length > 3) {
|
if (attachments.length > 3) {
|
||||||
return AttachmentList(
|
return AttachmentList(
|
||||||
parentId: item.id.toString(),
|
parentId: item.id.toString(),
|
||||||
attachmentsId: attachments,
|
attachmentIds: item.preload == null ? attachments : null,
|
||||||
|
attachments: item.preload?.attachments,
|
||||||
autoload: false,
|
autoload: false,
|
||||||
isGrid: true,
|
isGrid: true,
|
||||||
).paddingOnly(left: 36, top: 4, bottom: 4);
|
).paddingOnly(left: 36, top: 4, bottom: 4);
|
||||||
} else if (attachments.length > 1 || isLargeScreen) {
|
} else if (attachments.length > 1 || isLargeScreen) {
|
||||||
return AttachmentList(
|
return AttachmentList(
|
||||||
parentId: item.id.toString(),
|
parentId: item.id.toString(),
|
||||||
attachmentsId: attachments,
|
attachmentIds: item.preload == null ? attachments : null,
|
||||||
|
attachments: item.preload?.attachments,
|
||||||
autoload: false,
|
autoload: false,
|
||||||
isColumn: true,
|
isColumn: true,
|
||||||
).paddingOnly(left: 60, right: 24, top: 4, bottom: 4);
|
).paddingOnly(left: 60, right: 24, top: 4, bottom: 4);
|
||||||
@ -470,7 +472,8 @@ class _PostAttachmentWidget extends StatelessWidget {
|
|||||||
return AttachmentList(
|
return AttachmentList(
|
||||||
flatMaxHeight: MediaQuery.of(context).size.width,
|
flatMaxHeight: MediaQuery.of(context).size.width,
|
||||||
parentId: item.id.toString(),
|
parentId: item.id.toString(),
|
||||||
attachmentsId: attachments,
|
attachmentIds: item.preload == null ? attachments : null,
|
||||||
|
attachments: item.preload?.attachments,
|
||||||
autoload: false,
|
autoload: false,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -48,7 +48,6 @@ class PostListWidget extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class PostListEntryWidget extends StatelessWidget {
|
class PostListEntryWidget extends StatelessWidget {
|
||||||
final int renderOrder;
|
|
||||||
final bool isShowEmbed;
|
final bool isShowEmbed;
|
||||||
final bool isNestedClickable;
|
final bool isNestedClickable;
|
||||||
final bool isClickable;
|
final bool isClickable;
|
||||||
@ -59,7 +58,6 @@ class PostListEntryWidget extends StatelessWidget {
|
|||||||
|
|
||||||
const PostListEntryWidget({
|
const PostListEntryWidget({
|
||||||
super.key,
|
super.key,
|
||||||
this.renderOrder = 0,
|
|
||||||
required this.isShowEmbed,
|
required this.isShowEmbed,
|
||||||
required this.isNestedClickable,
|
required this.isNestedClickable,
|
||||||
required this.isClickable,
|
required this.isClickable,
|
||||||
@ -101,3 +99,46 @@ class PostListEntryWidget extends StatelessWidget {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class ControlledPostListWidget extends StatelessWidget {
|
||||||
|
final bool isShowEmbed;
|
||||||
|
final bool isClickable;
|
||||||
|
final bool isNestedClickable;
|
||||||
|
final bool isPinned;
|
||||||
|
final PagingController<int, Post> controller;
|
||||||
|
final Function? onUpdate;
|
||||||
|
|
||||||
|
const ControlledPostListWidget({
|
||||||
|
super.key,
|
||||||
|
required this.controller,
|
||||||
|
this.isShowEmbed = true,
|
||||||
|
this.isClickable = true,
|
||||||
|
this.isNestedClickable = true,
|
||||||
|
this.isPinned = true,
|
||||||
|
this.onUpdate,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return PagedSliverList<int, Post>.separated(
|
||||||
|
addRepaintBoundaries: true,
|
||||||
|
pagingController: controller,
|
||||||
|
builderDelegate: PagedChildBuilderDelegate<Post>(
|
||||||
|
itemBuilder: (context, item, index) {
|
||||||
|
if (item.pinnedAt != null && !isPinned) {
|
||||||
|
return const SizedBox.shrink();
|
||||||
|
}
|
||||||
|
return PostListEntryWidget(
|
||||||
|
isShowEmbed: isShowEmbed,
|
||||||
|
isNestedClickable: isNestedClickable,
|
||||||
|
isClickable: isClickable,
|
||||||
|
showFeaturedReply: true,
|
||||||
|
item: item,
|
||||||
|
onUpdate: onUpdate ?? () {},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
separatorBuilder: (_, __) => const Divider(thickness: 0.3, height: 0.3),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -1,48 +0,0 @@
|
|||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:infinite_scroll_pagination/infinite_scroll_pagination.dart';
|
|
||||||
import 'package:solian/models/post.dart';
|
|
||||||
import 'package:solian/widgets/posts/post_list.dart';
|
|
||||||
|
|
||||||
class PostWarpedListWidget extends StatelessWidget {
|
|
||||||
final bool isShowEmbed;
|
|
||||||
final bool isClickable;
|
|
||||||
final bool isNestedClickable;
|
|
||||||
final bool isPinned;
|
|
||||||
final PagingController<int, Post> controller;
|
|
||||||
final Function? onUpdate;
|
|
||||||
|
|
||||||
const PostWarpedListWidget({
|
|
||||||
super.key,
|
|
||||||
required this.controller,
|
|
||||||
this.isShowEmbed = true,
|
|
||||||
this.isClickable = true,
|
|
||||||
this.isNestedClickable = true,
|
|
||||||
this.isPinned = true,
|
|
||||||
this.onUpdate,
|
|
||||||
});
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return PagedSliverList<int, Post>.separated(
|
|
||||||
addRepaintBoundaries: true,
|
|
||||||
pagingController: controller,
|
|
||||||
builderDelegate: PagedChildBuilderDelegate<Post>(
|
|
||||||
itemBuilder: (context, item, index) {
|
|
||||||
if (item.pinnedAt != null && !isPinned) {
|
|
||||||
return const SizedBox.shrink();
|
|
||||||
}
|
|
||||||
return PostListEntryWidget(
|
|
||||||
renderOrder: index,
|
|
||||||
isShowEmbed: isShowEmbed,
|
|
||||||
isNestedClickable: isNestedClickable,
|
|
||||||
isClickable: isClickable,
|
|
||||||
showFeaturedReply: true,
|
|
||||||
item: item,
|
|
||||||
onUpdate: onUpdate ?? () {},
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
separatorBuilder: (_, __) => const Divider(thickness: 0.3, height: 0.3),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
@ -340,7 +340,7 @@ EXTERNAL SOURCES:
|
|||||||
SPEC CHECKSUMS:
|
SPEC CHECKSUMS:
|
||||||
connectivity_plus: ddd7f30999e1faaef5967c23d5b6d503d10434db
|
connectivity_plus: ddd7f30999e1faaef5967c23d5b6d503d10434db
|
||||||
desktop_drop: 69eeff437544aa619c8db7f4481b3a65f7696898
|
desktop_drop: 69eeff437544aa619c8db7f4481b3a65f7696898
|
||||||
device_info_plus: ce1b7762849d3ec103d0e0517299f2db7ad60720
|
device_info_plus: f1aae8670672f75c4c8850ecbe0b2ddef62b0a22
|
||||||
file_selector_macos: cc3858c981fe6889f364731200d6232dac1d812d
|
file_selector_macos: cc3858c981fe6889f364731200d6232dac1d812d
|
||||||
Firebase: 98e6bf5278170668a7983e12971a66b2cd57fc8c
|
Firebase: 98e6bf5278170668a7983e12971a66b2cd57fc8c
|
||||||
firebase_analytics: 30ff72f6d4847ff0b479d8edd92fc8582e719072
|
firebase_analytics: 30ff72f6d4847ff0b479d8edd92fc8582e719072
|
||||||
|
@ -346,10 +346,10 @@ packages:
|
|||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
name: device_info_plus
|
name: device_info_plus
|
||||||
sha256: a7fd703482b391a87d60b6061d04dfdeab07826b96f9abd8f5ed98068acc0074
|
sha256: db03b2d2a3fa466a4627709e1db58692c3f7f658e36a5942d342d86efedc4091
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "10.1.2"
|
version: "11.0.0"
|
||||||
device_info_plus_platform_interface:
|
device_info_plus_platform_interface:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -2,7 +2,7 @@ name: solian
|
|||||||
description: "The Solar Network App"
|
description: "The Solar Network App"
|
||||||
publish_to: "none"
|
publish_to: "none"
|
||||||
|
|
||||||
version: 1.3.6+6
|
version: 1.3.7+7
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ">=3.3.4 <4.0.0"
|
sdk: ">=3.3.4 <4.0.0"
|
||||||
@ -38,7 +38,7 @@ dependencies:
|
|||||||
firebase_core: ^3.0.0
|
firebase_core: ^3.0.0
|
||||||
firebase_messaging: ^15.0.0
|
firebase_messaging: ^15.0.0
|
||||||
package_info_plus: ^8.0.0
|
package_info_plus: ^8.0.0
|
||||||
device_info_plus: ^10.1.0
|
device_info_plus: ^11.0.0
|
||||||
flutter_acrylic: ^1.1.4
|
flutter_acrylic: ^1.1.4
|
||||||
protocol_handler: ^0.2.0
|
protocol_handler: ^0.2.0
|
||||||
markdown: ^7.2.2
|
markdown: ^7.2.2
|
||||||
|
9
roadsign.toml
Normal file
9
roadsign.toml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
id = "solian"
|
||||||
|
|
||||||
|
[[locations]]
|
||||||
|
id = "solian"
|
||||||
|
host = ["sn.solsynth.dev"]
|
||||||
|
path = ["/"]
|
||||||
|
[[locations.destinations]]
|
||||||
|
id = "solian-web"
|
||||||
|
uri = "files:///workdir/solian?fallback=index.html&index=index.html"
|
Reference in New Issue
Block a user