Compare commits
5 Commits
develop-wi
...
0409c5463f
| Author | SHA1 | Date | |
|---|---|---|---|
| 0409c5463f | |||
| df275c0108 | |||
| 0525453d48 | |||
| 4e8b2f34f9 | |||
| bc6a069c90 |
@@ -1,6 +1,6 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-all.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
|
||||
@@ -19,7 +19,8 @@ pluginManagement {
|
||||
|
||||
plugins {
|
||||
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
|
||||
id "com.android.application" version '8.7.3' apply false
|
||||
id "com.android.application" version "8.9.1" apply false
|
||||
id "com.android.library" version "8.9.1" apply false
|
||||
id "org.jetbrains.kotlin.android" version "2.1.10" apply false
|
||||
}
|
||||
|
||||
|
||||
9
flutter_launcher_icons.yaml
Normal file
9
flutter_launcher_icons.yaml
Normal file
@@ -0,0 +1,9 @@
|
||||
flutter_launcher_icons:
|
||||
android: true
|
||||
ios: true
|
||||
remove_alpha_ios: true
|
||||
image_path_android: "assets/logo/icon/ic_launcher.png"
|
||||
image_path_ios: "assets/logo/icon/1024.png"
|
||||
adaptive_icon_background: "assets/logo/icon/ic_launcher_adaptive_back.png" # only available for Android 8.0 devices and above
|
||||
adaptive_icon_foreground: "assets/logo/icon/ic_launcher_adaptive_fore.png" # only available for Android 8.0 devices and above
|
||||
min_sdk_android: 16 # android min sdk min:16, default 21
|
||||
@@ -83,6 +83,7 @@ const _$GetRoomResponseObjectMessageActorTypeEnumMap = {
|
||||
|
||||
const _$GetRoomResponseObjectMessageTypeEnumMap = {
|
||||
GetRoomResponseObjectMessageType.comment: 'comment',
|
||||
GetRoomResponseObjectMessageType.voiceMessage: 'voice-message',
|
||||
GetRoomResponseObjectMessageType.deletedComment: 'comment_deleted',
|
||||
GetRoomResponseObjectMessageType.system: 'system',
|
||||
GetRoomResponseObjectMessageType.command: 'command',
|
||||
|
||||
@@ -162,6 +162,7 @@ enum GetRoomResponseObjectMessageActorType {
|
||||
|
||||
enum GetRoomResponseObjectMessageType {
|
||||
@JsonValue('comment') comment,
|
||||
@JsonValue('voice-message') voiceMessage,
|
||||
@JsonValue('comment_deleted') deletedComment,
|
||||
@JsonValue('system') system,
|
||||
@JsonValue('command') command,
|
||||
|
||||
23
lib/utils/FileSaver.dart
Normal file
23
lib/utils/FileSaver.dart
Normal file
@@ -0,0 +1,23 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:permission_handler/permission_handler.dart';
|
||||
|
||||
// only tested on android!
|
||||
class FileSaver {
|
||||
static Future<String> getExternalDocumentPath() async {
|
||||
var permission = await Permission.storage.status;
|
||||
if(!permission.isGranted) {
|
||||
await Permission.storage.request();
|
||||
}
|
||||
var directory = Directory('/storage/emulated/0/Download');
|
||||
final externalPath = directory.path;
|
||||
await Directory(externalPath).create(recursive: true);
|
||||
return externalPath;
|
||||
}
|
||||
|
||||
static Future<File> writeBytes(List<int> bytes, String name) async {
|
||||
final path = await getExternalDocumentPath();
|
||||
var file = File('$path/$name');
|
||||
return file.writeAsBytes(bytes);
|
||||
}
|
||||
}
|
||||
@@ -9,6 +9,8 @@ import 'package:share_plus/share_plus.dart';
|
||||
import 'package:syncfusion_flutter_pdfviewer/pdfviewer.dart';
|
||||
|
||||
import '../storage/base/settingsProvider.dart';
|
||||
import '../utils/FileSaver.dart';
|
||||
import 'infoDialog.dart';
|
||||
import 'placeholderView.dart';
|
||||
import 'sharePositionOrigin.dart';
|
||||
|
||||
@@ -21,6 +23,12 @@ class FileViewer extends StatefulWidget {
|
||||
State<FileViewer> createState() => _FileViewerState();
|
||||
}
|
||||
|
||||
enum FileViewingActions {
|
||||
openExternal,
|
||||
share,
|
||||
save
|
||||
}
|
||||
|
||||
class _FileViewerState extends State<FileViewer> {
|
||||
PhotoViewController photoViewController = PhotoViewController();
|
||||
|
||||
@@ -38,22 +46,57 @@ class _FileViewerState extends State<FileViewer> {
|
||||
AppBar appbar({List actions = const []}) => AppBar(
|
||||
title: Text(widget.path.split('/').last),
|
||||
actions: [
|
||||
IconButton(
|
||||
onPressed: () => Navigator.of(context).push(
|
||||
MaterialPageRoute(builder: (context) => FileViewer(path: widget.path, openExternal: true))
|
||||
),
|
||||
icon: const Icon(Icons.open_in_new)
|
||||
),
|
||||
IconButton(
|
||||
onPressed: () {
|
||||
Share.shareXFiles(
|
||||
[XFile(widget.path)],
|
||||
sharePositionOrigin: SharePositionOrigin.get(context),
|
||||
);
|
||||
...actions,
|
||||
PopupMenuButton<FileViewingActions>(
|
||||
onSelected: (value) async {
|
||||
switch(value) {
|
||||
case FileViewingActions.openExternal:
|
||||
Navigator.of(context).push(
|
||||
MaterialPageRoute(builder: (context) => FileViewer(path: widget.path, openExternal: true))
|
||||
);
|
||||
break;
|
||||
case FileViewingActions.share:
|
||||
SharePlus.instance.share(
|
||||
ShareParams(
|
||||
files: [XFile(widget.path)],
|
||||
sharePositionOrigin: SharePositionOrigin.get(context)
|
||||
)
|
||||
);
|
||||
break;
|
||||
case FileViewingActions.save:
|
||||
await FileSaver.writeBytes(await File(widget.path).readAsBytes(), widget.path.split('/').last);
|
||||
if(!context.mounted) return;
|
||||
InfoDialog.show(context, 'Die Datei wurde im Downloads Ordner gespeichert.');
|
||||
break;
|
||||
}
|
||||
},
|
||||
icon: const Icon(Icons.share_outlined),
|
||||
itemBuilder: (context) => <PopupMenuEntry<FileViewingActions>>[
|
||||
const PopupMenuItem(
|
||||
value: FileViewingActions.openExternal,
|
||||
child: ListTile(
|
||||
leading: Icon(Icons.open_in_new),
|
||||
title: Text('Extern öffnen'),
|
||||
dense: true,
|
||||
),
|
||||
),
|
||||
const PopupMenuItem(
|
||||
value: FileViewingActions.share,
|
||||
child: ListTile(
|
||||
leading: Icon(Icons.share_outlined),
|
||||
title: Text('Teilen'),
|
||||
dense: true,
|
||||
),
|
||||
),
|
||||
if(Platform.isAndroid) const PopupMenuItem(
|
||||
value: FileViewingActions.save,
|
||||
child: ListTile(
|
||||
leading: Icon(Icons.save_alt_outlined),
|
||||
title: Text('Speichern'),
|
||||
dense: true,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
...actions
|
||||
],
|
||||
);
|
||||
|
||||
|
||||
15
pubspec.yaml
15
pubspec.yaml
@@ -17,7 +17,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
||||
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
|
||||
# In Windows, build-name is used as the major, minor, and patch parts
|
||||
# of the product and file versions while build-number is used as the build suffix.
|
||||
version: 0.1.5+43
|
||||
version: 0.1.6+44
|
||||
|
||||
environment:
|
||||
sdk: '>3.0.0'
|
||||
@@ -102,6 +102,7 @@ dependencies:
|
||||
uuid: ^4.5.1
|
||||
open_filex: ^4.7.0
|
||||
collection: ^1.19.0
|
||||
permission_handler: ^12.0.1
|
||||
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
@@ -163,14 +164,4 @@ flutter:
|
||||
# weight: 700
|
||||
#
|
||||
# For details regarding fonts from package dependencies,
|
||||
# see https://flutter.dev/custom-fonts/#from-packages
|
||||
|
||||
flutter_icons:
|
||||
android: true
|
||||
ios: true
|
||||
remove_alpha_ios: true
|
||||
image_path_android: "assets/logo/icon/ic_launcher.png"
|
||||
image_path_ios: "assets/logo/icon/1024.png"
|
||||
adaptive_icon_background: "assets/logo/icon/ic_launcher_adaptive_back.png" # only available for Android 8.0 devices and above
|
||||
adaptive_icon_foreground: "assets/logo/icon/ic_launcher_adaptive_fore.png" # only available for Android 8.0 devices and above
|
||||
min_sdk_android: 16 # android min sdk min:16, default 21
|
||||
# see https://flutter.dev/custom-fonts/#from-packages
|
||||
Reference in New Issue
Block a user