refactor: File selector just use default FileType
and remove not working zip selector
This commit is contained in:
parent
803602e3c5
commit
53af09227f
7 changed files with 18 additions and 116 deletions
|
|
@ -9,6 +9,7 @@ import 'package:collection/collection.dart';
|
|||
import 'package:desktop_drop/desktop_drop.dart';
|
||||
import 'package:device_info_plus/device_info_plus.dart';
|
||||
import 'package:emoji_picker_flutter/emoji_picker_flutter.dart';
|
||||
import 'package:file_picker/file_picker.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:image_picker/image_picker.dart';
|
||||
import 'package:matrix/matrix.dart';
|
||||
|
|
@ -621,7 +622,7 @@ class ChatController extends State<ChatPageWithRoom>
|
|||
});
|
||||
}
|
||||
|
||||
void sendFileAction({FileSelectorType type = FileSelectorType.any}) async {
|
||||
void sendFileAction({FileType type = FileType.any}) async {
|
||||
final files = await selectFiles(context, allowMultiple: true, type: type);
|
||||
if (files.isEmpty) return;
|
||||
await showAdaptiveDialog(
|
||||
|
|
@ -1186,10 +1187,10 @@ class ChatController extends State<ChatPageWithRoom>
|
|||
|
||||
switch (choice) {
|
||||
case AddPopupMenuActions.image:
|
||||
sendFileAction(type: FileSelectorType.images);
|
||||
sendFileAction(type: FileType.image);
|
||||
return;
|
||||
case AddPopupMenuActions.video:
|
||||
sendFileAction(type: FileSelectorType.videos);
|
||||
sendFileAction(type: FileType.video);
|
||||
return;
|
||||
case AddPopupMenuActions.file:
|
||||
sendFileAction();
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:collection/collection.dart';
|
||||
import 'package:file_picker/file_picker.dart';
|
||||
import 'package:image_picker/image_picker.dart';
|
||||
import 'package:matrix/matrix.dart';
|
||||
|
||||
|
|
@ -137,7 +138,7 @@ class ChatDetailsController extends State<ChatDetails> {
|
|||
final picked = await selectFiles(
|
||||
context,
|
||||
allowMultiple: false,
|
||||
type: FileSelectorType.images,
|
||||
type: FileType.image,
|
||||
);
|
||||
final pickedFile = picked.firstOrNull;
|
||||
if (pickedFile == null) return;
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ import 'dart:typed_data';
|
|||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:file_picker/file_picker.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:matrix/matrix.dart' as sdk;
|
||||
import 'package:matrix/matrix.dart';
|
||||
|
|
@ -49,7 +50,7 @@ class NewGroupController extends State<NewGroup> {
|
|||
void selectPhoto() async {
|
||||
final photo = await selectFiles(
|
||||
context,
|
||||
type: FileSelectorType.images,
|
||||
type: FileType.image,
|
||||
allowMultiple: false,
|
||||
);
|
||||
final bytes = await photo.singleOrNull?.readAsBytes();
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ import 'dart:async';
|
|||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:collection/collection.dart';
|
||||
import 'package:file_picker/file_picker.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:image_picker/image_picker.dart';
|
||||
import 'package:matrix/matrix.dart';
|
||||
|
|
@ -134,7 +135,7 @@ class SettingsController extends State<Settings> {
|
|||
if (result == null) return;
|
||||
file = MatrixFile(bytes: await result.readAsBytes(), name: result.path);
|
||||
} else {
|
||||
final result = await selectFiles(context, type: FileSelectorType.images);
|
||||
final result = await selectFiles(context, type: FileType.image);
|
||||
final pickedFile = result.firstOrNull;
|
||||
if (pickedFile == null) return;
|
||||
file = MatrixFile(
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ import 'dart:async';
|
|||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:file_picker/file_picker.dart';
|
||||
import 'package:http/http.dart' hide Client;
|
||||
import 'package:matrix/matrix.dart';
|
||||
|
||||
|
|
@ -296,7 +297,7 @@ class EmotesSettingsController extends State<EmotesSettings> {
|
|||
void createStickers() async {
|
||||
final pickedFiles = await selectFiles(
|
||||
context,
|
||||
type: FileSelectorType.images,
|
||||
type: FileType.image,
|
||||
allowMultiple: true,
|
||||
);
|
||||
if (pickedFiles.isEmpty) return;
|
||||
|
|
@ -355,7 +356,7 @@ class EmotesSettingsController extends State<EmotesSettings> {
|
|||
}
|
||||
|
||||
Future<void> importEmojiZip() async {
|
||||
final result = await selectFiles(context, type: FileSelectorType.zip);
|
||||
final result = await selectFiles(context, type: FileType.any);
|
||||
|
||||
if (result.isEmpty) return;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:file_picker/file_picker.dart';
|
||||
|
||||
import 'package:fluffychat/config/app_config.dart';
|
||||
import 'package:fluffychat/config/setting_keys.dart';
|
||||
import 'package:fluffychat/utils/account_config.dart';
|
||||
|
|
@ -26,7 +28,7 @@ class SettingsStyleController extends State<SettingsStyle> {
|
|||
|
||||
void setWallpaper() async {
|
||||
final client = Matrix.of(context).client;
|
||||
final picked = await selectFiles(context, type: FileSelectorType.images);
|
||||
final picked = await selectFiles(context, type: FileType.image);
|
||||
final pickedFile = picked.firstOrNull;
|
||||
if (pickedFile == null) return;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue