补充提交

This commit is contained in:
Daisy 2024-06-21 09:28:25 +08:00
parent 50f0cc554a
commit 356c671ae7
6 changed files with 26 additions and 31 deletions

View File

@ -121,6 +121,10 @@
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
<key>NSFileProtectionKey</key>
<string>NSFileProtectionCompleteUntilFirstUserAuthentication</string>
<key>UIFileSharingEnabled</key>
<true/>
<key>io.flutter.embedded_views_preview</key>
<true/>
</dict>

View File

@ -48,12 +48,19 @@
self.textToShare = paramDic[@"shareText"];
self.urlToShare = paramDic[@"urlToShare"];
}
//url
NSURL *urlToShare = [NSURL URLWithString:self.urlToShare];
// NSURL *urlToShare = [NSURL URLWithString:@"https://pre.lock.star-lock.cn:8093/login"];
if ([self.urlToShare isEqualToString:"fileShare"]) {
//
let fileURL = URL(fileURLWithPath: "/path/to/file.pdf")
//
NSArray *activityItems = @[self.textToShare,urlToShare];
//
let activityItems = [fileURL]
} else {
//url
NSURL *urlToShare = [NSURL URLWithString:self.urlToShare];
//
NSArray *activityItems = @[self.textToShare,urlToShare];
}
UIActivityViewController *activityVC = [[UIActivityViewController alloc]initWithActivityItems:activityItems applicationActivities:nil];

View File

@ -82,7 +82,7 @@ class _ExportSuccessPageState extends State<ExportSuccessPage> with RouteAware {
SubmitBtn(
btnName: '立即查看'.tr,
onClick: () {
// OpenFile.open(state.getFilePath.value);
OpenFile.open(state.getFilePath.value);
NativeInteractionTool()
.loadNativeFileShare(shareText: state.getFilePath.value);

View File

@ -1,7 +1,6 @@
import 'dart:io';
import 'dart:typed_data';
import 'package:excel/excel.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:path_provider/path_provider.dart';
@ -26,28 +25,6 @@ class _ViewExportRecordPageState extends State<ViewExportRecordPage>
@override
void initState() {
super.initState();
loadExcel();
}
Future<void> loadExcel() async {
try {
final Directory appDocDir = await getApplicationDocumentsDirectory();
final String appDocPath = appDocDir.path;
final String filePath = '$appDocPath/exported_file.xlsx';
final Uint8List bytes = File(filePath).readAsBytesSync();
final Excel excel = Excel.decodeBytes(bytes);
for (final String table in excel.tables.keys) {
for (final List<Data?> row in excel.tables[table]!.rows) {
setState(() {
state.excelData.add(row);
});
}
}
} catch (e) {
print('Error reading Excel: $e');
}
}
@override

View File

@ -21,8 +21,14 @@ class NativeInteractionTool {
///
void loadNativeShare({required String shareText}) {
final String urlToShare = '${F.apiPrefix}/apps';
sendChannel.invokeMethod(
'loadNativeShare', <String, String>{'shareText': shareText,'urlToShare':urlToShare});
sendChannel.invokeMethod('loadNativeShare',
<String, String>{'shareText': shareText, 'urlToShare': urlToShare});
}
///
void loadNativeFileShare({required String shareText}) {
sendChannel.invokeMethod('loadNativeShare',
<String, String>{'shareText': shareText, 'urlToShare': 'fileShare'});
}
///

View File

@ -217,6 +217,7 @@ dependencies:
file_picker: ^5.3.1
# 错误日志监控
flutter_bugly_plugin: ^0.0.9
open_file: ^3.3.2
dependency_overrides:
#强制设置google_maps_flutter_ios 为 2.5.2