added last save location in settings
This commit is contained in:
@@ -237,33 +237,32 @@ class _AddCamMainState extends State<AddCamMain> {
|
||||
}
|
||||
|
||||
Future<void> showSaveOptionsDialog() async {
|
||||
return
|
||||
showDialog(
|
||||
return showDialog(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
var dialogContext = context;
|
||||
return AlertDialog(
|
||||
title: Text(AppLocalizations.of(context)!.savemethod),
|
||||
actions: [
|
||||
|
||||
TextButton(onPressed: () async {
|
||||
saveTemplate();
|
||||
Navigator.pushNamedAndRemoveUntil(
|
||||
// ignore: use_build_context_synchronously
|
||||
context,
|
||||
'/home',
|
||||
(route) => false);
|
||||
}, child: Text(AppLocalizations.of(context)!.template)),
|
||||
|
||||
TextButton(
|
||||
onPressed: () async {
|
||||
saveTemplate();
|
||||
Navigator.pushNamedAndRemoveUntil(
|
||||
// ignore: use_build_context_synchronously
|
||||
context,
|
||||
'/home',
|
||||
(route) => false);
|
||||
},
|
||||
child: Text(AppLocalizations.of(context)!.template)),
|
||||
TextButton(
|
||||
onPressed: () async {
|
||||
saveFile();
|
||||
_httpRequest();
|
||||
Navigator.pushNamedAndRemoveUntil(
|
||||
// ignore: use_build_context_synchronously
|
||||
context,
|
||||
'/home',
|
||||
(route) => false);
|
||||
Navigator.pushNamedAndRemoveUntil(
|
||||
// ignore: use_build_context_synchronously
|
||||
context,
|
||||
'/home',
|
||||
(route) => false);
|
||||
},
|
||||
child: Text(AppLocalizations.of(context)!.sendtoserver)),
|
||||
TextButton(
|
||||
@@ -278,9 +277,11 @@ class _AddCamMainState extends State<AddCamMain> {
|
||||
(route) => false);
|
||||
},
|
||||
child: Text(AppLocalizations.of(context)!.saveasfile)),
|
||||
TextButton(onPressed: () {
|
||||
Navigator.pop(dialogContext);
|
||||
}, child: Text(AppLocalizations.of(context)!.cancel)),
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
Navigator.pop(dialogContext);
|
||||
},
|
||||
child: Text(AppLocalizations.of(context)!.cancel)),
|
||||
],
|
||||
);
|
||||
});
|
||||
@@ -321,6 +322,8 @@ class _AddCamMainState extends State<AddCamMain> {
|
||||
Future<void> saveFile() async {
|
||||
String? selectedDirectory = await FilePicker.platform.getDirectoryPath();
|
||||
|
||||
SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||
|
||||
Map place = getPlace();
|
||||
|
||||
String jsonPlace = jsonEncode(place);
|
||||
@@ -328,6 +331,7 @@ class _AddCamMainState extends State<AddCamMain> {
|
||||
if (selectedDirectory == null) {
|
||||
return;
|
||||
}
|
||||
await prefs.setString('saveDir', selectedDirectory);
|
||||
|
||||
File file = File('$selectedDirectory/cam-${id.text}.txt');
|
||||
|
||||
@@ -340,7 +344,6 @@ class _AddCamMainState extends State<AddCamMain> {
|
||||
|
||||
// checks if required fields are not empty. If one is the name will be returned
|
||||
List<String> validateData() {
|
||||
|
||||
List<String> emptyFields = <String>[];
|
||||
|
||||
Map<String, TextEditingController> fields = {
|
||||
@@ -649,8 +652,7 @@ class _AddCamMainState extends State<AddCamMain> {
|
||||
),
|
||||
Align(
|
||||
alignment: Alignment.bottomLeft,
|
||||
child:
|
||||
SonstBem(sonstBemC: sonstBemC),
|
||||
child: SonstBem(sonstBemC: sonstBemC),
|
||||
),
|
||||
],
|
||||
)),
|
||||
|
||||
@@ -46,6 +46,8 @@ class _CamIdState extends State<CamId> {
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: TextField(
|
||||
keyboardType: TextInputType.multiline,
|
||||
maxLines: null,
|
||||
decoration: InputDecoration(
|
||||
hintText: AppLocalizations.of(context)!.camLink,
|
||||
enabledBorder: widget.id.text.isEmpty
|
||||
@@ -138,6 +140,8 @@ class _RudelState extends State<Rudel> {
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: TextField(
|
||||
keyboardType: TextInputType.multiline,
|
||||
maxLines: null,
|
||||
decoration: InputDecoration(
|
||||
hintText: AppLocalizations.of(context)!.rudel,
|
||||
enabledBorder: widget.rudelC.text.isEmpty
|
||||
@@ -436,6 +440,8 @@ class _Adresse1State extends State<Adresse1> {
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: TextField(
|
||||
keyboardType: TextInputType.multiline,
|
||||
maxLines: null,
|
||||
decoration: InputDecoration(
|
||||
hintText: AppLocalizations.of(context)!.adresse1,
|
||||
enabledBorder: widget.adresse1C.text.isEmpty
|
||||
@@ -526,6 +532,8 @@ class _Adresse2State extends State<Adresse2> {
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: TextField(
|
||||
keyboardType: TextInputType.multiline,
|
||||
maxLines: null,
|
||||
decoration: InputDecoration(
|
||||
hintText: AppLocalizations.of(context)!.adresse2),
|
||||
controller: widget.adresse2C,
|
||||
@@ -604,6 +612,8 @@ class _Adresse3State extends State<Adresse3> {
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: TextField(
|
||||
keyboardType: TextInputType.multiline,
|
||||
maxLines: null,
|
||||
decoration: InputDecoration(
|
||||
hintText: AppLocalizations.of(context)!.adresse3),
|
||||
controller: widget.adresse3C,
|
||||
@@ -693,6 +703,8 @@ class _BLandState extends State<BLand> {
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: TextField(
|
||||
keyboardType: TextInputType.multiline,
|
||||
maxLines: null,
|
||||
decoration: InputDecoration(
|
||||
hintText: AppLocalizations.of(context)!.bland,
|
||||
enabledBorder: widget.bLandC.text.isEmpty
|
||||
@@ -782,6 +794,8 @@ class _LkrState extends State<Lkr> {
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: TextField(
|
||||
keyboardType: TextInputType.multiline,
|
||||
maxLines: null,
|
||||
decoration: InputDecoration(
|
||||
hintText: AppLocalizations.of(context)!.lkr,
|
||||
enabledBorder: widget.lkrC.text.isEmpty
|
||||
@@ -871,6 +885,8 @@ class _BeiOrtState extends State<BeiOrt> {
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: TextField(
|
||||
keyboardType: TextInputType.multiline,
|
||||
maxLines: null,
|
||||
decoration: InputDecoration(
|
||||
hintText: AppLocalizations.of(context)!.beiort,
|
||||
enabledBorder: widget.beiOrtC.text.isEmpty
|
||||
@@ -960,6 +976,8 @@ class _OrtInfoState extends State<OrtInfo> {
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: TextField(
|
||||
keyboardType: TextInputType.multiline,
|
||||
maxLines: null,
|
||||
decoration: InputDecoration(
|
||||
hintText: AppLocalizations.of(context)!.ortinfo,
|
||||
),
|
||||
@@ -1160,6 +1178,8 @@ class _FFTypState extends State<FFTyp> {
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: TextField(
|
||||
keyboardType: TextInputType.multiline,
|
||||
maxLines: null,
|
||||
decoration: InputDecoration(
|
||||
hintText: AppLocalizations.of(context)!.fftyp,
|
||||
enabledBorder: widget.ffTypC.text.isEmpty
|
||||
@@ -1500,6 +1520,8 @@ class _KSchloNrState extends State<KSchloNr> {
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: TextField(
|
||||
keyboardType: TextInputType.multiline,
|
||||
maxLines: null,
|
||||
decoration: InputDecoration(
|
||||
hintText: AppLocalizations.of(context)!.kschlonr),
|
||||
controller: widget.kSchloNrC,
|
||||
@@ -1755,6 +1777,8 @@ class _AuftragState extends State<Auftrag> {
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: TextField(
|
||||
keyboardType: TextInputType.multiline,
|
||||
maxLines: null,
|
||||
decoration: InputDecoration(
|
||||
hintText: AppLocalizations.of(context)!.auftrag),
|
||||
controller: widget.auftragC,
|
||||
@@ -1831,6 +1855,8 @@ class _KontAbspState extends State<KontAbsp> {
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: TextField(
|
||||
keyboardType: TextInputType.multiline,
|
||||
maxLines: null,
|
||||
decoration: InputDecoration(
|
||||
hintText: AppLocalizations.of(context)!.kontabsp),
|
||||
controller: widget.kontAbspC,
|
||||
@@ -1907,6 +1933,8 @@ class _SonstBemState extends State<SonstBem> {
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: TextField(
|
||||
keyboardType: TextInputType.multiline,
|
||||
maxLines: null,
|
||||
decoration: InputDecoration(
|
||||
hintText: AppLocalizations.of(context)!.sonstbemerkungen),
|
||||
controller: widget.sonstBemC,
|
||||
@@ -1983,6 +2011,8 @@ class _FKontakt1State extends State<FKontakt1> {
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: TextField(
|
||||
keyboardType: TextInputType.multiline,
|
||||
maxLines: null,
|
||||
decoration: InputDecoration(
|
||||
hintText: AppLocalizations.of(context)!.fkontakt1),
|
||||
controller: widget.fKontakt1C,
|
||||
@@ -2059,6 +2089,8 @@ class _FKontakt2State extends State<FKontakt2> {
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: TextField(
|
||||
keyboardType: TextInputType.multiline,
|
||||
maxLines: null,
|
||||
decoration: InputDecoration(
|
||||
hintText: AppLocalizations.of(context)!.fkontakt2),
|
||||
controller: widget.fKontakt2C,
|
||||
@@ -2135,6 +2167,8 @@ class _FKontakt3State extends State<FKontakt3> {
|
||||
Expanded(
|
||||
flex: 3,
|
||||
child: TextField(
|
||||
keyboardType: TextInputType.multiline,
|
||||
maxLines: null,
|
||||
decoration: InputDecoration(
|
||||
hintText: AppLocalizations.of(context)!.fkontakt3),
|
||||
controller: widget.fKontakt3C,
|
||||
@@ -2211,6 +2245,8 @@ class _StandortState extends State<Standort> {
|
||||
Expanded(
|
||||
flex: 3,
|
||||
child: TextField(
|
||||
keyboardType: TextInputType.multiline,
|
||||
maxLines: null,
|
||||
decoration: InputDecoration(
|
||||
hintText: AppLocalizations.of(context)!.altstort,
|
||||
enabledBorder: widget.standortC.text.isEmpty
|
||||
@@ -2385,6 +2421,8 @@ class _IntKommState extends State<IntKomm> {
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: TextField(
|
||||
keyboardType: TextInputType.multiline,
|
||||
maxLines: null,
|
||||
decoration: InputDecoration(
|
||||
hintText: AppLocalizations.of(context)!.intkomm),
|
||||
controller: widget.intKommC,
|
||||
@@ -2461,6 +2499,8 @@ class _BetreuungState extends State<Betreuung> {
|
||||
Expanded(
|
||||
flex: 3,
|
||||
child: TextField(
|
||||
keyboardType: TextInputType.multiline,
|
||||
maxLines: null,
|
||||
decoration: InputDecoration(
|
||||
hintText: AppLocalizations.of(context)!.betreuung),
|
||||
controller: widget.betreuungC,
|
||||
|
||||
Reference in New Issue
Block a user