🐛 Fix share sheet
This commit is contained in:
parent
f2829b2012
commit
e90b35f19f
@ -587,6 +587,11 @@
|
|||||||
"addAdditionalMessage": "Add additional message...",
|
"addAdditionalMessage": "Add additional message...",
|
||||||
"uploadingFiles": "Uploading files...",
|
"uploadingFiles": "Uploading files...",
|
||||||
"sharedSuccessfully": "Shared successfully!",
|
"sharedSuccessfully": "Shared successfully!",
|
||||||
|
"shareSuccess": "Shared successfully!",
|
||||||
|
"shareToSpecificChatSuccess": "Shared to {} successfully!",
|
||||||
|
"wouldYouLikeToGoToChat": "Would you like to go to the chat?",
|
||||||
|
"no": "No",
|
||||||
|
"yes": "Yes",
|
||||||
"navigateToChat": "Navigate to Chat",
|
"navigateToChat": "Navigate to Chat",
|
||||||
"wouldYouLikeToNavigateToChat": "Would you like to navigate to the chat?",
|
"wouldYouLikeToNavigateToChat": "Would you like to navigate to the chat?",
|
||||||
"abuseReport": "Report",
|
"abuseReport": "Report",
|
||||||
|
@ -177,10 +177,10 @@ class _ShareSheetState extends ConsumerState<ShareSheet> {
|
|||||||
);
|
);
|
||||||
|
|
||||||
// Navigate to compose screen
|
// Navigate to compose screen
|
||||||
if (mounted) {
|
if (mounted) {
|
||||||
context.push('/posts/compose', extra: initialState);
|
context.push('/posts/compose', extra: initialState);
|
||||||
Navigator.of(context).pop(); // Close the share sheet
|
Navigator.of(context).pop(); // Close the share sheet
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
showErrorAlert(e);
|
showErrorAlert(e);
|
||||||
} finally {
|
} finally {
|
||||||
@ -404,132 +404,153 @@ class _ShareSheetState extends ConsumerState<ShareSheet> {
|
|||||||
heightFactor: 0.75,
|
heightFactor: 0.75,
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
// Content preview
|
// Share options with keyboard avoidance
|
||||||
Container(
|
|
||||||
margin: const EdgeInsets.all(16),
|
|
||||||
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),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
|
|
||||||
// Share options
|
|
||||||
Expanded(
|
Expanded(
|
||||||
child: SingleChildScrollView(
|
child: AnimatedPadding(
|
||||||
child: Column(
|
duration: const Duration(milliseconds: 300),
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
padding: EdgeInsets.only(
|
||||||
children: [
|
bottom: MediaQuery.of(context).viewInsets.bottom,
|
||||||
// Quick actions row (horizontally scrollable)
|
),
|
||||||
Padding(
|
child: SingleChildScrollView(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
child: Column(
|
||||||
child: Column(
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
children: [
|
||||||
children: [
|
// Content preview
|
||||||
Text(
|
Container(
|
||||||
'quickActions'.tr(),
|
margin: const EdgeInsets.all(16),
|
||||||
style: Theme.of(
|
padding: const EdgeInsets.all(16),
|
||||||
context,
|
decoration: BoxDecoration(
|
||||||
).textTheme.titleSmall?.copyWith(
|
color:
|
||||||
color:
|
Theme.of(
|
||||||
Theme.of(context).colorScheme.onSurfaceVariant,
|
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),
|
||||||
const SizedBox(height: 12),
|
_ContentPreview(content: widget.content),
|
||||||
SizedBox(
|
],
|
||||||
height: 80,
|
),
|
||||||
child: ListView(
|
),
|
||||||
scrollDirection: Axis.horizontal,
|
// Quick actions row (horizontally scrollable)
|
||||||
children: [
|
Padding(
|
||||||
_CompactShareOption(
|
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||||
icon: Symbols.post_add,
|
child: Column(
|
||||||
title: 'post'.tr(),
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
onTap: _isLoading ? null : _shareToPost,
|
children: [
|
||||||
),
|
Text(
|
||||||
const SizedBox(width: 12),
|
'quickActions'.tr(),
|
||||||
_CompactShareOption(
|
style: Theme.of(
|
||||||
icon: Symbols.content_copy,
|
context,
|
||||||
title: 'copy'.tr(),
|
).textTheme.titleSmall?.copyWith(
|
||||||
onTap: _isLoading ? null : _copyToClipboard,
|
color:
|
||||||
),
|
Theme.of(
|
||||||
if (widget.toSystem) ...<Widget>[
|
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),
|
const SizedBox(width: 12),
|
||||||
_CompactShareOption(
|
_CompactShareOption(
|
||||||
icon: Symbols.share,
|
icon: Symbols.content_copy,
|
||||||
title: 'share'.tr(),
|
title: 'copy'.tr(),
|
||||||
onTap: _isLoading ? null : _shareToSystem,
|
onTap: _isLoading ? null : _copyToClipboard,
|
||||||
),
|
),
|
||||||
|
if (widget.toSystem) ...<Widget>[
|
||||||
|
const SizedBox(width: 12),
|
||||||
|
_CompactShareOption(
|
||||||
|
icon: Symbols.share,
|
||||||
|
title: 'share'.tr(),
|
||||||
|
onTap: _isLoading ? null : _shareToSystem,
|
||||||
|
),
|
||||||
|
],
|
||||||
],
|
],
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
|
|
||||||
const SizedBox(height: 24),
|
|
||||||
|
|
||||||
// Chat section
|
|
||||||
Padding(
|
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
|
||||||
child: Column(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
'sendToChat'.tr(),
|
|
||||||
style: Theme.of(
|
|
||||||
context,
|
|
||||||
).textTheme.titleSmall?.copyWith(
|
|
||||||
color:
|
|
||||||
Theme.of(context).colorScheme.onSurfaceVariant,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 12),
|
|
||||||
|
|
||||||
// Additional message input
|
|
||||||
Container(
|
|
||||||
margin: const EdgeInsets.only(bottom: 16),
|
|
||||||
child: TextField(
|
|
||||||
controller: _messageController,
|
|
||||||
decoration: InputDecoration(
|
|
||||||
hintText: 'addAdditionalMessage'.tr(),
|
|
||||||
border: OutlineInputBorder(
|
|
||||||
borderRadius: BorderRadius.circular(12),
|
|
||||||
),
|
|
||||||
contentPadding: const EdgeInsets.symmetric(
|
|
||||||
horizontal: 16,
|
|
||||||
vertical: 12,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
maxLines: 3,
|
|
||||||
minLines: 1,
|
|
||||||
enabled: !_isLoading,
|
|
||||||
),
|
),
|
||||||
),
|
],
|
||||||
|
),
|
||||||
_ChatRoomsList(
|
|
||||||
onChatSelected:
|
|
||||||
_isLoading ? null : _shareToSpecificChat,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
),
|
|
||||||
|
|
||||||
const SizedBox(height: 16),
|
const SizedBox(height: 24),
|
||||||
],
|
|
||||||
|
// Chat section
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
'sendToChat'.tr(),
|
||||||
|
style: Theme.of(
|
||||||
|
context,
|
||||||
|
).textTheme.titleSmall?.copyWith(
|
||||||
|
color:
|
||||||
|
Theme.of(
|
||||||
|
context,
|
||||||
|
).colorScheme.onSurfaceVariant,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 12),
|
||||||
|
|
||||||
|
// Additional message input
|
||||||
|
Container(
|
||||||
|
margin: const EdgeInsets.only(bottom: 16),
|
||||||
|
child: TextField(
|
||||||
|
controller: _messageController,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
hintText: 'addAdditionalMessage'.tr(),
|
||||||
|
border: OutlineInputBorder(
|
||||||
|
borderRadius: BorderRadius.circular(12),
|
||||||
|
),
|
||||||
|
contentPadding: const EdgeInsets.symmetric(
|
||||||
|
horizontal: 16,
|
||||||
|
vertical: 12,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
onTapOutside:
|
||||||
|
(_) =>
|
||||||
|
FocusManager.instance.primaryFocus
|
||||||
|
?.unfocus(),
|
||||||
|
maxLines: 3,
|
||||||
|
minLines: 1,
|
||||||
|
enabled: !_isLoading,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
|
||||||
|
_ChatRoomsList(
|
||||||
|
onChatSelected:
|
||||||
|
_isLoading ? null : _shareToSpecificChat,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
|
||||||
|
const SizedBox(height: 16),
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -829,9 +850,7 @@ class _TextPreview extends StatelessWidget {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Container(
|
return Container(
|
||||||
constraints: const BoxConstraints(maxHeight: kPreviewMaxHeight),
|
constraints: const BoxConstraints(maxHeight: kPreviewMaxHeight),
|
||||||
child: SingleChildScrollView(
|
child: Text(text, style: Theme.of(context).textTheme.bodyMedium),
|
||||||
child: Text(text, style: Theme.of(context).textTheme.bodyMedium),
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1000,13 +1019,11 @@ class _LinkPreview extends ConsumerWidget {
|
|||||||
),
|
),
|
||||||
const SizedBox(height: 8),
|
const SizedBox(height: 8),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: SingleChildScrollView(
|
child: SelectableText(
|
||||||
child: SelectableText(
|
link,
|
||||||
link,
|
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
|
||||||
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
|
color: Theme.of(context).colorScheme.primary,
|
||||||
color: Theme.of(context).colorScheme.primary,
|
decoration: TextDecoration.underline,
|
||||||
decoration: TextDecoration.underline,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -1235,6 +1252,7 @@ void showShareSheet({
|
|||||||
showModalBottomSheet(
|
showModalBottomSheet(
|
||||||
context: context,
|
context: context,
|
||||||
isScrollControlled: true,
|
isScrollControlled: true,
|
||||||
|
useRootNavigator: true,
|
||||||
builder:
|
builder:
|
||||||
(context) => ShareSheet(
|
(context) => ShareSheet(
|
||||||
content: content,
|
content: content,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user