Commit 2db2fa9

derdilla <derdilla06@gmail.com>
2023-06-17 07:41:23
move export buttons to second screen
1 parent 4daaec1
Changed files (4)
lib/l10n/app_de.arb
@@ -82,11 +82,9 @@
   "pdf": "PDF",
   "text": "Text",
   "other": "Anderes",
-  "fieldDelimiter": "Feld separator",
+  "fieldDelimiter": "Feldseparator",
   "textDelimiter": "Textbegrenzung",
-  "useExportCompatability": "Kompatibler Export",
-  "useExportCompatabilityDesc": "Signalisiert Export als Text",
-  "export": "Exportieren",
+  "export": "EXPORT",
   "exportSuccess": "Exportiert in: {path}",
   "@exportSuccess": {
     "placeholders": {
@@ -96,7 +94,7 @@
     }
   },
   "shared": "Geteilt",
-  "import": "Import",
+  "import": "IMPORT",
   "sourceCode": "Quellcode",
   "licenses": "Lizenzen dritter",
 
lib/l10n/app_en.arb
@@ -78,15 +78,14 @@
   "exportImport": "export / import",
   "exportFormat": "export format",
   "exportMimeType": "export MIME type",
+  "exportMimeTypeDesc": "signalizes type to other apps",
   "csv": "CSV",
   "pdf": "PDF",
   "text": "text",
   "other": "other",
   "fieldDelimiter": "field delimiter",
   "textDelimiter": "text delimiter",
-  "useExportCompatability": "compatability export",
-  "useExportCompatabilityDesc": "sets export mime type to text",
-  "export": "export",
+  "export": "EXPORT",
   "exportSuccess": "Exported to: {path}",
   "@exportSuccess": {
     "placeholders": {
@@ -96,7 +95,7 @@
     }
   },
   "shared": "shared",
-  "import": "import",
+  "import": "IMPORT",
   "sourceCode": "source code",
   "licenses": "3rd party licenses",
 
lib/screens/subsettings/export_import_screen.dart
@@ -1,8 +1,8 @@
 
 import 'package:blood_pressure_app/components/settings_widgets.dart';
+import 'package:blood_pressure_app/model/blood_pressure.dart';
 import 'package:blood_pressure_app/model/export_import.dart';
 import 'package:blood_pressure_app/model/settings_store.dart';
-import 'package:file_saver/file_saver.dart' show MimeType;
 import 'package:flutter/material.dart';
 import 'package:flutter_gen/gen_l10n/app_localizations.dart';
 import 'package:provider/provider.dart';
@@ -45,9 +45,25 @@ class ExportImportScreen extends StatelessWidget {
         }
 
         List<Widget> options = [
+          DropDownSettingsTile<ExportFormat>(
+            key: const Key('exportFormat'),
+            title: Text(AppLocalizations.of(context)!.exportFormat),
+            value: settings.exportFormat,
+            items: [
+              DropdownMenuItem(value: ExportFormat.csv, child: Text(AppLocalizations.of(context)!.csv)),
+              DropdownMenuItem(value: ExportFormat.pdf, child: Text(AppLocalizations.of(context)!.pdf)),
+            ],
+            onChanged: (ExportFormat? value) {
+              if (value != null) {
+                settings.exportFormat = value;
+              }
+            },
+          ),
+          /*
           DropDownSettingsTile<MimeType>(
             key: const Key('exportMimeType'),
             title: Text(AppLocalizations.of(context)!.exportMimeType),
+            description: Text(AppLocalizations.of(context)!.exportMimeTypeDesc),
             value: settings.exportMimeType,
             items: [
               DropdownMenuItem(value: MimeType.csv, child: Text(AppLocalizations.of(context)!.csv)),
@@ -61,27 +77,66 @@ class ExportImportScreen extends StatelessWidget {
               }
             },
           ),
-          DropDownSettingsTile<ExportFormat>(
-            key: const Key('exportFormat'),
-            title: Text(AppLocalizations.of(context)!.exportFormat),
-            value: settings.exportFormat,
-            items: [
-              DropdownMenuItem(value: ExportFormat.csv, child: Text(AppLocalizations.of(context)!.csv)),
-              DropdownMenuItem(value: ExportFormat.pdf, child: Text(AppLocalizations.of(context)!.pdf)),
-            ],
-            onChanged: (ExportFormat? value) {
-              if (value != null) {
-                settings.exportFormat = value;
-              }
-            },
-          )
+           */
         ];
         options.addAll(modeSpecificSettings);
-
         return ListView(
           children: options,
         );
       }),
