Compare commits

...

5 Commits

6 changed files with 46 additions and 30 deletions

View File

@@ -126,6 +126,7 @@ class TabsScreen extends HookConsumerWidget {
return Scaffold( return Scaffold(
backgroundColor: Colors.transparent, backgroundColor: Colors.transparent,
extendBody: true, extendBody: true,
resizeToAvoidBottomInset: false,
body: ClipRRect( body: ClipRRect(
borderRadius: const BorderRadius.only( borderRadius: const BorderRadius.only(
topLeft: Radius.circular(16), topLeft: Radius.circular(16),

View File

@@ -314,28 +314,22 @@ class AppScaffold extends HookConsumerWidget {
final noBackground = isNoBackground ?? isWideScreen(context); final noBackground = isNoBackground ?? isWideScreen(context);
final content = Column( final builtWidget = Focus(
children: [
IgnorePointer(
child: SizedBox(height: appBar != null ? appBarHeight + safeTop : 0),
),
if (body != null) Expanded(child: body!),
],
);
return Focus(
focusNode: focusNode, focusNode: focusNode,
child: Scaffold( child: Scaffold(
extendBody: extendBody ?? true, extendBody: extendBody ?? true,
extendBodyBehindAppBar: true, extendBodyBehindAppBar: true,
backgroundColor: backgroundColor: Colors.transparent,
noBackground body: Column(
? Colors.transparent children: [
: Theme.of(context).scaffoldBackgroundColor, IgnorePointer(
body: child: SizedBox(
noBackground height: appBar != null ? appBarHeight + safeTop : 0,
? content ),
: AppBackground(isRoot: true, child: content), ),
if (body != null) Expanded(child: body!),
],
),
appBar: appBar, appBar: appBar,
bottomNavigationBar: bottomNavigationBar, bottomNavigationBar: bottomNavigationBar,
bottomSheet: bottomSheet, bottomSheet: bottomSheet,
@@ -348,6 +342,10 @@ class AppScaffold extends HookConsumerWidget {
onEndDrawerChanged: onEndDrawerChanged, onEndDrawerChanged: onEndDrawerChanged,
), ),
); );
return noBackground
? builtWidget
: AppBackground(isRoot: true, child: builtWidget);
} }
} }

View File

@@ -550,11 +550,13 @@ class ChatInput extends HookConsumerWidget {
final triggerIndex = final triggerIndex =
atIndex > colonIndex ? atIndex : colonIndex; atIndex > colonIndex ? atIndex : colonIndex;
if (triggerIndex == -1) return []; if (triggerIndex == -1) return [];
final chopped = pattern.substring(triggerIndex);
if (chopped.contains(' ')) return [];
final service = ref.read(autocompleteServiceProvider); final service = ref.read(autocompleteServiceProvider);
try { try {
return await service.getSuggestions( return await service.getSuggestions(
chatRoom.id, chatRoom.id,
pattern, chopped,
); );
} catch (e) { } catch (e) {
return []; return [];
@@ -645,7 +647,7 @@ class ChatInput extends HookConsumerWidget {
direction: VerticalDirection.up, direction: VerticalDirection.up,
hideOnEmpty: true, hideOnEmpty: true,
hideOnLoading: true, hideOnLoading: true,
debounceDuration: const Duration(milliseconds: 500), debounceDuration: const Duration(milliseconds: 1000),
), ),
), ),
IconButton( IconButton(

View File

@@ -23,12 +23,12 @@ class PostComposeDialog extends HookConsumerWidget {
this.isBottomSheet = false, this.isBottomSheet = false,
}); });
static Future<SnPost?> show( static Future<bool?> show(
BuildContext context, { BuildContext context, {
SnPost? originalPost, SnPost? originalPost,
PostComposeInitialState? initialState, PostComposeInitialState? initialState,
}) { }) {
return showDialog<SnPost>( return showDialog<bool>(
context: context, context: context,
useRootNavigator: true, useRootNavigator: true,
builder: builder:

View File

@@ -149,9 +149,11 @@ class ComposeFormFields extends HookConsumerWidget {
final triggerIndex = final triggerIndex =
atIndex > colonIndex ? atIndex : colonIndex; atIndex > colonIndex ? atIndex : colonIndex;
if (triggerIndex == -1) return []; if (triggerIndex == -1) return [];
final chopped = pattern.substring(triggerIndex);
if (chopped.contains(' ')) return [];
final service = ref.read(autocompleteServiceProvider); final service = ref.read(autocompleteServiceProvider);
try { try {
return await service.getGeneralSuggestions(pattern); return await service.getGeneralSuggestions(chopped);
} catch (e) { } catch (e) {
return []; return [];
} }
@@ -235,7 +237,7 @@ class ComposeFormFields extends HookConsumerWidget {
direction: VerticalDirection.down, direction: VerticalDirection.down,
hideOnEmpty: true, hideOnEmpty: true,
hideOnLoading: true, hideOnLoading: true,
debounceDuration: const Duration(milliseconds: 500), debounceDuration: const Duration(milliseconds: 1000),
), ),
], ],
), ),

View File

@@ -68,21 +68,24 @@ class PostQuickReply extends HookConsumerWidget {
} }
} }
const kInputChipHeight = 54.0;
return publishers.when( return publishers.when(
data: data:
(data) => Material( (data) => Material(
elevation: 2, elevation: 2,
color: Theme.of(context).colorScheme.surfaceContainerHighest, color: Theme.of(context).colorScheme.surfaceContainerHighest,
borderRadius: BorderRadius.circular(20), borderRadius: BorderRadius.circular(28),
child: Padding( child: Container(
padding: const EdgeInsets.symmetric(vertical: 6, horizontal: 8), constraints: BoxConstraints(minHeight: kInputChipHeight),
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 6),
child: Row( child: Row(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
GestureDetector( GestureDetector(
child: ProfilePictureWidget( child: ProfilePictureWidget(
fileId: currentPublisher.value?.picture?.id, fileId: currentPublisher.value?.picture?.id,
radius: 16, radius: (kInputChipHeight * 0.5) - 6,
), ),
onTap: () { onTap: () {
showModalBottomSheet( showModalBottomSheet(
@@ -106,11 +109,13 @@ class PostQuickReply extends HookConsumerWidget {
isCollapsed: true, isCollapsed: true,
contentPadding: EdgeInsets.symmetric( contentPadding: EdgeInsets.symmetric(
horizontal: 12, horizontal: 12,
vertical: 9, vertical: 14,
), ),
visualDensity: VisualDensity.compact,
), ),
style: TextStyle(fontSize: 14), style: TextStyle(fontSize: 14),
maxLines: null, minLines: 1,
maxLines: 5,
onTapOutside: onTapOutside:
(_) => FocusManager.instance.primaryFocus?.unfocus(), (_) => FocusManager.instance.primaryFocus?.unfocus(),
), ),
@@ -130,6 +135,10 @@ class PostQuickReply extends HookConsumerWidget {
}, },
icon: const Icon(Symbols.launch, size: 20), icon: const Icon(Symbols.launch, size: 20),
visualDensity: VisualDensity.compact, visualDensity: VisualDensity.compact,
constraints: BoxConstraints(
maxHeight: kInputChipHeight - 6,
minHeight: kInputChipHeight - 6,
),
), ),
IconButton( IconButton(
icon: icon:
@@ -143,6 +152,10 @@ class PostQuickReply extends HookConsumerWidget {
color: Theme.of(context).colorScheme.primary, color: Theme.of(context).colorScheme.primary,
onPressed: submitting.value ? null : performAction, onPressed: submitting.value ? null : performAction,
visualDensity: VisualDensity.compact, visualDensity: VisualDensity.compact,
constraints: BoxConstraints(
maxHeight: kInputChipHeight - 6,
minHeight: kInputChipHeight - 6,
),
), ),
], ],
), ),