refactor: share handler
This commit is contained in:
@@ -204,6 +204,18 @@ class _EnhancedAttachmentState extends ConsumerState<EnhancedAttachment> {
|
||||
.toString();
|
||||
final size = _fileInfo?['size'];
|
||||
final sizeLabel = size is num ? _formatSize(size.toInt()) : null;
|
||||
final lowerName = filename.toLowerCase();
|
||||
final fileExtension = lowerName.contains('.')
|
||||
? lowerName.split('.').last
|
||||
: '';
|
||||
final List<String> metaParts = [];
|
||||
if (fileExtension.isNotEmpty) {
|
||||
metaParts.add('.${fileExtension.toUpperCase()}');
|
||||
}
|
||||
if (sizeLabel != null) {
|
||||
metaParts.add(sizeLabel);
|
||||
}
|
||||
final metaLabel = metaParts.join(' • ');
|
||||
|
||||
final card = Container(
|
||||
constraints: widget.constraints,
|
||||
@@ -217,15 +229,14 @@ class _EnhancedAttachmentState extends ConsumerState<EnhancedAttachment> {
|
||||
),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
Text(
|
||||
_fileIconFor(filename),
|
||||
style: const TextStyle(fontSize: AppTypography.headlineLarge),
|
||||
),
|
||||
const SizedBox(width: Spacing.sm),
|
||||
ConstrainedBox(
|
||||
constraints: const BoxConstraints(maxWidth: 220),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
@@ -240,9 +251,9 @@ class _EnhancedAttachmentState extends ConsumerState<EnhancedAttachment> {
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
if (sizeLabel != null)
|
||||
if (metaLabel.isNotEmpty)
|
||||
Text(
|
||||
sizeLabel,
|
||||
metaLabel,
|
||||
style: TextStyle(
|
||||
color: context.conduitTheme.textSecondary.withValues(
|
||||
alpha: 0.7,
|
||||
|
||||
@@ -342,6 +342,16 @@ class _ModernChatInputState extends ConsumerState<ModernChatInput>
|
||||
orElse: () => false,
|
||||
);
|
||||
|
||||
// React to external focus requests (e.g., from share prefill)
|
||||
final focusTick = ref.watch(inputFocusTriggerProvider);
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
if (!mounted) return;
|
||||
if (focusTick > 0) {
|
||||
_ensureFocusedIfEnabled();
|
||||
if (!_isExpanded) _setExpanded(true);
|
||||
}
|
||||
});
|
||||
|
||||
return Container(
|
||||
// Transparent wrapper so rounded corners are visible against page background
|
||||
color: Colors.transparent,
|
||||
|
||||
Reference in New Issue
Block a user