🐛 Fix bottom sheet didn't avoid keyboard
This commit is contained in:
@@ -33,6 +33,7 @@ class SheetScaffold extends StatelessWidget {
|
|||||||
);
|
);
|
||||||
|
|
||||||
return Container(
|
return Container(
|
||||||
|
padding: MediaQuery.of(context).viewInsets,
|
||||||
constraints: BoxConstraints(
|
constraints: BoxConstraints(
|
||||||
maxHeight: height ?? MediaQuery.of(context).size.height * heightFactor,
|
maxHeight: height ?? MediaQuery.of(context).size.height * heightFactor,
|
||||||
),
|
),
|
||||||
|
@@ -864,22 +864,22 @@ class PostReplyPreview extends HookConsumerWidget {
|
|||||||
: featuredReply!.when(
|
: featuredReply!.when(
|
||||||
data:
|
data:
|
||||||
(value) => Row(
|
(value) => Row(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
spacing: 8,
|
spacing: 8,
|
||||||
children: [
|
children: [
|
||||||
ProfilePictureWidget(
|
ProfilePictureWidget(
|
||||||
file: value!.publisher.picture,
|
file: value?.publisher.picture,
|
||||||
radius: 12,
|
radius: 12,
|
||||||
).padding(top: 4),
|
).padding(top: 4),
|
||||||
if (value.content?.isNotEmpty ?? false)
|
if (value?.content?.isNotEmpty ?? false)
|
||||||
Expanded(
|
Expanded(
|
||||||
child: MarkdownTextContent(content: value.content!),
|
child: MarkdownTextContent(content: value!.content!),
|
||||||
)
|
)
|
||||||
else
|
else
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Text(
|
child: Text(
|
||||||
'postHasAttachments',
|
'postHasAttachments',
|
||||||
).plural(value.attachments.length),
|
).plural(value?.attachments.length ?? 0),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
@@ -284,7 +284,7 @@ class _ShareSheetState extends ConsumerState<ShareSheet> {
|
|||||||
|
|
||||||
// Send message to chat room
|
// Send message to chat room
|
||||||
await apiClient.post(
|
await apiClient.post(
|
||||||
'/chat/${chatRoom.id}/messages',
|
'/sphere/chat/${chatRoom.id}/messages',
|
||||||
data: {'content': content, 'attachments_id': attachmentIds, 'meta': {}},
|
data: {'content': content, 'attachments_id': attachmentIds, 'meta': {}},
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -328,12 +328,7 @@ class _ShareSheetState extends ConsumerState<ShareSheet> {
|
|||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (mounted) {
|
if (mounted) {
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
showSnackBar('Failed to share to chat: $e');
|
||||||
SnackBar(
|
|
||||||
content: Text('Failed to share to chat: $e'),
|
|
||||||
backgroundColor: Theme.of(context).colorScheme.error,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
if (mounted) {
|
if (mounted) {
|
||||||
@@ -405,151 +400,137 @@ class _ShareSheetState extends ConsumerState<ShareSheet> {
|
|||||||
children: [
|
children: [
|
||||||
// Share options with keyboard avoidance
|
// Share options with keyboard avoidance
|
||||||
Expanded(
|
Expanded(
|
||||||
child: AnimatedPadding(
|
child: SingleChildScrollView(
|
||||||
duration: const Duration(milliseconds: 300),
|
child: Column(
|
||||||
padding: EdgeInsets.only(
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
bottom: MediaQuery.of(context).viewInsets.bottom,
|
children: [
|
||||||
),
|
// Content preview
|
||||||
child: SingleChildScrollView(
|
Container(
|
||||||
child: Column(
|
margin: const EdgeInsets.all(16),
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
padding: const EdgeInsets.all(16),
|
||||||
children: [
|
decoration: BoxDecoration(
|
||||||
// Content preview
|
color:
|
||||||
Container(
|
Theme.of(context).colorScheme.surfaceContainerHighest,
|
||||||
margin: const EdgeInsets.all(16),
|
borderRadius: BorderRadius.circular(12),
|
||||||
padding: const EdgeInsets.all(16),
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color:
|
|
||||||
Theme.of(
|
|
||||||
context,
|
|
||||||
).colorScheme.surfaceContainerHighest,
|
|
||||||
borderRadius: BorderRadius.circular(12),
|
|
||||||
),
|
|
||||||
child: Column(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
'contentToShare'.tr(),
|
|
||||||
style: Theme.of(
|
|
||||||
context,
|
|
||||||
).textTheme.labelMedium?.copyWith(
|
|
||||||
color:
|
|
||||||
Theme.of(
|
|
||||||
context,
|
|
||||||
).colorScheme.onSurfaceVariant,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 8),
|
|
||||||
_ContentPreview(content: widget.content),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
// Quick actions row (horizontally scrollable)
|
child: Column(
|
||||||
Padding(
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
children: [
|
||||||
child: Column(
|
Text(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
'contentToShare'.tr(),
|
||||||
children: [
|
style: Theme.of(
|
||||||
Text(
|
context,
|
||||||
'quickActions'.tr(),
|
).textTheme.labelMedium?.copyWith(
|
||||||
style: Theme.of(
|
color:
|
||||||
context,
|
Theme.of(context).colorScheme.onSurfaceVariant,
|
||||||
).textTheme.titleSmall?.copyWith(
|
|
||||||
color:
|
|
||||||
Theme.of(
|
|
||||||
context,
|
|
||||||
).colorScheme.onSurfaceVariant,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
const SizedBox(height: 12),
|
),
|
||||||
SizedBox(
|
const SizedBox(height: 8),
|
||||||
height: 80,
|
_ContentPreview(content: widget.content),
|
||||||
child: ListView(
|
],
|
||||||
scrollDirection: Axis.horizontal,
|
),
|
||||||
children: [
|
),
|
||||||
_CompactShareOption(
|
// Quick actions row (horizontally scrollable)
|
||||||
icon: Symbols.post_add,
|
Padding(
|
||||||
title: 'post'.tr(),
|
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||||
onTap: _isLoading ? null : _shareToPost,
|
child: Column(
|
||||||
),
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
'quickActions'.tr(),
|
||||||
|
style: Theme.of(
|
||||||
|
context,
|
||||||
|
).textTheme.titleSmall?.copyWith(
|
||||||
|
color:
|
||||||
|
Theme.of(context).colorScheme.onSurfaceVariant,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 12),
|
||||||
|
SizedBox(
|
||||||
|
height: 80,
|
||||||
|
child: ListView(
|
||||||
|
scrollDirection: Axis.horizontal,
|
||||||
|
children: [
|
||||||
|
_CompactShareOption(
|
||||||
|
icon: Symbols.post_add,
|
||||||
|
title: 'post'.tr(),
|
||||||
|
onTap: _isLoading ? null : _shareToPost,
|
||||||
|
),
|
||||||
|
const SizedBox(width: 12),
|
||||||
|
_CompactShareOption(
|
||||||
|
icon: Symbols.content_copy,
|
||||||
|
title: 'copy'.tr(),
|
||||||
|
onTap: _isLoading ? null : _copyToClipboard,
|
||||||
|
),
|
||||||
|
if (widget.toSystem) ...<Widget>[
|
||||||
const SizedBox(width: 12),
|
const SizedBox(width: 12),
|
||||||
_CompactShareOption(
|
_CompactShareOption(
|
||||||
icon: Symbols.content_copy,
|
icon: Symbols.share,
|
||||||
title: 'copy'.tr(),
|
title: 'share'.tr(),
|
||||||
onTap: _isLoading ? null : _copyToClipboard,
|
onTap: _isLoading ? null : _shareToSystem,
|
||||||
),
|
),
|
||||||
if (widget.toSystem) ...<Widget>[
|
|
||||||
const SizedBox(width: 12),
|
|
||||||
_CompactShareOption(
|
|
||||||
icon: Symbols.share,
|
|
||||||
title: 'share'.tr(),
|
|
||||||
onTap: _isLoading ? null : _shareToSystem,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
],
|
],
|
||||||
),
|
],
|
||||||
),
|
),
|
||||||
],
|
),
|
||||||
),
|
],
|
||||||
),
|
),
|
||||||
|
),
|
||||||
|
|
||||||
const SizedBox(height: 24),
|
const SizedBox(height: 24),
|
||||||
|
|
||||||
// Chat section
|
// Chat section
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
'sendToChat'.tr(),
|
'sendToChat'.tr(),
|
||||||
style: Theme.of(
|
style: Theme.of(
|
||||||
context,
|
context,
|
||||||
).textTheme.titleSmall?.copyWith(
|
).textTheme.titleSmall?.copyWith(
|
||||||
color:
|
color:
|
||||||
Theme.of(
|
Theme.of(context).colorScheme.onSurfaceVariant,
|
||||||
context,
|
|
||||||
).colorScheme.onSurfaceVariant,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
const SizedBox(height: 12),
|
),
|
||||||
|
const SizedBox(height: 12),
|
||||||
|
|
||||||
// Additional message input
|
// Additional message input
|
||||||
Container(
|
Container(
|
||||||
margin: const EdgeInsets.only(bottom: 16),
|
margin: const EdgeInsets.only(bottom: 16),
|
||||||
child: TextField(
|
child: TextField(
|
||||||
controller: _messageController,
|
controller: _messageController,
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
hintText: 'addAdditionalMessage'.tr(),
|
hintText: 'addAdditionalMessage'.tr(),
|
||||||
border: OutlineInputBorder(
|
border: OutlineInputBorder(
|
||||||
borderRadius: BorderRadius.circular(12),
|
borderRadius: BorderRadius.circular(12),
|
||||||
),
|
),
|
||||||
contentPadding: const EdgeInsets.symmetric(
|
contentPadding: const EdgeInsets.symmetric(
|
||||||
horizontal: 16,
|
horizontal: 16,
|
||||||
vertical: 12,
|
vertical: 12,
|
||||||
),
|
|
||||||
),
|
),
|
||||||
onTapOutside:
|
|
||||||
(_) =>
|
|
||||||
FocusManager.instance.primaryFocus
|
|
||||||
?.unfocus(),
|
|
||||||
maxLines: 3,
|
|
||||||
minLines: 1,
|
|
||||||
enabled: !_isLoading,
|
|
||||||
),
|
),
|
||||||
|
onTapOutside:
|
||||||
|
(_) =>
|
||||||
|
FocusManager.instance.primaryFocus
|
||||||
|
?.unfocus(),
|
||||||
|
maxLines: 3,
|
||||||
|
minLines: 1,
|
||||||
|
enabled: !_isLoading,
|
||||||
),
|
),
|
||||||
|
),
|
||||||
|
|
||||||
_ChatRoomsList(
|
_ChatRoomsList(
|
||||||
onChatSelected:
|
onChatSelected:
|
||||||
_isLoading ? null : _shareToSpecificChat,
|
_isLoading ? null : _shareToSpecificChat,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
|
||||||
),
|
),
|
||||||
|
),
|
||||||
|
|
||||||
const SizedBox(height: 16),
|
const SizedBox(height: 16),
|
||||||
],
|
],
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
Reference in New Issue
Block a user