🐛 Bug fixes and optimization

This commit is contained in:
2025-10-12 20:45:10 +08:00
parent e2d315afd4
commit ad9fb0719a
7 changed files with 186 additions and 57 deletions

View File

@@ -97,7 +97,7 @@ class WindowScaffold extends HookConsumerWidget {
LogicalKeySet(LogicalKeyboardKey.escape): const PopIntent(),
},
child: Actions(
actions: <Type, Action<Intent>>{PopIntent: PopAction(context)},
actions: <Type, Action<Intent>>{PopIntent: PopAction(ref)},
child: Material(
color: Theme.of(context).colorScheme.surfaceContainer,
child: Stack(
@@ -206,7 +206,7 @@ class WindowScaffold extends HookConsumerWidget {
LogicalKeySet(LogicalKeyboardKey.escape): const PopIntent(),
},
child: Actions(
actions: <Type, Action<Intent>>{PopIntent: PopAction(context)},
actions: <Type, Action<Intent>>{PopIntent: PopAction(ref)},
child: Stack(
fit: StackFit.expand,
children: [Positioned.fill(child: child), _WebSocketIndicator()],
@@ -351,14 +351,14 @@ class PopIntent extends Intent {
}
class PopAction extends Action<PopIntent> {
final BuildContext context;
final WidgetRef ref;
PopAction(this.context);
PopAction(this.ref);
@override
void invoke(PopIntent intent) {
if (context.canPop()) {
context.pop();
if (ref.watch(routerProvider).canPop()) {
ref.read(routerProvider).pop();
}
}
}

View File

@@ -24,7 +24,7 @@ import "package:material_symbols_icons/material_symbols_icons.dart";
import "package:pasteboard/pasteboard.dart";
import "package:styled_widget/styled_widget.dart";
import "package:material_symbols_icons/symbols.dart";
import "package:island/widgets/stickers/picker.dart";
import "package:island/widgets/stickers/sticker_picker.dart";
import "package:island/pods/chat/chat_subscribe.dart";
class ChatInput extends HookConsumerWidget {
@@ -524,9 +524,6 @@ class ChatInput extends HookConsumerWidget {
hideOnEmpty: true,
hideOnLoading: true,
debounceDuration: const Duration(milliseconds: 500),
loadingBuilder: (context) => const Text('Loading...'),
errorBuilder: (context, error) => const Text('Error!'),
emptyBuilder: (context) => const Text('No items found!'),
),
),
IconButton(

View File

@@ -236,9 +236,6 @@ class ComposeFormFields extends HookConsumerWidget {
hideOnEmpty: true,
hideOnLoading: true,
debounceDuration: const Duration(milliseconds: 500),
loadingBuilder: (context) => const Text('Loading...'),
errorBuilder: (context, error) => const Text('Error!'),
emptyBuilder: (context) => const Text('No items found!'),
),
],
),

View File

@@ -14,7 +14,7 @@ import 'package:styled_widget/styled_widget.dart';
import 'package:flutter_popup_card/flutter_popup_card.dart';
import 'package:island/widgets/extended_refresh_indicator.dart';
part 'picker.g.dart';
part 'sticker_picker.g.dart';
/// Fetch user-added sticker packs (with stickers) from API:
/// GET /sphere/stickers/me
@@ -34,7 +34,7 @@ Future<List<SnStickerPack>> myStickerPacks(Ref ref) async {
/// Sticker Picker popover dialog
/// - Displays user-owned sticker packs as tabs (chips)
/// - Shows grid of stickers in selected pack
/// - On tap, returns placeholder string :{prefix}{slug}: via onPick callback
/// - On tap, returns placeholder string :{prefix}+{slug}: via onPick callback
class StickerPicker extends HookConsumerWidget {
final void Function(String placeholder) onPick;
@@ -63,7 +63,7 @@ class StickerPicker extends HookConsumerWidget {
return _PackSwitcher(
packs: packs,
onPick: (pack, sticker) {
final placeholder = ':${pack.prefix}${sticker.slug}:';
final placeholder = ':${pack.prefix}+${sticker.slug}:';
HapticFeedback.selectionClick();
onPick(placeholder);
if (Navigator.of(context).canPop()) {

View File

@@ -1,6 +1,6 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'picker.dart';
part of 'sticker_picker.dart';
// **************************************************************************
// RiverpodGenerator