hopefully fixed send

This commit is contained in:
Nico
2025-06-05 19:57:00 +02:00
parent a599c6fbc1
commit c01e2d73d9
4 changed files with 19 additions and 20 deletions

View File

@@ -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 'package:flutter/material.dart';
import 'l10n/app_localizations.dart'; import 'l10n/app_localizations.dart';
import 'screens/addCam/add_cam_main.dart'; import 'screens/addCam/add_cam_main.dart';
@@ -10,16 +7,16 @@ import 'screens/addCam/add_cam_main.dart';
class HomePage extends StatelessWidget { class HomePage extends StatelessWidget {
const HomePage({super.key}); const HomePage({super.key});
void _sendFile() async { // void _sendFile() async {
FilePickerResult? result = await FilePicker.platform.pickFiles(); // // FilePickerResult? result = await FilePicker.platform.pickFiles();
if (result != null) { // // if (result != null) {
File file = File(result.files.single.path!); // // File file = File(result.files.single.path!);
String content = await file.readAsString(); // // String content = await file.readAsString();
HttpRequest.httpRequest(saveDataString: content); // // HttpRequest.httpRequest(saveDataString: content);
} // }
} // }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@@ -104,7 +101,7 @@ class HomePage extends StatelessWidget {
minimumSize: const Size(250, 40), minimumSize: const Size(250, 40),
), ),
onPressed: () { onPressed: () {
_sendFile(); // _sendFile();
}, },
child: Text(AppLocalizations.of(context)!.sendfile), child: Text(AppLocalizations.of(context)!.sendfile),
), ),

View File

@@ -168,6 +168,7 @@ class _ExcursionMainState extends State<ExcursionMain> {
}); });
rmap["Datum"]!["controller"]!.text = DateTime.now().toString(); rmap["Datum"]!["controller"]!.text = DateTime.now().toString();
rmap["Sent"]!["controller"]!.text = "0";
} }
isTemplate = widget.isTemplate; isTemplate = widget.isTemplate;

View File

@@ -84,7 +84,9 @@ class AddEntriesDialogHelper {
entryData: saveData, entryData: saveData,
isTemplate: isTemplate, isTemplate: isTemplate,
dbType: dbType, dbType: dbType,
sent: true
); );
showSuccessDialog(context); showSuccessDialog(context);
} }
}, },

View File

@@ -3,7 +3,6 @@ import 'dart:convert';
import 'package:dio/dio.dart'; import 'package:dio/dio.dart';
import 'package:fforte/l10n/app_localizations.dart'; import 'package:fforte/l10n/app_localizations.dart';
import 'dart:io'; import 'dart:io';
import 'package:file_picker/file_picker.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:shared_preferences/shared_preferences.dart'; import 'package:shared_preferences/shared_preferences.dart';
@@ -25,14 +24,14 @@ class _SendFileState extends State<SendFile> {
children: [ children: [
ElevatedButton( ElevatedButton(
onPressed: () async { onPressed: () async {
FilePickerResult? result = // FilePickerResult? result =
await FilePicker.platform.pickFiles(); // await FilePicker.platform.pickFiles();
if (result != null) { // if (result != null) {
pickedFile = File(result.files.single.path!); // pickedFile = File(result.files.single.path!);
} else { // } else {
pickedFile = File(""); // pickedFile = File("");
} // }
}, },
child: Text(AppLocalizations.of(context)!.pickfile)), child: Text(AppLocalizations.of(context)!.pickfile)),
Text(pickedFile.toString()), Text(pickedFile.toString()),