🐛 Dozens of bug fixes

This commit is contained in:
2025-07-20 02:31:50 +08:00
parent 903008d397
commit 18db50d80c
33 changed files with 359 additions and 318 deletions

View File

@@ -67,7 +67,8 @@ class FortuneGraphWidget extends HookConsumerWidget {
constraints: const BoxConstraints(),
onPressed: () {
context.pushNamed(
'/account/$eventCalanderUser/calendar',
'accountCalendar',
pathParameters: {'name': eventCalanderUser!},
);
},
),

View File

@@ -38,7 +38,8 @@ class CloudFileList extends HookConsumerWidget {
double calculateAspectRatio() {
double total = 0;
for (var ratio in files.map((e) => e.fileMeta?['ratio'] ?? 1)) {
total += double.parse(ratio);
if (ratio is double) total += ratio;
if (ratio is String) total += double.parse(ratio);
}
if (total == 0) return 1;
return total / files.length;
@@ -78,6 +79,7 @@ class CloudFileList extends HookConsumerWidget {
if (!disableZoomIn) {
context.pushTransparentRoute(
CloudFileZoomIn(item: files.first, heroTag: heroTags.first),
rootNavigator: true,
);
}
},
@@ -505,7 +507,7 @@ class _CloudFileListEntry extends StatelessWidget {
if (isImage)
Positioned.fill(
child:
file.fileMeta?['blur'] != null
file.fileMeta?['blur'] is String
? BlurHash(hash: file.fileMeta?['blur'])
: ImageFiltered(
imageFilter: ImageFilter.blur(sigmaX: 10, sigmaY: 10),

View File

@@ -30,7 +30,9 @@ class CloudFileWidget extends ConsumerWidget {
var ratio =
item.fileMeta?['ratio'] is num
? item.fileMeta!['ratio'].toDouble()
: double.parse(item.fileMeta?['ratio'] ?? 1);
: item.fileMeta?['ratio'] is String
? double.parse(item.fileMeta!['ratio'])
: 1.0;
if (ratio == 0) ratio = 1.0;
final content = switch (item.mimeType?.split('/').firstOrNull) {
"image" => AspectRatio(

View File

@@ -72,7 +72,10 @@ class PostItem extends HookConsumerWidget {
children: [
GestureDetector(
onTap: () {
context.pushNamed('publisherProfile', pathParameters: {'name': item.publisher.name});
context.pushNamed(
'publisherProfile',
pathParameters: {'name': item.publisher.name},
);
},
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
@@ -254,7 +257,10 @@ class PostItem extends HookConsumerWidget {
GestureDetector(
child: ProfilePictureWidget(file: item.publisher.picture),
onTap: () {
context.pushNamed('publisherProfile', pathParameters: {'name': item.publisher.name});
context.pushNamed(
'publisherProfile',
pathParameters: {'name': item.publisher.name},
);
},
),
Expanded(
@@ -427,7 +433,10 @@ class PostItem extends HookConsumerWidget {
),
onTap: () {
if (isOpenable) {
context.pushNamed('postDetail', pathParameters: {'id': item.id});
context.pushNamed(
'postDetail',
pathParameters: {'id': item.id},
);
}
},
),
@@ -496,11 +505,13 @@ class PostItem extends HookConsumerWidget {
title: 'edit'.tr(),
image: MenuImage.icon(Symbols.edit),
callback: () {
context.pushNamed('postEdit', pathParameters: {'id': item.id}).then((value) {
if (value != null) {
onRefresh?.call();
}
});
context
.pushNamed('postEdit', pathParameters: {'id': item.id})
.then((value) {
if (value != null) {
onRefresh?.call();
}
});
},
),
if (isAuthor)
@@ -732,7 +743,13 @@ Widget _buildReferencePost(BuildContext context, SnPost item) {
),
],
),
).gestures(onTap: () => context.pushNamed('postDetail', pathParameters: {'id': referencePost.id}));
).gestures(
onTap:
() => context.pushNamed(
'postDetail',
pathParameters: {'id': referencePost.id},
),
);
}
class PostReactionList extends HookConsumerWidget {
@@ -757,7 +774,7 @@ class PostReactionList extends HookConsumerWidget {
submitting.value = true;
await client
.post(
'/posts/$parentId/reactions',
'/sphere/posts/$parentId/reactions',
data: {'symbol': symbol, 'attitude': attitude},
)
.catchError((err) {

View File

@@ -43,7 +43,7 @@ class PostQuickReply extends HookConsumerWidget {
try {
final client = ref.watch(apiClientProvider);
await client.post(
'/posts',
'/sphere/posts',
data: {
'content': contentController.text,
'replied_post_id': parent.id,

View File

@@ -35,7 +35,7 @@ class PostRepliesNotifier extends _$PostRepliesNotifier
final offset = cursor == null ? 0 : int.parse(cursor);
final response = await client.get(
'/posts/$_postId/replies',
'/sphere/posts/$_postId/replies',
queryParameters: {'offset': offset, 'take': _pageSize},
);
@@ -57,7 +57,11 @@ class PostRepliesNotifier extends _$PostRepliesNotifier
class PostRepliesList extends HookConsumerWidget {
final String postId;
final Color? backgroundColor;
const PostRepliesList({super.key, required this.postId, this.backgroundColor});
const PostRepliesList({
super.key,
required this.postId,
this.backgroundColor,
});
@override
Widget build(BuildContext context, WidgetRef ref) {
@@ -93,7 +97,8 @@ class PostRepliesList extends HookConsumerWidget {
children: [
PostItem(
item: data.items[index],
backgroundColor: backgroundColor ?? (isWide ? Colors.transparent : null),
backgroundColor:
backgroundColor ?? (isWide ? Colors.transparent : null),
showReferencePost: false,
),
const Divider(height: 1),

View File

@@ -7,7 +7,7 @@ part of 'post_replies.dart';
// **************************************************************************
String _$postRepliesNotifierHash() =>
r'49c178102ec0a4136974a0e9a8f090f511abd542';
r'1cdda919249e3bf34459369e033ad5de8dbcf3f8';
/// Copied from Dart SDK
class _SystemHash {

View File

@@ -6,7 +6,7 @@ part of 'realm_list.dart';
// RiverpodGenerator
// **************************************************************************
String _$realmListNotifierHash() => r'02dee373a5609a5617b04ffec395d09dea7ae070';
String _$realmListNotifierHash() => r'8ae5c3ae2837acae4c7bf5e44578518afc9ea1a6';
/// Copied from Dart SDK
class _SystemHash {

View File

@@ -43,7 +43,7 @@ class AbuseReportSheet extends HookConsumerWidget {
try {
final client = ref.read(apiClientProvider);
await client.post(
'/safety/reports',
'/id/safety/reports',
data: {
'resource_identifier': resourceIdentifier,
'type': selectedType.value,