hopefully fixed send
This commit is contained in:
@@ -1,6 +1,3 @@
|
||||
import 'dart:io';
|
||||
import 'package:fforte/screens/sharedMethods/http_request.dart';
|
||||
import 'package:file_picker/file_picker.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'l10n/app_localizations.dart';
|
||||
import 'screens/addCam/add_cam_main.dart';
|
||||
@@ -10,16 +7,16 @@ import 'screens/addCam/add_cam_main.dart';
|
||||
class HomePage extends StatelessWidget {
|
||||
const HomePage({super.key});
|
||||
|
||||
void _sendFile() async {
|
||||
FilePickerResult? result = await FilePicker.platform.pickFiles();
|
||||
// void _sendFile() async {
|
||||
// // FilePickerResult? result = await FilePicker.platform.pickFiles();
|
||||
|
||||
if (result != null) {
|
||||
File file = File(result.files.single.path!);
|
||||
String content = await file.readAsString();
|
||||
// // if (result != null) {
|
||||
// // File file = File(result.files.single.path!);
|
||||
// // String content = await file.readAsString();
|
||||
|
||||
HttpRequest.httpRequest(saveDataString: content);
|
||||
}
|
||||
}
|
||||
// // HttpRequest.httpRequest(saveDataString: content);
|
||||
// }
|
||||
// }
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -104,7 +101,7 @@ class HomePage extends StatelessWidget {
|
||||
minimumSize: const Size(250, 40),
|
||||
),
|
||||
onPressed: () {
|
||||
_sendFile();
|
||||
// _sendFile();
|
||||
},
|
||||
child: Text(AppLocalizations.of(context)!.sendfile),
|
||||
),
|
||||
|
||||
@@ -168,6 +168,7 @@ class _ExcursionMainState extends State<ExcursionMain> {
|
||||
});
|
||||
|
||||
rmap["Datum"]!["controller"]!.text = DateTime.now().toString();
|
||||
rmap["Sent"]!["controller"]!.text = "0";
|
||||
}
|
||||
|
||||
isTemplate = widget.isTemplate;
|
||||
|
||||
@@ -84,7 +84,9 @@ class AddEntriesDialogHelper {
|
||||
entryData: saveData,
|
||||
isTemplate: isTemplate,
|
||||
dbType: dbType,
|
||||
sent: true
|
||||
);
|
||||
|
||||
showSuccessDialog(context);
|
||||
}
|
||||
},
|
||||
|
||||
@@ -3,7 +3,6 @@ import 'dart:convert';
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:fforte/l10n/app_localizations.dart';
|
||||
import 'dart:io';
|
||||
import 'package:file_picker/file_picker.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
||||
@@ -25,14 +24,14 @@ class _SendFileState extends State<SendFile> {
|
||||
children: [
|
||||
ElevatedButton(
|
||||
onPressed: () async {
|
||||
FilePickerResult? result =
|
||||
await FilePicker.platform.pickFiles();
|
||||
// FilePickerResult? result =
|
||||
// await FilePicker.platform.pickFiles();
|
||||
|
||||
if (result != null) {
|
||||
pickedFile = File(result.files.single.path!);
|
||||
} else {
|
||||
pickedFile = File("");
|
||||
}
|
||||
// if (result != null) {
|
||||
// pickedFile = File(result.files.single.path!);
|
||||
// } else {
|
||||
// pickedFile = File("");
|
||||
// }
|
||||
},
|
||||
child: Text(AppLocalizations.of(context)!.pickfile)),
|
||||
Text(pickedFile.toString()),
|
||||
|
||||
Reference in New Issue
Block a user