补充提交
This commit is contained in:
parent
50f0cc554a
commit
356c671ae7
@ -121,6 +121,10 @@
|
|||||||
</array>
|
</array>
|
||||||
<key>UIViewControllerBasedStatusBarAppearance</key>
|
<key>UIViewControllerBasedStatusBarAppearance</key>
|
||||||
<false/>
|
<false/>
|
||||||
|
<key>NSFileProtectionKey</key>
|
||||||
|
<string>NSFileProtectionCompleteUntilFirstUserAuthentication</string>
|
||||||
|
<key>UIFileSharingEnabled</key>
|
||||||
|
<true/>
|
||||||
<key>io.flutter.embedded_views_preview</key>
|
<key>io.flutter.embedded_views_preview</key>
|
||||||
<true/>
|
<true/>
|
||||||
</dict>
|
</dict>
|
||||||
|
|||||||
@ -48,12 +48,19 @@
|
|||||||
self.textToShare = paramDic[@"shareText"];
|
self.textToShare = paramDic[@"shareText"];
|
||||||
self.urlToShare = paramDic[@"urlToShare"];
|
self.urlToShare = paramDic[@"urlToShare"];
|
||||||
}
|
}
|
||||||
//分享的url
|
if ([self.urlToShare isEqualToString:"fileShare"]) {
|
||||||
NSURL *urlToShare = [NSURL URLWithString:self.urlToShare];
|
// 创建要分享或操作的文件对象
|
||||||
// NSURL *urlToShare = [NSURL URLWithString:@"https://pre.lock.star-lock.cn:8093/login"];
|
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];
|
UIActivityViewController *activityVC = [[UIActivityViewController alloc]initWithActivityItems:activityItems applicationActivities:nil];
|
||||||
|
|
||||||
|
|||||||
@ -82,7 +82,7 @@ class _ExportSuccessPageState extends State<ExportSuccessPage> with RouteAware {
|
|||||||
SubmitBtn(
|
SubmitBtn(
|
||||||
btnName: '立即查看'.tr,
|
btnName: '立即查看'.tr,
|
||||||
onClick: () {
|
onClick: () {
|
||||||
// OpenFile.open(state.getFilePath.value);
|
OpenFile.open(state.getFilePath.value);
|
||||||
NativeInteractionTool()
|
NativeInteractionTool()
|
||||||
.loadNativeFileShare(shareText: state.getFilePath.value);
|
.loadNativeFileShare(shareText: state.getFilePath.value);
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
import 'dart:typed_data';
|
import 'dart:typed_data';
|
||||||
|
|
||||||
import 'package:excel/excel.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:path_provider/path_provider.dart';
|
import 'package:path_provider/path_provider.dart';
|
||||||
@ -26,28 +25,6 @@ class _ViewExportRecordPageState extends State<ViewExportRecordPage>
|
|||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.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
|
@override
|
||||||
|
|||||||
@ -21,8 +21,14 @@ class NativeInteractionTool {
|
|||||||
///加载原生分享
|
///加载原生分享
|
||||||
void loadNativeShare({required String shareText}) {
|
void loadNativeShare({required String shareText}) {
|
||||||
final String urlToShare = '${F.apiPrefix}/apps';
|
final String urlToShare = '${F.apiPrefix}/apps';
|
||||||
sendChannel.invokeMethod(
|
sendChannel.invokeMethod('loadNativeShare',
|
||||||
'loadNativeShare', <String, String>{'shareText': shareText,'urlToShare':urlToShare});
|
<String, String>{'shareText': shareText, 'urlToShare': urlToShare});
|
||||||
|
}
|
||||||
|
|
||||||
|
///加载原生文件分享
|
||||||
|
void loadNativeFileShare({required String shareText}) {
|
||||||
|
sendChannel.invokeMethod('loadNativeShare',
|
||||||
|
<String, String>{'shareText': shareText, 'urlToShare': 'fileShare'});
|
||||||
}
|
}
|
||||||
|
|
||||||
///获取设备蓝牙状态
|
///获取设备蓝牙状态
|
||||||
|
|||||||
@ -217,6 +217,7 @@ dependencies:
|
|||||||
file_picker: ^5.3.1
|
file_picker: ^5.3.1
|
||||||
# 错误日志监控
|
# 错误日志监控
|
||||||
flutter_bugly_plugin: ^0.0.9
|
flutter_bugly_plugin: ^0.0.9
|
||||||
|
open_file: ^3.3.2
|
||||||
|
|
||||||
dependency_overrides:
|
dependency_overrides:
|
||||||
#强制设置google_maps_flutter_ios 为 2.5.2
|
#强制设置google_maps_flutter_ios 为 2.5.2
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user