fix: адаптация PR #60 под текущий feature/FullStack
This commit is contained in:
@@ -32,35 +32,6 @@ class PickedPhoto {
|
||||
const PickedPhoto({required this.item, this.editedFile});
|
||||
}
|
||||
|
||||
class CameraGalleryItem implements GalleryItem {
|
||||
final File file;
|
||||
(int, int)? _dimensions;
|
||||
|
||||
CameraGalleryItem(this.file);
|
||||
|
||||
@override
|
||||
String get id => file.path;
|
||||
|
||||
@override
|
||||
bool get isVideo => false;
|
||||
|
||||
@override
|
||||
Duration? get duration => null;
|
||||
|
||||
@override
|
||||
File? get localFile => file;
|
||||
|
||||
@override
|
||||
Future<Uint8List?> thumbnail(int size) => file.readAsBytes();
|
||||
|
||||
@override
|
||||
Future<File?> originFile() async => file;
|
||||
|
||||
@override
|
||||
Future<(int, int)?> dimensions() async =>
|
||||
_dimensions ??= await imageFileDimensions(file);
|
||||
}
|
||||
|
||||
Future<(int, int)?> imageFileDimensions(File file) async {
|
||||
ui.ImmutableBuffer? buffer;
|
||||
ui.ImageDescriptor? descriptor;
|
||||
@@ -197,7 +168,6 @@ bool isVideoPath(String path) =>
|
||||
kGalleryVideoExtensions.contains(_fileExtension(path));
|
||||
|
||||
class _DesktopGallerySource implements GallerySource {
|
||||
|
||||
@override
|
||||
Future<GalleryPermission> ensurePermission() async =>
|
||||
GalleryPermission.granted;
|
||||
|
||||
@@ -2812,21 +2812,22 @@ class _ChatScreenState extends State<ChatScreen>
|
||||
Future<void> _startEditMessage(CachedMessage message) async {
|
||||
final cs = Theme.of(context).colorScheme;
|
||||
|
||||
final content = await showModalBottomSheet<
|
||||
({String text, List<Map<String, dynamic>> elements})
|
||||
>(
|
||||
context: context,
|
||||
isScrollControlled: true,
|
||||
backgroundColor: cs.surfaceContainerHigh,
|
||||
shape: const RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.vertical(top: Radius.circular(24)),
|
||||
),
|
||||
builder: (sheetContext) => _EditMessageSheet(
|
||||
text: message.text ?? '',
|
||||
formatRanges: message.formatRanges,
|
||||
contextMenuBuilder: _formatContextMenu,
|
||||
),
|
||||
);
|
||||
final content =
|
||||
await showModalBottomSheet<
|
||||
({String text, List<Map<String, dynamic>> elements})
|
||||
>(
|
||||
context: context,
|
||||
isScrollControlled: true,
|
||||
backgroundColor: cs.surfaceContainerHigh,
|
||||
shape: const RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.vertical(top: Radius.circular(24)),
|
||||
),
|
||||
builder: (sheetContext) => _EditMessageSheet(
|
||||
text: message.text ?? '',
|
||||
formatRanges: message.formatRanges,
|
||||
contextMenuBuilder: _formatContextMenu,
|
||||
),
|
||||
);
|
||||
|
||||
if (content == null || !mounted) return;
|
||||
|
||||
@@ -7621,7 +7622,8 @@ class _EditMessageSheetState extends State<_EditMessageSheet> {
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
FilledButton(
|
||||
onPressed: () => Navigator.of(context).pop(_controller.buildContent()),
|
||||
onPressed: () =>
|
||||
Navigator.of(context).pop(_controller.buildContent()),
|
||||
child: const Text('Сохранить'),
|
||||
),
|
||||
],
|
||||
|
||||
@@ -212,7 +212,7 @@ class _AttachmentSheetState extends State<AttachmentSheet> {
|
||||
return;
|
||||
}
|
||||
if (shot == null || !mounted) return;
|
||||
_openPreview(CameraGalleryItem(File(shot.path)));
|
||||
_openPreview(GalleryItem.fromFile(File(shot.path)));
|
||||
}
|
||||
|
||||
void _sendSelection({GalleryItem? fallback}) {
|
||||
@@ -937,7 +937,6 @@ class _CameraTileState extends State<_CameraTile> with WidgetsBindingObserver {
|
||||
}
|
||||
setState(() => _controller = controller);
|
||||
} catch (_) {
|
||||
// keep the fallback tile
|
||||
} finally {
|
||||
_starting = false;
|
||||
}
|
||||
|
||||
@@ -955,7 +955,6 @@
|
||||
"digitalIdDocChildOms": "Child's health insurance policy (OMS)",
|
||||
"attachSheetGallery": "Gallery",
|
||||
"attachSheetPoll": "Poll",
|
||||
"attachSheetCameraComingSoon": "Camera is coming soon",
|
||||
"attachSheetCameraError": "Couldn't open the camera",
|
||||
"attachSheetSendFileTitle": "Send a file",
|
||||
"attachSheetSendFileSubtitle": "A document, archive, or any other file",
|
||||
|
||||
@@ -4268,12 +4268,6 @@ abstract class AppLocalizations {
|
||||
/// **'Poll'**
|
||||
String get attachSheetPoll;
|
||||
|
||||
/// No description provided for @attachSheetCameraComingSoon.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Camera is coming soon'**
|
||||
String get attachSheetCameraComingSoon;
|
||||
|
||||
/// No description provided for @attachSheetCameraError.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
|
||||
@@ -2219,9 +2219,6 @@ class AppLocalizationsEn extends AppLocalizations {
|
||||
@override
|
||||
String get attachSheetPoll => 'Poll';
|
||||
|
||||
@override
|
||||
String get attachSheetCameraComingSoon => 'Camera is coming soon';
|
||||
|
||||
@override
|
||||
String get attachSheetCameraError => 'Couldn\'t open the camera';
|
||||
|
||||
|
||||
@@ -2232,9 +2232,6 @@ class AppLocalizationsRu extends AppLocalizations {
|
||||
@override
|
||||
String get attachSheetPoll => 'Опрос';
|
||||
|
||||
@override
|
||||
String get attachSheetCameraComingSoon => 'Камера скоро появится';
|
||||
|
||||
@override
|
||||
String get attachSheetCameraError => 'Не удалось открыть камеру';
|
||||
|
||||
|
||||
@@ -720,7 +720,6 @@
|
||||
"digitalIdDocChildOms": "Полис ОМС ребёнка",
|
||||
"attachSheetGallery": "Галерея",
|
||||
"attachSheetPoll": "Опрос",
|
||||
"attachSheetCameraComingSoon": "Камера скоро появится",
|
||||
"attachSheetCameraError": "Не удалось открыть камеру",
|
||||
"attachSheetSendFileTitle": "Отправить файл",
|
||||
"attachSheetSendFileSubtitle": "Документ, архив или любой другой файл",
|
||||
|
||||
Reference in New Issue
Block a user