Commit af23ee2

derdilla <82763757+NobodyForNothing@users.noreply.github.com>
2024-06-27 14:31:33
wrap fullscreen dialoges directly
Signed-off-by: derdilla <82763757+NobodyForNothing@users.noreply.github.com>
1 parent a0f38bd
app/lib/components/dialoges/add_export_column_dialoge.dart
@@ -64,7 +64,7 @@ class _AddExportColumnDialogeState extends State<AddExportColumnDialoge>
 
     _controller = AnimationController(
       value: (type == _FormatterType.record) ? 1 : 0,
-      duration: Duration(milliseconds: context.watch<Settings>().animationSpeed),
+      duration: Duration(milliseconds: context.read<Settings>().animationSpeed),
       vsync: this,
     );
   }
@@ -336,9 +336,7 @@ Future<ExportColumn?> showAddExportColumnDialoge(
   BuildContext context, [
     ExportColumn? initialColumn,
 ]) => showDialog<ExportColumn?>(context: context,
-  builder: (context) => Dialog.fullscreen(
-    child: AddExportColumnDialoge(
-      initialColumn: initialColumn,
-    ),
+  builder: (context) => AddExportColumnDialoge(
+    initialColumn: initialColumn,
   ),
 );
app/lib/components/dialoges/add_measurement_dialoge.dart
@@ -424,12 +424,9 @@ Future<FullEntry?> showAddEntryDialoge(
 ]) async {
   final meds = await medRepo.getAll();
   return showDialog<FullEntry>(
-      context: context, builder: (context) =>
-      Dialog.fullscreen(
-        child: AddEntryDialoge(
-          initialRecord: initialRecord,
-          availableMeds: meds,
-        ),
-      ),
+    context: context, builder: (context) => AddEntryDialoge(
+      initialRecord: initialRecord,
+      availableMeds: meds,
+    ),
   );
 }
app/lib/components/dialoges/add_medication_dialoge.dart
@@ -99,6 +99,6 @@ class _AddMedicationDialogeState extends State<AddMedicationDialoge> {
 ///
 /// The created medicine gets an index that was never in settings.
 Future<Medicine?> showAddMedicineDialoge(BuildContext context) =>
-  showDialog<Medicine?>(context: context, builder: (context) => Dialog.fullscreen(
-    child: AddMedicationDialoge(),
-  ),);
+  showDialog<Medicine?>(context: context,
+    builder: (context) => AddMedicationDialoge(),
+  );
app/lib/components/dialoges/enter_timeformat_dialoge.dart
@@ -96,6 +96,7 @@ class _EnterTimeFormatDialogeState extends State<EnterTimeFormatDialoge> {
 ///
 /// When canceled null is returned.
 Future<String?> showTimeFormatPickerDialoge(BuildContext context, String initialTimeFormat, bool bottomAppBars) =>
-  showDialog<String?>(context: context, builder: (context) => Dialog.fullscreen(
-    child: EnterTimeFormatDialoge(initialValue: initialTimeFormat, bottomAppBars: bottomAppBars,),
-  ),);
+  showDialog<String?>(context: context, builder: (context) => EnterTimeFormatDialoge(
+    initialValue: initialTimeFormat,
+    bottomAppBars: bottomAppBars,),
+  );
app/lib/components/dialoges/fullscreen_dialoge.dart
@@ -2,8 +2,6 @@ import 'package:flutter/material.dart';
 
 /// Base for fullscreen dialoges that allow value input.
 class FullscreenDialoge extends StatelessWidget {
-  // TODO: directly wrap in dialoge.fullscreen and remove it from code
-
   /// Create a dialoge that has a icon- and a textbutton in the app bar.
   const FullscreenDialoge({super.key,
     this.body,
@@ -55,15 +53,17 @@ class FullscreenDialoge extends StatelessWidget {
   final List<Widget> actions;
 
   @override
-  Widget build(BuildContext context) => Scaffold(
-    body: body,
-    appBar: bottomAppBar ? null : _buildAppBar(context),
-    bottomNavigationBar: bottomAppBar ? BottomAppBar(
-      color: Colors.transparent,
-      shadowColor: Colors.transparent,
-      surfaceTintColor: Colors.transparent,
-      child: _buildAppBar(context),
-    ) : null,
+  Widget build(BuildContext context) => Dialog.fullscreen(
+    child: Scaffold(
+      body: body,
+      appBar: bottomAppBar ? null : _buildAppBar(context),
+      bottomNavigationBar: bottomAppBar ? BottomAppBar(
+        color: Colors.transparent,
+        shadowColor: Colors.transparent,
+        surfaceTintColor: Colors.transparent,
+        child: _buildAppBar(context),
+      ) : null,
+    ),
   );
 
   PreferredSizeWidget _buildAppBar(BuildContext context) => AppBar(
app/lib/components/dialoges/import_preview_dialoge.dart
@@ -199,11 +199,9 @@ Future<List<FullEntry>?> showImportPreview(
   bool bottomAppBar,) =>
   showDialog<List<FullEntry>>(
     context: context, builder: (context) =>
-    Dialog.fullscreen(
-      child: ImportPreviewDialoge(
-        bottomAppBar: bottomAppBar,
-        initialActor: initialActor,
-        columnsManager: columnsManager,
-      ),
+    ImportPreviewDialoge(
+      bottomAppBar: bottomAppBar,
+      initialActor: initialActor,
+      columnsManager: columnsManager,
     ),
   );
app/lib/components/dialoges/input_dialoge.dart
@@ -76,12 +76,13 @@ class _InputDialogeState extends State<InputDialoge> {
         onSubmitted: _onSubmit,
       ),
       actions: [
+        TextButton(
+          onPressed: () => Navigator.pop(context),
+          child: Text(localizations.btnCancel),
+        ),
         ElevatedButton(
-            onPressed: () => Navigator.pop(context, null),
-            child: Text(localizations.btnCancel),),
-        ElevatedButton(
-            onPressed: () => _onSubmit(controller.text),
-            child: Text(localizations.btnConfirm),),
+          onPressed: () => _onSubmit(controller.text),
+          child: Text(localizations.btnConfirm),),
       ],
     );
   }
app/lib/screens/subsettings/foreign_db_import_screen.dart
@@ -188,11 +188,8 @@ Future<List<BloodPressureRecord>?> showForeignDBImportDialoge(
     bool bottomAppBars,
     Database db,) =>
     showDialog<List<BloodPressureRecord>>(
-      context: context, builder: (context) =>
-        Dialog.fullscreen(
-          child: ForeignDBImportScreen(
-            bottomAppBars: bottomAppBars,
-            db: db,
-          ),
-        ),
+      context: context, builder: (context) => ForeignDBImportScreen(
+        bottomAppBars: bottomAppBars,
+        db: db,
+      ),
     );