🐛 Fix share sheet

This commit is contained in:
LittleSheep 2025-06-26 14:45:44 +08:00
parent f2829b2012
commit e90b35f19f
2 changed files with 153 additions and 130 deletions

View File

@ -587,6 +587,11 @@
"addAdditionalMessage": "Add additional message...",
"uploadingFiles": "Uploading files...",
"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",
"wouldYouLikeToNavigateToChat": "Would you like to navigate to the chat?",
"abuseReport": "Report",

View File

@ -403,13 +403,27 @@ class _ShareSheetState extends ConsumerState<ShareSheet> {
titleText: widget.title ?? 'share'.tr(),
heightFactor: 0.75,
child: Column(
children: [
// Share options with keyboard avoidance
Expanded(
child: AnimatedPadding(
duration: const Duration(milliseconds: 300),
padding: EdgeInsets.only(
bottom: MediaQuery.of(context).viewInsets.bottom,
),
child: SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// Content preview
Container(
margin: const EdgeInsets.all(16),
padding: const EdgeInsets.all(16),
decoration: BoxDecoration(
color: Theme.of(context).colorScheme.surfaceContainerHighest,
color:
Theme.of(
context,
).colorScheme.surfaceContainerHighest,
borderRadius: BorderRadius.circular(12),
),
child: Column(
@ -417,8 +431,13 @@ class _ShareSheetState extends ConsumerState<ShareSheet> {
children: [
Text(
'contentToShare'.tr(),
style: Theme.of(context).textTheme.labelMedium?.copyWith(
color: Theme.of(context).colorScheme.onSurfaceVariant,
style: Theme.of(
context,
).textTheme.labelMedium?.copyWith(
color:
Theme.of(
context,
).colorScheme.onSurfaceVariant,
),
),
const SizedBox(height: 8),
@ -426,13 +445,6 @@ class _ShareSheetState extends ConsumerState<ShareSheet> {
],
),
),
// Share options
Expanded(
child: SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// Quick actions row (horizontally scrollable)
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16),
@ -445,7 +457,9 @@ class _ShareSheetState extends ConsumerState<ShareSheet> {
context,
).textTheme.titleSmall?.copyWith(
color:
Theme.of(context).colorScheme.onSurfaceVariant,
Theme.of(
context,
).colorScheme.onSurfaceVariant,
),
),
const SizedBox(height: 12),
@ -494,7 +508,9 @@ class _ShareSheetState extends ConsumerState<ShareSheet> {
context,
).textTheme.titleSmall?.copyWith(
color:
Theme.of(context).colorScheme.onSurfaceVariant,
Theme.of(
context,
).colorScheme.onSurfaceVariant,
),
),
const SizedBox(height: 12),
@ -514,6 +530,10 @@ class _ShareSheetState extends ConsumerState<ShareSheet> {
vertical: 12,
),
),
onTapOutside:
(_) =>
FocusManager.instance.primaryFocus
?.unfocus(),
maxLines: 3,
minLines: 1,
enabled: !_isLoading,
@ -533,6 +553,7 @@ class _ShareSheetState extends ConsumerState<ShareSheet> {
),
),
),
),
// Loading indicator and file upload progress
if (_isLoading)
@ -829,9 +850,7 @@ class _TextPreview extends StatelessWidget {
Widget build(BuildContext context) {
return Container(
constraints: const BoxConstraints(maxHeight: kPreviewMaxHeight),
child: SingleChildScrollView(
child: Text(text, style: Theme.of(context).textTheme.bodyMedium),
),
);
}
}
@ -1000,7 +1019,6 @@ class _LinkPreview extends ConsumerWidget {
),
const SizedBox(height: 8),
Expanded(
child: SingleChildScrollView(
child: SelectableText(
link,
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
@ -1009,7 +1027,6 @@ class _LinkPreview extends ConsumerWidget {
),
),
),
),
],
),
);
@ -1235,6 +1252,7 @@ void showShareSheet({
showModalBottomSheet(
context: context,
isScrollControlled: true,
useRootNavigator: true,
builder:
(context) => ShareSheet(
content: content,