+      floatingActionButton: SizedBox(
+        height: 60,
+        child: Center(
+          child: Row(
+            children: [
+              Expanded(
+                  flex: 50,
+                  child: MaterialButton(
+                    height: 60,
+                    child:  Text(AppLocalizations.of(context)!.export),
+                    onPressed: () {
+                      Provider.of<BloodPressureModel>(context, listen: false).save((success, msg) {
+                        if (success && msg != null) {
+                          ScaffoldMessenger.of(context)
+                              .showSnackBar(SnackBar(content: Text(AppLocalizations.of(context)!.success(msg))));
+                        } else if (!success && msg != null) {
+                          ScaffoldMessenger.of(context)
+                              .showSnackBar(SnackBar(content: Text(AppLocalizations.of(context)!.error(msg))));
+                        }
+                      }, exportAsText: false);
+                    },
+                  )
+              ),
+              const VerticalDivider(),
+              Expanded(
+                flex: 50,
+                child: MaterialButton(
+                  height: 60,
+                  child: Text(AppLocalizations.of(context)!.import),
+                  onPressed: () {
+                    try {
+                      Provider.of<BloodPressureModel>(context, listen: false).import((res) {
+                        if (res) {
+                          ScaffoldMessenger.of(context).showSnackBar(SnackBar(
+                              content:
+                              Text(AppLocalizations.of(context)!.success(AppLocalizations.of(context)!.import))));
+                        } else {
+                          ScaffoldMessenger.of(context).showSnackBar(SnackBar(
+                              content: Text(AppLocalizations.of(context)!
+                                  .error(AppLocalizations.of(context)!.errNoFileOpened))));
+                        }
+                      });
+                    } on Exception catch (e) {
+                      ScaffoldMessenger.of(context)
+                          .showSnackBar(SnackBar(content: Text(AppLocalizations.of(context)!.error(e.toString()))));
+                    }
+                  },
+                )
+              ),
+            ],
+          ),
+        ),
+      ),
     );
   }
 }
lib/screens/settings.dart
@@ -1,5 +1,4 @@
 import 'package:blood_pressure_app/components/settings_widgets.dart';
-import 'package:blood_pressure_app/model/blood_pressure.dart';
 import 'package:blood_pressure_app/model/settings_store.dart';
 import 'package:blood_pressure_app/screens/subsettings/enter_timeformat.dart';
 import 'package:blood_pressure_app/screens/subsettings/export_import_screen.dart';
@@ -245,7 +244,8 @@ class SettingsPage extends StatelessWidget {
               title: Text(AppLocalizations.of(context)!.data),
               children: [
                 SettingsTile(
-                    title: const Text('EXPORT'),
+                    title: Text(AppLocalizations.of(context)!.exportImport),
+                    leading: const Icon(Icons.download),
                     trailing: const Icon(Icons.arrow_forward_ios),
                     onPressed: (context) {
                       Navigator.push(
@@ -254,43 +254,6 @@ class SettingsPage extends StatelessWidget {
                       );
                     }
                 ),
-                SettingsTile(
-                  key: const Key('export'),
-                  title: Text(AppLocalizations.of(context)!.export),
-                  leading: const Icon(Icons.save),
-                  onPressed: (context) => Provider.of<BloodPressureModel>(context, listen: false).save((success, msg) {
-                    if (success && msg != null) {
-                      ScaffoldMessenger.of(context)
-                          .showSnackBar(SnackBar(content: Text(AppLocalizations.of(context)!.success(msg))));
-                    } else if (!success && msg != null) {
-                      ScaffoldMessenger.of(context)
-                          .showSnackBar(SnackBar(content: Text(AppLocalizations.of(context)!.error(msg))));
-                    }
-                  }, exportAsText: false),
-                ),
-                SettingsTile(
-                  key: const Key('import'),
-                  title: Text(AppLocalizations.of(context)!.import),
-                  leading: const Icon(Icons.file_upload),
-                  onPressed: (context) {
-                    try {
-                      Provider.of<BloodPressureModel>(context, listen: false).import((res) {
-                        if (res) {
-                          ScaffoldMessenger.of(context).showSnackBar(SnackBar(
-                              content:
-                                  Text(AppLocalizations.of(context)!.success(AppLocalizations.of(context)!.import))));
-                        } else {
-                          ScaffoldMessenger.of(context).showSnackBar(SnackBar(
-                              content: Text(AppLocalizations.of(context)!
-                                  .error(AppLocalizations.of(context)!.errNoFileOpened))));
-                        }
-                      });
-                    } on Exception catch (e) {
-                      ScaffoldMessenger.of(context)
-                          .showSnackBar(SnackBar(content: Text(AppLocalizations.of(context)!.error(e.toString()))));
-                    }
-                  },
-                ),
               ],
             ),
             SettingsSection(title: const Text('about'), children: [