From aea18c3262734d865464ee0acef85677d6764da7 Mon Sep 17 00:00:00 2001 From: Dan Cojocaru Date: Sun, 19 Jun 2022 07:48:24 +0300 Subject: [PATCH] Made new project dialog scrollable This is useful in case of small screens --- lib/dialogs/new_project.dart | 138 ++++++++++++++++++----------------- 1 file changed, 70 insertions(+), 68 deletions(-) diff --git a/lib/dialogs/new_project.dart b/lib/dialogs/new_project.dart index 2cb2e95..da4163f 100644 --- a/lib/dialogs/new_project.dart +++ b/lib/dialogs/new_project.dart @@ -21,88 +21,90 @@ class NewProjectDialog extends HookWidget { }, [newDialogNameController.text]); return Dialog( - child: Padding( - padding: const EdgeInsets.all(8.0), - child: IntrinsicWidth( - child: Column( - crossAxisAlignment: CrossAxisAlignment.stretch, - mainAxisSize: MainAxisSize.min, - children: [ - Align( - alignment: Alignment.centerRight, - child: IconButton( - icon: const Icon(Icons.close), - tooltip: 'Close', - onPressed: () { - Navigator.of(context).pop(); - }, - ), - ), - Center( - child: Padding( - padding: const EdgeInsets.all(8.0), - child: OutlinedButton.icon( + child: SingleChildScrollView( + child: Padding( + padding: const EdgeInsets.all(8.0), + child: IntrinsicWidth( + child: Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + mainAxisSize: MainAxisSize.min, + children: [ + Align( + alignment: Alignment.centerRight, + child: IconButton( + icon: const Icon(Icons.close), + tooltip: 'Close', onPressed: () { - // TODO: Implement project importing - ScaffoldMessenger.of(context).showSnackBar(const SnackBar( - content: Text('Import coming soon...'), - )); + Navigator.of(context).pop(); }, - icon: const Icon(Icons.download), - label: const Text('Import Project'), ), ), - ), - Row( - children: [ - const Expanded( - child: Padding( - padding: EdgeInsets.all(8.0), - child: Divider(), + Center( + child: Padding( + padding: const EdgeInsets.all(8.0), + child: OutlinedButton.icon( + onPressed: () { + // TODO: Implement project importing + ScaffoldMessenger.of(context).showSnackBar(const SnackBar( + content: Text('Import coming soon...'), + )); + }, + icon: const Icon(Icons.download), + label: const Text('Import Project'), ), ), - Padding( - padding: const EdgeInsets.symmetric(vertical: 8.0), - child: Text( - 'OR', - style: Theme.of(context).textTheme.caption, + ), + Row( + children: [ + const Expanded( + child: Padding( + padding: EdgeInsets.all(8.0), + child: Divider(), + ), ), - ), - const Expanded( - child: Padding( - padding: EdgeInsets.all(8.0), - child: Divider(), + Padding( + padding: const EdgeInsets.symmetric(vertical: 8.0), + child: Text( + 'OR', + style: Theme.of(context).textTheme.caption, + ), ), + const Expanded( + child: Padding( + padding: EdgeInsets.all(8.0), + child: Divider(), + ), + ), + ], + ), + Padding( + padding: const EdgeInsets.all(8.0), + child: Text( + 'New Project', + style: Theme.of(context).textTheme.headline6, + textAlign: TextAlign.center, ), - ], - ), - Padding( - padding: const EdgeInsets.all(8.0), - child: Text( - 'New Project', - style: Theme.of(context).textTheme.headline6, - textAlign: TextAlign.center, ), - ), - Padding( - padding: const EdgeInsets.all(8.0), - child: Container( - constraints: const BoxConstraints(minWidth: 300), - child: TextField( - controller: newDialogNameController, - decoration: InputDecoration( - border: const OutlineInputBorder(), - labelText: 'Project name', - suffixIcon: IconButton( - icon: const Icon(Icons.done), - onPressed: newProjectAction, + Padding( + padding: const EdgeInsets.all(8.0), + child: Container( + constraints: const BoxConstraints(minWidth: 300), + child: TextField( + controller: newDialogNameController, + decoration: InputDecoration( + border: const OutlineInputBorder(), + labelText: 'Project name', + suffixIcon: IconButton( + icon: const Icon(Icons.done), + onPressed: newProjectAction, + ), ), + onSubmitted: newProjectAction == null ? null : (_) => newProjectAction(), ), - onSubmitted: newProjectAction == null ? null : (_) => newProjectAction(), ), ), - ), - ], + ], + ), ), ), ),