From 7ce90a783de502e933dec8e0e57bfd7b6b0e0a10 Mon Sep 17 00:00:00 2001 From: Vladimir Vuckovic Date: Wed, 26 Jun 2024 08:29:33 +0200 Subject: [PATCH 01/13] chore: redesign of dialogs --- .../lib/core/modals/add_quota_dialog.dart | 7 ++- .../modals/create_client_dialog.dart | 3 + .../modals/show_create_tier_dialog.dart | 63 +++++++++++-------- 3 files changed, 46 insertions(+), 27 deletions(-) diff --git a/AdminUi/apps/admin_ui/lib/core/modals/add_quota_dialog.dart b/AdminUi/apps/admin_ui/lib/core/modals/add_quota_dialog.dart index c8e021a0ac..7486ddacac 100644 --- a/AdminUi/apps/admin_ui/lib/core/modals/add_quota_dialog.dart +++ b/AdminUi/apps/admin_ui/lib/core/modals/add_quota_dialog.dart @@ -82,12 +82,16 @@ class _AddQuotaDialogState extends State<_AddQuotaDialog> { return PopScope( canPop: !_saving, child: AlertDialog( - title: const Text('Add Quota'), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(8), + ), + title: const Center(child: Text('Add Quota')), content: SizedBox( width: 500, child: Column( mainAxisSize: MainAxisSize.min, children: [ + Gaps.h32, DropdownButtonFormField( value: _selectedMetric, items: widget.availableMetrics.map((metric) => DropdownMenuItem(value: metric.key, child: Text(metric.displayName))).toList(), @@ -133,6 +137,7 @@ class _AddQuotaDialogState extends State<_AddQuotaDialog> { style: TextStyle(color: Theme.of(context).colorScheme.error), ), ), + Gaps.h32, ], ), ), diff --git a/AdminUi/apps/admin_ui/lib/home/clients_overview/modals/create_client_dialog.dart b/AdminUi/apps/admin_ui/lib/home/clients_overview/modals/create_client_dialog.dart index 75d5de3feb..3614e4c24e 100644 --- a/AdminUi/apps/admin_ui/lib/home/clients_overview/modals/create_client_dialog.dart +++ b/AdminUi/apps/admin_ui/lib/home/clients_overview/modals/create_client_dialog.dart @@ -63,6 +63,9 @@ class _CreateClientDialogState extends State<_CreateClientDialog> { return PopScope( canPop: !_saving, child: AlertDialog( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(8), + ), title: const Text('Create Client', textAlign: TextAlign.center), content: SizedBox( width: 500, diff --git a/AdminUi/apps/admin_ui/lib/home/tiers_overview/modals/show_create_tier_dialog.dart b/AdminUi/apps/admin_ui/lib/home/tiers_overview/modals/show_create_tier_dialog.dart index 73f92de7de..b4e66823ae 100644 --- a/AdminUi/apps/admin_ui/lib/home/tiers_overview/modals/show_create_tier_dialog.dart +++ b/AdminUi/apps/admin_ui/lib/home/tiers_overview/modals/show_create_tier_dialog.dart @@ -44,38 +44,49 @@ class _CreateTierDialogState extends State<_CreateTierDialog> { return PopScope( canPop: !_isLoading, child: AlertDialog( - title: const Text('Create Tier'), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(8), + ), + title: const Center( + child: Padding( + padding: EdgeInsets.all(16), + child: Text('Create Tier'), + )), content: _isLoading ? const Padding( padding: EdgeInsets.all(16), child: Wrap(alignment: WrapAlignment.center, children: [CircularProgressIndicator()]), ) - : Column( - mainAxisSize: MainAxisSize.min, - children: [ - const Text('Please fill the form below to create your Tier'), - Gaps.h16, - TextField( - controller: _tierNameController, - focusNode: _focusNode, - onChanged: (_) { - if (_errorMessage == null) return; - setState(() => _errorMessage = null); - }, - onSubmitted: _onSubmitted, - decoration: InputDecoration( - border: const OutlineInputBorder(), - labelText: 'Name', - error: _errorMessage != null - ? Text( - _errorMessage!, - style: Theme.of(context).textTheme.labelSmall!.copyWith(color: Theme.of(context).colorScheme.error), - textAlign: TextAlign.left, - ) - : null, + : SizedBox( + width: 500, + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Gaps.h16, + TextField( + controller: _tierNameController, + focusNode: _focusNode, + onChanged: (_) { + if (_errorMessage == null) return; + setState(() => _errorMessage = null); + }, + onSubmitted: _onSubmitted, + decoration: InputDecoration( + border: const OutlineInputBorder(), + labelText: 'Name', + helperText: 'Enter a name to create your Tier.', + error: _errorMessage != null + ? Text( + _errorMessage!, + style: Theme.of(context).textTheme.labelSmall!.copyWith(color: Theme.of(context).colorScheme.error), + textAlign: TextAlign.left, + ) + : null, + ), ), - ), - ], + Gaps.h32, + ], + ), ), actions: [ OutlinedButton( From 1e6ef57b1624611cce47c4aea643ca3e0e602cd0 Mon Sep 17 00:00:00 2001 From: Vladimir Vuckovic Date: Wed, 26 Jun 2024 08:30:24 +0200 Subject: [PATCH 02/13] fix: add trailing comma --- .../tiers_overview/modals/show_create_tier_dialog.dart | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/AdminUi/apps/admin_ui/lib/home/tiers_overview/modals/show_create_tier_dialog.dart b/AdminUi/apps/admin_ui/lib/home/tiers_overview/modals/show_create_tier_dialog.dart index b4e66823ae..705bca5f93 100644 --- a/AdminUi/apps/admin_ui/lib/home/tiers_overview/modals/show_create_tier_dialog.dart +++ b/AdminUi/apps/admin_ui/lib/home/tiers_overview/modals/show_create_tier_dialog.dart @@ -48,10 +48,11 @@ class _CreateTierDialogState extends State<_CreateTierDialog> { borderRadius: BorderRadius.circular(8), ), title: const Center( - child: Padding( - padding: EdgeInsets.all(16), - child: Text('Create Tier'), - )), + child: Padding( + padding: EdgeInsets.all(16), + child: Text('Create Tier'), + ), + ), content: _isLoading ? const Padding( padding: EdgeInsets.all(16), From 65c2b4c2806aba4744db518efdc5f08a5c29aa80 Mon Sep 17 00:00:00 2001 From: Vladimir Vuckovic Date: Wed, 26 Jun 2024 08:36:38 +0200 Subject: [PATCH 03/13] chore: rename buttons and title --- ..._quota_dialog.dart => assign_quota_dialog.dart} | 14 +++++++------- AdminUi/apps/admin_ui/lib/core/modals/modals.dart | 2 +- .../modals/create_client_dialog.dart | 4 +++- .../modals/show_create_tier_dialog.dart | 2 +- AdminUi/apps/admin_ui/lib/l10n/app_en.arb | 2 ++ 5 files changed, 14 insertions(+), 10 deletions(-) rename AdminUi/apps/admin_ui/lib/core/modals/{add_quota_dialog.dart => assign_quota_dialog.dart} (93%) diff --git a/AdminUi/apps/admin_ui/lib/core/modals/add_quota_dialog.dart b/AdminUi/apps/admin_ui/lib/core/modals/assign_quota_dialog.dart similarity index 93% rename from AdminUi/apps/admin_ui/lib/core/modals/add_quota_dialog.dart rename to AdminUi/apps/admin_ui/lib/core/modals/assign_quota_dialog.dart index 7486ddacac..3430e77b88 100644 --- a/AdminUi/apps/admin_ui/lib/core/modals/add_quota_dialog.dart +++ b/AdminUi/apps/admin_ui/lib/core/modals/assign_quota_dialog.dart @@ -22,7 +22,7 @@ Future showAddQuotaDialog({ await showDialog( context: context, - builder: (BuildContext context) => _AddQuotaDialog( + builder: (BuildContext context) => _AssignQuotaDialog( availableMetrics: metrics.data, addQuota: ({required String metricKey, required int max, required String period}) { if (tierId != null) { @@ -36,22 +36,22 @@ Future showAddQuotaDialog({ ); } -class _AddQuotaDialog extends StatefulWidget { +class _AssignQuotaDialog extends StatefulWidget { final List availableMetrics; final Future> Function({required String metricKey, required int max, required String period}) addQuota; final VoidCallback onQuotaAdded; - const _AddQuotaDialog({ + const _AssignQuotaDialog({ required this.availableMetrics, required this.addQuota, required this.onQuotaAdded, }); @override - State<_AddQuotaDialog> createState() => _AddQuotaDialogState(); + State<_AssignQuotaDialog> createState() => _AssignQuotaDialogState(); } -class _AddQuotaDialogState extends State<_AddQuotaDialog> { +class _AssignQuotaDialogState extends State<_AssignQuotaDialog> { final _maxAmountController = TextEditingController(); bool _saving = false; @@ -85,7 +85,7 @@ class _AddQuotaDialogState extends State<_AddQuotaDialog> { shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(8), ), - title: const Center(child: Text('Add Quota')), + title: const Center(child: Text('Assign Quota')), content: SizedBox( width: 500, child: Column( @@ -148,7 +148,7 @@ class _AddQuotaDialogState extends State<_AddQuotaDialog> { ), FilledButton( onPressed: _isValid && !_saving ? _addQuota : null, - child: const Text('Add'), + child: Text(context.l10n.assign), ), ], ), diff --git a/AdminUi/apps/admin_ui/lib/core/modals/modals.dart b/AdminUi/apps/admin_ui/lib/core/modals/modals.dart index 605a274b70..21a6ce9156 100644 --- a/AdminUi/apps/admin_ui/lib/core/modals/modals.dart +++ b/AdminUi/apps/admin_ui/lib/core/modals/modals.dart @@ -1,3 +1,3 @@ -export 'add_quota_dialog.dart'; +export 'assign_quota_dialog.dart'; export 'confirmation_dialog.dart'; export 'settings_dialog.dart'; diff --git a/AdminUi/apps/admin_ui/lib/home/clients_overview/modals/create_client_dialog.dart b/AdminUi/apps/admin_ui/lib/home/clients_overview/modals/create_client_dialog.dart index 3614e4c24e..8e24055c75 100644 --- a/AdminUi/apps/admin_ui/lib/home/clients_overview/modals/create_client_dialog.dart +++ b/AdminUi/apps/admin_ui/lib/home/clients_overview/modals/create_client_dialog.dart @@ -72,6 +72,7 @@ class _CreateClientDialogState extends State<_CreateClientDialog> { child: Column( mainAxisSize: MainAxisSize.min, children: [ + Gaps.h32, TextField( controller: _clientIdController, readOnly: _saveSucceeded, @@ -163,6 +164,7 @@ class _CreateClientDialogState extends State<_CreateClientDialog> { style: TextStyle(color: Theme.of(context).colorScheme.error), ), ], + Gaps.h32 ], ), ), @@ -171,7 +173,7 @@ class _CreateClientDialogState extends State<_CreateClientDialog> { if (!_saveSucceeded) FilledButton( onPressed: _chosenDefaultTier != null && !_saveSucceeded && !_saving ? _createClient : null, - child: Text(context.l10n.save), + child: Text(context.l10n.create), ), ], ), diff --git a/AdminUi/apps/admin_ui/lib/home/tiers_overview/modals/show_create_tier_dialog.dart b/AdminUi/apps/admin_ui/lib/home/tiers_overview/modals/show_create_tier_dialog.dart index 705bca5f93..40f0131032 100644 --- a/AdminUi/apps/admin_ui/lib/home/tiers_overview/modals/show_create_tier_dialog.dart +++ b/AdminUi/apps/admin_ui/lib/home/tiers_overview/modals/show_create_tier_dialog.dart @@ -96,7 +96,7 @@ class _CreateTierDialogState extends State<_CreateTierDialog> { ), FilledButton( onPressed: _isLoading ? null : () => _onSubmitted(_tierNameController.text), - child: const Text('Create'), + child: Text(context.l10n.create), ), ], ), diff --git a/AdminUi/apps/admin_ui/lib/l10n/app_en.arb b/AdminUi/apps/admin_ui/lib/l10n/app_en.arb index d170ca5ee4..ec4352df8c 100644 --- a/AdminUi/apps/admin_ui/lib/l10n/app_en.arb +++ b/AdminUi/apps/admin_ui/lib/l10n/app_en.arb @@ -1,7 +1,9 @@ { "@@locale": "en", + "assign": "Assign", "cancel": "Cancel", "close": "Close", + "create": "Create", "save": "Save", "yes": "Yes" } From 0dee658335e391277e2763d53de4b5cc6922dccb Mon Sep 17 00:00:00 2001 From: Vladimir Vuckovic Date: Wed, 26 Jun 2024 08:44:03 +0200 Subject: [PATCH 04/13] fix: add trailing comma --- .../lib/home/clients_overview/modals/create_client_dialog.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AdminUi/apps/admin_ui/lib/home/clients_overview/modals/create_client_dialog.dart b/AdminUi/apps/admin_ui/lib/home/clients_overview/modals/create_client_dialog.dart index 8e24055c75..5fd0bc3d62 100644 --- a/AdminUi/apps/admin_ui/lib/home/clients_overview/modals/create_client_dialog.dart +++ b/AdminUi/apps/admin_ui/lib/home/clients_overview/modals/create_client_dialog.dart @@ -164,7 +164,7 @@ class _CreateClientDialogState extends State<_CreateClientDialog> { style: TextStyle(color: Theme.of(context).colorScheme.error), ), ], - Gaps.h32 + Gaps.h32, ], ), ), From f8508fbfbdf478e92eaed1ccd503b2dcba4e6d40 Mon Sep 17 00:00:00 2001 From: Vladimir Vuckovic Date: Mon, 1 Jul 2024 08:25:05 +0200 Subject: [PATCH 05/13] chore: add more dialog redesign --- .../lib/core/modals/assign_quota_dialog.dart | 2 +- .../lib/core/modals/confirmation_dialog.dart | 12 ++++++-- .../lib/core/modals/settings_dialog.dart | 7 ++++- .../modals/change_client_secret_dialog.dart | 5 ++++ .../identity_details/modals/change_tier.dart | 29 ++++++++++++------- .../modals/show_create_tier_dialog.dart | 9 ++---- 6 files changed, 42 insertions(+), 22 deletions(-) diff --git a/AdminUi/apps/admin_ui/lib/core/modals/assign_quota_dialog.dart b/AdminUi/apps/admin_ui/lib/core/modals/assign_quota_dialog.dart index 3430e77b88..67003454f5 100644 --- a/AdminUi/apps/admin_ui/lib/core/modals/assign_quota_dialog.dart +++ b/AdminUi/apps/admin_ui/lib/core/modals/assign_quota_dialog.dart @@ -85,7 +85,7 @@ class _AssignQuotaDialogState extends State<_AssignQuotaDialog> { shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(8), ), - title: const Center(child: Text('Assign Quota')), + title: const Text('Assign Quota', textAlign: TextAlign.center), content: SizedBox( width: 500, child: Column( diff --git a/AdminUi/apps/admin_ui/lib/core/modals/confirmation_dialog.dart b/AdminUi/apps/admin_ui/lib/core/modals/confirmation_dialog.dart index c0ec4518d5..c00d0f60e1 100644 --- a/AdminUi/apps/admin_ui/lib/core/modals/confirmation_dialog.dart +++ b/AdminUi/apps/admin_ui/lib/core/modals/confirmation_dialog.dart @@ -22,8 +22,14 @@ class _ConfirmationDialog extends StatelessWidget { @override Widget build(BuildContext context) { return AlertDialog( - title: Text(title), - content: Text(message), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(8), + ), + title: Text(title, textAlign: TextAlign.center), + content: Padding( + padding: const EdgeInsets.only(bottom: 32, top: 32), + child: Text(message), + ), actions: [ OutlinedButton( onPressed: () => Navigator.of(context).pop(false), @@ -31,7 +37,7 @@ class _ConfirmationDialog extends StatelessWidget { ), FilledButton( onPressed: () => Navigator.of(context).pop(true), - child: const Text('Confirm'), + child: const Text('Remove'), ), ], ); diff --git a/AdminUi/apps/admin_ui/lib/core/modals/settings_dialog.dart b/AdminUi/apps/admin_ui/lib/core/modals/settings_dialog.dart index 863f5fe865..e7231d6ffc 100644 --- a/AdminUi/apps/admin_ui/lib/core/modals/settings_dialog.dart +++ b/AdminUi/apps/admin_ui/lib/core/modals/settings_dialog.dart @@ -17,11 +17,15 @@ class _SettingsDialog extends StatelessWidget with WatchItMixin { final themeMode = watchValue((ThemeModeModel x) => x.themeMode); return AlertDialog( - title: const Text('Settings'), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(8), + ), + title: const Text('Settings', textAlign: TextAlign.center), content: Column( mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.start, children: [ + Gaps.h8, Text('Theme', style: Theme.of(context).textTheme.bodyLarge), Gaps.h4, SegmentedButton( @@ -34,6 +38,7 @@ class _SettingsDialog extends StatelessWidget with WatchItMixin { selected: {themeMode}, onSelectionChanged: (selected) => GetIt.I().setThemeMode(selected.first), ), + Gaps.h16 ], ), actions: [FilledButton(onPressed: () => context.pop(), child: const Text('Close'))], diff --git a/AdminUi/apps/admin_ui/lib/home/clients_overview/modals/change_client_secret_dialog.dart b/AdminUi/apps/admin_ui/lib/home/clients_overview/modals/change_client_secret_dialog.dart index cd5e4a2f9a..c56e407206 100644 --- a/AdminUi/apps/admin_ui/lib/home/clients_overview/modals/change_client_secret_dialog.dart +++ b/AdminUi/apps/admin_ui/lib/home/clients_overview/modals/change_client_secret_dialog.dart @@ -55,12 +55,16 @@ class _ChangeClientSecretDialogState extends State<_ChangeClientSecretDialog> { return PopScope( canPop: !_saving, child: AlertDialog( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(8), + ), title: const Text('Change Client Secret', textAlign: TextAlign.center), content: SizedBox( width: 500, child: Column( mainAxisSize: MainAxisSize.min, children: [ + Gaps.h32, TextField( controller: _newClientSecretController, focusNode: _focusNode, @@ -106,6 +110,7 @@ class _ChangeClientSecretDialogState extends State<_ChangeClientSecretDialog> { style: TextStyle(color: Theme.of(context).colorScheme.error), ), ), + Gaps.h32, ], ), ), diff --git a/AdminUi/apps/admin_ui/lib/home/identity_details/modals/change_tier.dart b/AdminUi/apps/admin_ui/lib/home/identity_details/modals/change_tier.dart index 12b3ea9981..ea47e68afe 100644 --- a/AdminUi/apps/admin_ui/lib/home/identity_details/modals/change_tier.dart +++ b/AdminUi/apps/admin_ui/lib/home/identity_details/modals/change_tier.dart @@ -52,17 +52,26 @@ class _ShowChangeTierDialogState extends State<_ShowChangeTierDialog> { return PopScope( canPop: !_saving, child: AlertDialog( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(8), + ), title: const Text('Change Tier', textAlign: TextAlign.center), - content: DropdownButtonFormField( - value: selectedTier, - decoration: const InputDecoration(border: OutlineInputBorder()), - onChanged: _saving ? null : (String? newValue) => setState(() => selectedTier = newValue!), - items: widget.availableTiers.where((tier) => tier.canBeManuallyAssigned).map((TierOverview tier) { - return DropdownMenuItem( - value: tier.id, - child: Text(tier.name), - ); - }).toList(), + content: SizedBox( + width: 500, + child: Padding( + padding: const EdgeInsets.only(bottom: 32, top: 32), + child: DropdownButtonFormField( + value: selectedTier, + decoration: const InputDecoration(border: OutlineInputBorder()), + onChanged: _saving ? null : (String? newValue) => setState(() => selectedTier = newValue!), + items: widget.availableTiers.where((tier) => tier.canBeManuallyAssigned).map((TierOverview tier) { + return DropdownMenuItem( + value: tier.id, + child: Text(tier.name), + ); + }).toList(), + ), + ), ), actions: [ OutlinedButton( diff --git a/AdminUi/apps/admin_ui/lib/home/tiers_overview/modals/show_create_tier_dialog.dart b/AdminUi/apps/admin_ui/lib/home/tiers_overview/modals/show_create_tier_dialog.dart index 40f0131032..49dcca9019 100644 --- a/AdminUi/apps/admin_ui/lib/home/tiers_overview/modals/show_create_tier_dialog.dart +++ b/AdminUi/apps/admin_ui/lib/home/tiers_overview/modals/show_create_tier_dialog.dart @@ -47,12 +47,7 @@ class _CreateTierDialogState extends State<_CreateTierDialog> { shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(8), ), - title: const Center( - child: Padding( - padding: EdgeInsets.all(16), - child: Text('Create Tier'), - ), - ), + title: const Text('Create Tier', textAlign: TextAlign.center), content: _isLoading ? const Padding( padding: EdgeInsets.all(16), @@ -63,7 +58,7 @@ class _CreateTierDialogState extends State<_CreateTierDialog> { child: Column( mainAxisSize: MainAxisSize.min, children: [ - Gaps.h16, + Gaps.h32, TextField( controller: _tierNameController, focusNode: _focusNode, From 53ec912c3a97fc5d0716a05889a347a6a16e3fc4 Mon Sep 17 00:00:00 2001 From: Vladimir Vuckovic Date: Wed, 3 Jul 2024 14:52:04 +0200 Subject: [PATCH 06/13] fix: add trailing comma --- AdminUi/apps/admin_ui/lib/core/modals/settings_dialog.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AdminUi/apps/admin_ui/lib/core/modals/settings_dialog.dart b/AdminUi/apps/admin_ui/lib/core/modals/settings_dialog.dart index e7231d6ffc..e18e015d2e 100644 --- a/AdminUi/apps/admin_ui/lib/core/modals/settings_dialog.dart +++ b/AdminUi/apps/admin_ui/lib/core/modals/settings_dialog.dart @@ -38,7 +38,7 @@ class _SettingsDialog extends StatelessWidget with WatchItMixin { selected: {themeMode}, onSelectionChanged: (selected) => GetIt.I().setThemeMode(selected.first), ), - Gaps.h16 + Gaps.h16, ], ), actions: [FilledButton(onPressed: () => context.pop(), child: const Text('Close'))], From 738c96942832965e2bfeedf4808d1402d5d754ff Mon Sep 17 00:00:00 2001 From: Vladimir Vuckovic Date: Tue, 9 Jul 2024 08:31:29 +0200 Subject: [PATCH 07/13] chore: add required into the dialogs --- .../apps/admin_ui/lib/core/modals/assign_quota_dialog.dart | 7 +++++++ .../tiers_overview/modals/show_create_tier_dialog.dart | 7 +++++++ AdminUi/apps/admin_ui/lib/l10n/app_en.arb | 3 ++- 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/AdminUi/apps/admin_ui/lib/core/modals/assign_quota_dialog.dart b/AdminUi/apps/admin_ui/lib/core/modals/assign_quota_dialog.dart index d049ded077..1e0cebd2aa 100644 --- a/AdminUi/apps/admin_ui/lib/core/modals/assign_quota_dialog.dart +++ b/AdminUi/apps/admin_ui/lib/core/modals/assign_quota_dialog.dart @@ -90,7 +90,14 @@ class _AssignQuotaDialogState extends State<_AssignQuotaDialog> { width: 500, child: Column( mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, children: [ + Padding( + padding: const EdgeInsets.all(8), + child: Text( + '*${context.l10n.required}', + ), + ), Gaps.h32, DropdownButtonFormField( value: _selectedMetric, diff --git a/AdminUi/apps/admin_ui/lib/home/tiers_overview/modals/show_create_tier_dialog.dart b/AdminUi/apps/admin_ui/lib/home/tiers_overview/modals/show_create_tier_dialog.dart index 3edbd9923d..e277fdead5 100644 --- a/AdminUi/apps/admin_ui/lib/home/tiers_overview/modals/show_create_tier_dialog.dart +++ b/AdminUi/apps/admin_ui/lib/home/tiers_overview/modals/show_create_tier_dialog.dart @@ -57,7 +57,14 @@ class _CreateTierDialogState extends State<_CreateTierDialog> { width: 500, child: Column( mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, children: [ + Padding( + padding: const EdgeInsets.all(8), + child: Text( + '*${context.l10n.required}', + ), + ), Gaps.h32, TextField( controller: _tierNameController, diff --git a/AdminUi/apps/admin_ui/lib/l10n/app_en.arb b/AdminUi/apps/admin_ui/lib/l10n/app_en.arb index 64d9a05bd8..79e062166c 100644 --- a/AdminUi/apps/admin_ui/lib/l10n/app_en.arb +++ b/AdminUi/apps/admin_ui/lib/l10n/app_en.arb @@ -38,7 +38,8 @@ "period": "Period", "quotas": "Quotas", "retry": "Retry", - "create": "Create", + "required": "required", + "create": "Create", "save": "Save", "searchTiers": "Search Tiers", "settings": "Settings", From 514988feca000a0e8bf4333c85670efb8094f584 Mon Sep 17 00:00:00 2001 From: Vladimir Vuckovic Date: Tue, 9 Jul 2024 08:31:49 +0200 Subject: [PATCH 08/13] chore: swap the field places --- .../modals/create_client_dialog.dart | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/AdminUi/apps/admin_ui/lib/home/clients_overview/modals/create_client_dialog.dart b/AdminUi/apps/admin_ui/lib/home/clients_overview/modals/create_client_dialog.dart index a54c99f490..1809ace988 100644 --- a/AdminUi/apps/admin_ui/lib/home/clients_overview/modals/create_client_dialog.dart +++ b/AdminUi/apps/admin_ui/lib/home/clients_overview/modals/create_client_dialog.dart @@ -83,16 +83,6 @@ class _CreateClientDialogState extends State<_CreateClientDialog> { ), ), Gaps.h24, - TextField( - controller: _displayNameController, - readOnly: _saveSucceeded, - decoration: InputDecoration( - border: const OutlineInputBorder(), - labelText: context.l10n.displayName, - helperText: context.l10n.createClientDialog_displayName_message, - ), - ), - Gaps.h24, TextField( controller: _clientSecretController, readOnly: _saveSucceeded, @@ -129,6 +119,16 @@ class _CreateClientDialogState extends State<_CreateClientDialog> { ), ], Gaps.h24, + TextField( + controller: _displayNameController, + readOnly: _saveSucceeded, + decoration: InputDecoration( + border: const OutlineInputBorder(), + labelText: context.l10n.displayName, + helperText: context.l10n.createClientDialog_displayName_message, + ), + ), + Gaps.h24, TextField( controller: _maxIdentitiesController, readOnly: _saveSucceeded, From 0b183af1ddefff10e02507394d932eacbbfc7737 Mon Sep 17 00:00:00 2001 From: Vladimir Vuckovic Date: Wed, 10 Jul 2024 08:16:34 +0200 Subject: [PATCH 09/13] fix: remove duplicate create --- AdminUi/apps/admin_ui/lib/l10n/app_en.arb | 1 - 1 file changed, 1 deletion(-) diff --git a/AdminUi/apps/admin_ui/lib/l10n/app_en.arb b/AdminUi/apps/admin_ui/lib/l10n/app_en.arb index 79e062166c..fab0e2af82 100644 --- a/AdminUi/apps/admin_ui/lib/l10n/app_en.arb +++ b/AdminUi/apps/admin_ui/lib/l10n/app_en.arb @@ -39,7 +39,6 @@ "quotas": "Quotas", "retry": "Retry", "required": "required", - "create": "Create", "save": "Save", "searchTiers": "Search Tiers", "settings": "Settings", From d709b3e573ee0ed4bcf955decba18d143b428dfc Mon Sep 17 00:00:00 2001 From: Vladimir Vuckovic Date: Wed, 10 Jul 2024 08:39:35 +0200 Subject: [PATCH 10/13] refactor: code --- .../lib/core/modals/assign_quota_dialog.dart | 107 +++++------ .../lib/core/modals/confirmation_dialog.dart | 4 +- .../lib/core/modals/settings_dialog.dart | 44 ++--- .../modals/change_client_secret_dialog.dart | 97 +++++----- .../modals/create_client_dialog.dart | 180 +++++++++--------- .../identity_details/modals/change_tier.dart | 4 +- .../modals/show_create_tier_dialog.dart | 68 ++++--- 7 files changed, 244 insertions(+), 260 deletions(-) diff --git a/AdminUi/apps/admin_ui/lib/core/modals/assign_quota_dialog.dart b/AdminUi/apps/admin_ui/lib/core/modals/assign_quota_dialog.dart index 1e0cebd2aa..10f9547ee2 100644 --- a/AdminUi/apps/admin_ui/lib/core/modals/assign_quota_dialog.dart +++ b/AdminUi/apps/admin_ui/lib/core/modals/assign_quota_dialog.dart @@ -82,70 +82,65 @@ class _AssignQuotaDialogState extends State<_AssignQuotaDialog> { return PopScope( canPop: !_saving, child: AlertDialog( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(8), - ), + shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)), title: Text(context.l10n.addQuota, textAlign: TextAlign.center), content: SizedBox( width: 500, - child: Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Padding( - padding: const EdgeInsets.all(8), - child: Text( - '*${context.l10n.required}', - ), - ), - Gaps.h32, - DropdownButtonFormField( - value: _selectedMetric, - items: widget.availableMetrics.map((metric) => DropdownMenuItem(value: metric.key, child: Text(metric.displayName))).toList(), - onChanged: _saving ? null : (String? selected) => setState(() => _selectedMetric = selected), - decoration: InputDecoration( - border: const OutlineInputBorder(), - labelText: '${context.l10n.metric}*', + child: Padding( + padding: const EdgeInsets.only(bottom: 32), + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: const EdgeInsets.all(8), + child: Text('*${context.l10n.required}'), ), - ), - Gaps.h24, - TextField( - controller: _maxAmountController, - enabled: !_saving, - decoration: InputDecoration( - border: const OutlineInputBorder(), - labelText: '${context.l10n.maxAmount}*', - helperText: context.l10n.addQuotaDialog_maxAmount_message, + Gaps.h32, + DropdownButtonFormField( + value: _selectedMetric, + items: widget.availableMetrics.map((metric) => DropdownMenuItem(value: metric.key, child: Text(metric.displayName))).toList(), + onChanged: _saving ? null : (String? selected) => setState(() => _selectedMetric = selected), + decoration: InputDecoration( + border: const OutlineInputBorder(), + labelText: '${context.l10n.metric}*', + ), ), - inputFormatters: [FilteringTextInputFormatter.digitsOnly], - keyboardType: TextInputType.number, - ), - Gaps.h24, - DropdownButtonFormField( - value: _selectedPeriod, - items: [ - DropdownMenuItem(value: 'Hour', child: Text(context.l10n.hour)), - DropdownMenuItem(value: 'Day', child: Text(context.l10n.day)), - DropdownMenuItem(value: 'Week', child: Text(context.l10n.week)), - DropdownMenuItem(value: 'Month', child: Text(context.l10n.month)), - DropdownMenuItem(value: 'Year', child: Text(context.l10n.year)), - ], - onChanged: _saving ? null : (String? selected) => setState(() => _selectedPeriod = selected), - decoration: InputDecoration( - border: const OutlineInputBorder(), - labelText: '${context.l10n.period}*', + Gaps.h24, + TextField( + controller: _maxAmountController, + enabled: !_saving, + decoration: InputDecoration( + border: const OutlineInputBorder(), + labelText: '${context.l10n.maxAmount}*', + helperText: context.l10n.addQuotaDialog_maxAmount_message, + ), + inputFormatters: [FilteringTextInputFormatter.digitsOnly], + keyboardType: TextInputType.number, ), - ), - if (_errorMessage != null) - Padding( - padding: const EdgeInsets.only(top: 24), - child: Text( - _errorMessage!, - style: TextStyle(color: Theme.of(context).colorScheme.error), + Gaps.h24, + DropdownButtonFormField( + value: _selectedPeriod, + items: [ + DropdownMenuItem(value: 'Hour', child: Text(context.l10n.hour)), + DropdownMenuItem(value: 'Day', child: Text(context.l10n.day)), + DropdownMenuItem(value: 'Week', child: Text(context.l10n.week)), + DropdownMenuItem(value: 'Month', child: Text(context.l10n.month)), + DropdownMenuItem(value: 'Year', child: Text(context.l10n.year)), + ], + onChanged: _saving ? null : (String? selected) => setState(() => _selectedPeriod = selected), + decoration: InputDecoration( + border: const OutlineInputBorder(), + labelText: '${context.l10n.period}*', ), ), - Gaps.h32, - ], + if (_errorMessage != null) + Padding( + padding: const EdgeInsets.only(top: 24), + child: Text(_errorMessage!, style: TextStyle(color: Theme.of(context).colorScheme.error)), + ), + ], + ), ), ), actions: [ diff --git a/AdminUi/apps/admin_ui/lib/core/modals/confirmation_dialog.dart b/AdminUi/apps/admin_ui/lib/core/modals/confirmation_dialog.dart index a36354e7d6..197f28cade 100644 --- a/AdminUi/apps/admin_ui/lib/core/modals/confirmation_dialog.dart +++ b/AdminUi/apps/admin_ui/lib/core/modals/confirmation_dialog.dart @@ -24,9 +24,7 @@ class _ConfirmationDialog extends StatelessWidget { @override Widget build(BuildContext context) { return AlertDialog( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(8), - ), + shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)), title: Text(title, textAlign: TextAlign.center), content: Padding( padding: const EdgeInsets.only(bottom: 32, top: 32), diff --git a/AdminUi/apps/admin_ui/lib/core/modals/settings_dialog.dart b/AdminUi/apps/admin_ui/lib/core/modals/settings_dialog.dart index 956660b82d..bd64f802c6 100644 --- a/AdminUi/apps/admin_ui/lib/core/modals/settings_dialog.dart +++ b/AdminUi/apps/admin_ui/lib/core/modals/settings_dialog.dart @@ -18,29 +18,29 @@ class _SettingsDialog extends StatelessWidget with WatchItMixin { final themeMode = watchValue((ThemeModeModel x) => x.themeMode); return AlertDialog( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(8), - ), + shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)), title: Text(context.l10n.settings, textAlign: TextAlign.center), - content: Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Gaps.h8, - Text(context.l10n.theme, style: Theme.of(context).textTheme.bodyLarge), - Gaps.h4, - SegmentedButton( - showSelectedIcon: false, - segments: [ - ButtonSegment(value: ThemeMode.light, icon: const Icon(Icons.light_mode), label: Text(context.l10n.light)), - ButtonSegment(value: ThemeMode.system, icon: const Icon(Icons.settings), label: Text(context.l10n.system)), - ButtonSegment(value: ThemeMode.dark, icon: const Icon(Icons.dark_mode), label: Text(context.l10n.dark)), - ], - selected: {themeMode}, - onSelectionChanged: (selected) => GetIt.I().setThemeMode(selected.first), - ), - Gaps.h16, - ], + content: Padding( + padding: const EdgeInsets.only(bottom: 32), + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Gaps.h8, + Text(context.l10n.theme, style: Theme.of(context).textTheme.bodyLarge), + Gaps.h4, + SegmentedButton( + showSelectedIcon: false, + segments: [ + ButtonSegment(value: ThemeMode.light, icon: const Icon(Icons.light_mode), label: Text(context.l10n.light)), + ButtonSegment(value: ThemeMode.system, icon: const Icon(Icons.settings), label: Text(context.l10n.system)), + ButtonSegment(value: ThemeMode.dark, icon: const Icon(Icons.dark_mode), label: Text(context.l10n.dark)), + ], + selected: {themeMode}, + onSelectionChanged: (selected) => GetIt.I().setThemeMode(selected.first), + ), + ], + ), ), actions: [FilledButton(onPressed: () => context.pop(), child: Text(context.l10n.close))], ); diff --git a/AdminUi/apps/admin_ui/lib/home/clients_overview/modals/change_client_secret_dialog.dart b/AdminUi/apps/admin_ui/lib/home/clients_overview/modals/change_client_secret_dialog.dart index 9a7e85c237..3eccc6cb31 100644 --- a/AdminUi/apps/admin_ui/lib/home/clients_overview/modals/change_client_secret_dialog.dart +++ b/AdminUi/apps/admin_ui/lib/home/clients_overview/modals/change_client_secret_dialog.dart @@ -55,63 +55,62 @@ class _ChangeClientSecretDialogState extends State<_ChangeClientSecretDialog> { return PopScope( canPop: !_saving, child: AlertDialog( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(8), - ), + shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)), title: Text(context.l10n.changeClientSecret, textAlign: TextAlign.center), content: SizedBox( width: 500, - child: Column( - mainAxisSize: MainAxisSize.min, - children: [ - Gaps.h32, - TextField( - controller: _newClientSecretController, - focusNode: _focusNode, - readOnly: _saveSucceeded, - obscureText: _isClientSecretVisible, - decoration: InputDecoration( - border: const OutlineInputBorder(), - labelText: context.l10n.clientSecret, - helperText: context.l10n.clientSecret_message, - suffixIcon: Padding( - padding: const EdgeInsets.symmetric(horizontal: 8), - child: Row( - mainAxisSize: MainAxisSize.min, - children: [ - IconButton( - icon: Icon(_isClientSecretVisible ? Icons.visibility_off : Icons.visibility), - onPressed: () => setState(() => _isClientSecretVisible = !_isClientSecretVisible), - ), - Gaps.w4, - CopyToClipboardButton( - tooltip: context.l10n.changeClientSecretDialog_copyToClipboard, - clipboardText: _newClientSecretController.text, - successMessage: context.l10n.clientSecret_copiedToClipboard, - ), - ], + child: Padding( + padding: const EdgeInsets.only(bottom: 32, top: 32), + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + TextField( + controller: _newClientSecretController, + focusNode: _focusNode, + readOnly: _saveSucceeded, + obscureText: _isClientSecretVisible, + decoration: InputDecoration( + border: const OutlineInputBorder(), + labelText: context.l10n.clientSecret, + helperText: context.l10n.clientSecret_message, + suffixIcon: Padding( + padding: const EdgeInsets.symmetric(horizontal: 8), + child: Row( + mainAxisSize: MainAxisSize.min, + children: [ + IconButton( + icon: Icon(_isClientSecretVisible ? Icons.visibility_off : Icons.visibility), + onPressed: () => setState(() => _isClientSecretVisible = !_isClientSecretVisible), + ), + Gaps.w4, + CopyToClipboardButton( + tooltip: context.l10n.changeClientSecretDialog_copyToClipboard, + clipboardText: _newClientSecretController.text, + successMessage: context.l10n.clientSecret_copiedToClipboard, + ), + ], + ), ), ), ), - ), - if (_saveSucceeded) - Padding( - padding: const EdgeInsets.symmetric(vertical: 8), - child: Text( - context.l10n.clientSecret_save_message, - style: TextStyle(color: Theme.of(context).colorScheme.primary), + if (_saveSucceeded) + Padding( + padding: const EdgeInsets.symmetric(vertical: 8), + child: Text( + context.l10n.clientSecret_save_message, + style: TextStyle(color: Theme.of(context).colorScheme.primary), + ), ), - ), - if (_errorMessage != null) - Padding( - padding: const EdgeInsets.symmetric(vertical: 8), - child: Text( - _errorMessage!, - style: TextStyle(color: Theme.of(context).colorScheme.error), + if (_errorMessage != null) + Padding( + padding: const EdgeInsets.symmetric(vertical: 8), + child: Text( + _errorMessage!, + style: TextStyle(color: Theme.of(context).colorScheme.error), + ), ), - ), - Gaps.h32, - ], + ], + ), ), ), actions: [ diff --git a/AdminUi/apps/admin_ui/lib/home/clients_overview/modals/create_client_dialog.dart b/AdminUi/apps/admin_ui/lib/home/clients_overview/modals/create_client_dialog.dart index 1809ace988..bfca9e6f6f 100644 --- a/AdminUi/apps/admin_ui/lib/home/clients_overview/modals/create_client_dialog.dart +++ b/AdminUi/apps/admin_ui/lib/home/clients_overview/modals/create_client_dialog.dart @@ -63,109 +63,105 @@ class _CreateClientDialogState extends State<_CreateClientDialog> { return PopScope( canPop: !_saving, child: AlertDialog( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(8), - ), + shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)), title: Text(context.l10n.createClientDialog_title, textAlign: TextAlign.center), content: SizedBox( width: 500, - child: Column( - mainAxisSize: MainAxisSize.min, - children: [ - Gaps.h32, - TextField( - controller: _clientIdController, - readOnly: _saveSucceeded, - decoration: InputDecoration( - border: const OutlineInputBorder(), - labelText: context.l10n.clientID, - helperText: context.l10n.createClientDialog_clientID_message, + child: Padding( + padding: const EdgeInsets.only(bottom: 32, top: 32), + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + TextField( + controller: _clientIdController, + readOnly: _saveSucceeded, + decoration: InputDecoration( + border: const OutlineInputBorder(), + labelText: context.l10n.clientID, + helperText: context.l10n.createClientDialog_clientID_message, + ), ), - ), - Gaps.h24, - TextField( - controller: _clientSecretController, - readOnly: _saveSucceeded, - obscureText: _isClientSecretVisible, - decoration: InputDecoration( - border: const OutlineInputBorder(), - labelText: context.l10n.clientSecret, - helperText: context.l10n.clientSecret_message, - suffixIcon: Padding( - padding: const EdgeInsets.symmetric(horizontal: 8), - child: Row( - mainAxisSize: MainAxisSize.min, - children: [ - IconButton( - icon: Icon(_isClientSecretVisible ? Icons.visibility_off : Icons.visibility), - onPressed: () => setState(() => _isClientSecretVisible = !_isClientSecretVisible), - ), - Gaps.w4, - CopyToClipboardButton( - tooltip: context.l10n.createClientDialog_clientSecret_copyToClipboard, - clipboardText: _clientSecretController.text, - successMessage: context.l10n.clientSecret_copiedToClipboard, - ), - ], + Gaps.h24, + TextField( + controller: _clientSecretController, + readOnly: _saveSucceeded, + obscureText: _isClientSecretVisible, + decoration: InputDecoration( + border: const OutlineInputBorder(), + labelText: context.l10n.clientSecret, + helperText: context.l10n.clientSecret_message, + suffixIcon: Padding( + padding: const EdgeInsets.symmetric(horizontal: 8), + child: Row( + mainAxisSize: MainAxisSize.min, + children: [ + IconButton( + icon: Icon(_isClientSecretVisible ? Icons.visibility_off : Icons.visibility), + onPressed: () => setState(() => _isClientSecretVisible = !_isClientSecretVisible), + ), + Gaps.w4, + CopyToClipboardButton( + tooltip: context.l10n.createClientDialog_clientSecret_copyToClipboard, + clipboardText: _clientSecretController.text, + successMessage: context.l10n.clientSecret_copiedToClipboard, + ), + ], + ), ), ), ), - ), - if (_saveSucceeded) ...[ - Gaps.h16, - Text( - context.l10n.clientSecret_save_message, - style: TextStyle(color: Theme.of(context).colorScheme.primary), - ), - ], - Gaps.h24, - TextField( - controller: _displayNameController, - readOnly: _saveSucceeded, - decoration: InputDecoration( - border: const OutlineInputBorder(), - labelText: context.l10n.displayName, - helperText: context.l10n.createClientDialog_displayName_message, - ), - ), - Gaps.h24, - TextField( - controller: _maxIdentitiesController, - readOnly: _saveSucceeded, - decoration: InputDecoration( - border: const OutlineInputBorder(), - labelText: context.l10n.maxIdentities, - helperText: '${context.l10n.createClientDialog_maxIdentities_message}' - '\n${context.l10n.createClientDialog_maxIdentities_noLimit_message}', + if (_saveSucceeded) ...[ + Gaps.h16, + Text( + context.l10n.clientSecret_save_message, + style: TextStyle(color: Theme.of(context).colorScheme.primary), + ), + ], + Gaps.h24, + TextField( + controller: _displayNameController, + readOnly: _saveSucceeded, + decoration: InputDecoration( + border: const OutlineInputBorder(), + labelText: context.l10n.displayName, + helperText: context.l10n.createClientDialog_displayName_message, + ), ), - inputFormatters: [FilteringTextInputFormatter.digitsOnly], - keyboardType: TextInputType.number, - ), - Gaps.h24, - DropdownButtonFormField( - isExpanded: true, - decoration: InputDecoration( - border: const OutlineInputBorder(), - labelText: '${context.l10n.defaultTier}*', + Gaps.h24, + TextField( + controller: _maxIdentitiesController, + readOnly: _saveSucceeded, + decoration: InputDecoration( + border: const OutlineInputBorder(), + labelText: context.l10n.maxIdentities, + helperText: '${context.l10n.createClientDialog_maxIdentities_message}' + '\n${context.l10n.createClientDialog_maxIdentities_noLimit_message}', + ), + inputFormatters: [FilteringTextInputFormatter.digitsOnly], + keyboardType: TextInputType.number, ), - value: _chosenDefaultTier, - onChanged: _saveSucceeded ? null : (tier) => setState(() => _chosenDefaultTier = tier), - items: widget.defaultTiers.map((tier) { - return DropdownMenuItem( - value: tier.id, - child: Text(tier.name), - ); - }).toList(), - ), - if (_errorMessage != null) ...[ - Gaps.h16, - Text( - _errorMessage!, - style: TextStyle(color: Theme.of(context).colorScheme.error), + Gaps.h24, + DropdownButtonFormField( + isExpanded: true, + decoration: InputDecoration( + border: const OutlineInputBorder(), + labelText: '${context.l10n.defaultTier}*', + ), + value: _chosenDefaultTier, + onChanged: _saveSucceeded ? null : (tier) => setState(() => _chosenDefaultTier = tier), + items: widget.defaultTiers.map((tier) { + return DropdownMenuItem( + value: tier.id, + child: Text(tier.name), + ); + }).toList(), ), + if (_errorMessage != null) ...[ + Gaps.h16, + Text(_errorMessage!, style: TextStyle(color: Theme.of(context).colorScheme.error)), + ], ], - Gaps.h32, - ], + ), ), ), actions: [ diff --git a/AdminUi/apps/admin_ui/lib/home/identity_details/modals/change_tier.dart b/AdminUi/apps/admin_ui/lib/home/identity_details/modals/change_tier.dart index 0afc8330f7..11504d19c6 100644 --- a/AdminUi/apps/admin_ui/lib/home/identity_details/modals/change_tier.dart +++ b/AdminUi/apps/admin_ui/lib/home/identity_details/modals/change_tier.dart @@ -52,9 +52,7 @@ class _ShowChangeTierDialogState extends State<_ShowChangeTierDialog> { return PopScope( canPop: !_saving, child: AlertDialog( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(8), - ), + shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)), title: Text(context.l10n.changeTier, textAlign: TextAlign.center), content: SizedBox( width: 500, diff --git a/AdminUi/apps/admin_ui/lib/home/tiers_overview/modals/show_create_tier_dialog.dart b/AdminUi/apps/admin_ui/lib/home/tiers_overview/modals/show_create_tier_dialog.dart index e277fdead5..dd34c50915 100644 --- a/AdminUi/apps/admin_ui/lib/home/tiers_overview/modals/show_create_tier_dialog.dart +++ b/AdminUi/apps/admin_ui/lib/home/tiers_overview/modals/show_create_tier_dialog.dart @@ -44,9 +44,7 @@ class _CreateTierDialogState extends State<_CreateTierDialog> { return PopScope( canPop: !_isLoading, child: AlertDialog( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(8), - ), + shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)), title: Text(context.l10n.createTierDialog_title, textAlign: TextAlign.center), content: _isLoading ? const Padding( @@ -55,40 +53,40 @@ class _CreateTierDialogState extends State<_CreateTierDialog> { ) : SizedBox( width: 500, - child: Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Padding( - padding: const EdgeInsets.all(8), - child: Text( - '*${context.l10n.required}', + child: Padding( + padding: const EdgeInsets.only(bottom: 32), + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: const EdgeInsets.all(8), + child: Text('*${context.l10n.required}'), ), - ), - Gaps.h32, - TextField( - controller: _tierNameController, - focusNode: _focusNode, - onChanged: (_) { - if (_errorMessage == null) return; - setState(() => _errorMessage = null); - }, - onSubmitted: _onSubmitted, - decoration: InputDecoration( - border: const OutlineInputBorder(), - labelText: context.l10n.name, - helperText: context.l10n.createTierDialog_formMessage, - error: _errorMessage != null - ? Text( - _errorMessage!, - style: Theme.of(context).textTheme.labelSmall!.copyWith(color: Theme.of(context).colorScheme.error), - textAlign: TextAlign.left, - ) - : null, + Gaps.h32, + TextField( + controller: _tierNameController, + focusNode: _focusNode, + onChanged: (_) { + if (_errorMessage == null) return; + setState(() => _errorMessage = null); + }, + onSubmitted: _onSubmitted, + decoration: InputDecoration( + border: const OutlineInputBorder(), + labelText: context.l10n.name, + helperText: context.l10n.createTierDialog_formMessage, + error: _errorMessage != null + ? Text( + _errorMessage!, + style: Theme.of(context).textTheme.labelSmall!.copyWith(color: Theme.of(context).colorScheme.error), + textAlign: TextAlign.left, + ) + : null, + ), ), - ), - Gaps.h32, - ], + ], + ), ), ), actions: [ From 1b73b99c38bbc32d7b800417ec2495f54130b19d Mon Sep 17 00:00:00 2001 From: Vladimir Vuckovic Date: Wed, 10 Jul 2024 09:29:34 +0200 Subject: [PATCH 11/13] fix: use contentPadding to wrap content instead of Padding --- .../lib/core/modals/assign_quota_dialog.dart | 100 +++++----- .../lib/core/modals/confirmation_dialog.dart | 14 +- .../lib/core/modals/settings_dialog.dart | 39 ++-- .../lib/core/widgets/quotas_button_group.dart | 1 + .../clients_overview/clients_overview.dart | 1 + .../modals/change_client_secret_dialog.dart | 92 +++++----- .../modals/create_client_dialog.dart | 172 +++++++++--------- .../identity_details/modals/change_tier.dart | 24 ++- .../modals/show_create_tier_dialog.dart | 64 ++++--- 9 files changed, 248 insertions(+), 259 deletions(-) diff --git a/AdminUi/apps/admin_ui/lib/core/modals/assign_quota_dialog.dart b/AdminUi/apps/admin_ui/lib/core/modals/assign_quota_dialog.dart index 10f9547ee2..e99fae965c 100644 --- a/AdminUi/apps/admin_ui/lib/core/modals/assign_quota_dialog.dart +++ b/AdminUi/apps/admin_ui/lib/core/modals/assign_quota_dialog.dart @@ -84,63 +84,61 @@ class _AssignQuotaDialogState extends State<_AssignQuotaDialog> { child: AlertDialog( shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)), title: Text(context.l10n.addQuota, textAlign: TextAlign.center), + contentPadding: const EdgeInsets.only(left: 24, right: 24, top: 20, bottom: 32), content: SizedBox( width: 500, - child: Padding( - padding: const EdgeInsets.only(bottom: 32), - child: Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Padding( - padding: const EdgeInsets.all(8), - child: Text('*${context.l10n.required}'), + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: const EdgeInsets.all(8), + child: Text('*${context.l10n.required}'), + ), + Gaps.h32, + DropdownButtonFormField( + value: _selectedMetric, + items: widget.availableMetrics.map((metric) => DropdownMenuItem(value: metric.key, child: Text(metric.displayName))).toList(), + onChanged: _saving ? null : (String? selected) => setState(() => _selectedMetric = selected), + decoration: InputDecoration( + border: const OutlineInputBorder(), + labelText: '${context.l10n.metric}*', ), - Gaps.h32, - DropdownButtonFormField( - value: _selectedMetric, - items: widget.availableMetrics.map((metric) => DropdownMenuItem(value: metric.key, child: Text(metric.displayName))).toList(), - onChanged: _saving ? null : (String? selected) => setState(() => _selectedMetric = selected), - decoration: InputDecoration( - border: const OutlineInputBorder(), - labelText: '${context.l10n.metric}*', - ), + ), + Gaps.h24, + TextField( + controller: _maxAmountController, + enabled: !_saving, + decoration: InputDecoration( + border: const OutlineInputBorder(), + labelText: '${context.l10n.maxAmount}*', + helperText: context.l10n.addQuotaDialog_maxAmount_message, ), - Gaps.h24, - TextField( - controller: _maxAmountController, - enabled: !_saving, - decoration: InputDecoration( - border: const OutlineInputBorder(), - labelText: '${context.l10n.maxAmount}*', - helperText: context.l10n.addQuotaDialog_maxAmount_message, - ), - inputFormatters: [FilteringTextInputFormatter.digitsOnly], - keyboardType: TextInputType.number, + inputFormatters: [FilteringTextInputFormatter.digitsOnly], + keyboardType: TextInputType.number, + ), + Gaps.h24, + DropdownButtonFormField( + value: _selectedPeriod, + items: [ + DropdownMenuItem(value: 'Hour', child: Text(context.l10n.hour)), + DropdownMenuItem(value: 'Day', child: Text(context.l10n.day)), + DropdownMenuItem(value: 'Week', child: Text(context.l10n.week)), + DropdownMenuItem(value: 'Month', child: Text(context.l10n.month)), + DropdownMenuItem(value: 'Year', child: Text(context.l10n.year)), + ], + onChanged: _saving ? null : (String? selected) => setState(() => _selectedPeriod = selected), + decoration: InputDecoration( + border: const OutlineInputBorder(), + labelText: '${context.l10n.period}*', ), - Gaps.h24, - DropdownButtonFormField( - value: _selectedPeriod, - items: [ - DropdownMenuItem(value: 'Hour', child: Text(context.l10n.hour)), - DropdownMenuItem(value: 'Day', child: Text(context.l10n.day)), - DropdownMenuItem(value: 'Week', child: Text(context.l10n.week)), - DropdownMenuItem(value: 'Month', child: Text(context.l10n.month)), - DropdownMenuItem(value: 'Year', child: Text(context.l10n.year)), - ], - onChanged: _saving ? null : (String? selected) => setState(() => _selectedPeriod = selected), - decoration: InputDecoration( - border: const OutlineInputBorder(), - labelText: '${context.l10n.period}*', - ), + ), + if (_errorMessage != null) + Padding( + padding: const EdgeInsets.only(top: 24), + child: Text(_errorMessage!, style: TextStyle(color: Theme.of(context).colorScheme.error)), ), - if (_errorMessage != null) - Padding( - padding: const EdgeInsets.only(top: 24), - child: Text(_errorMessage!, style: TextStyle(color: Theme.of(context).colorScheme.error)), - ), - ], - ), + ], ), ), actions: [ diff --git a/AdminUi/apps/admin_ui/lib/core/modals/confirmation_dialog.dart b/AdminUi/apps/admin_ui/lib/core/modals/confirmation_dialog.dart index 197f28cade..eb3bd6d138 100644 --- a/AdminUi/apps/admin_ui/lib/core/modals/confirmation_dialog.dart +++ b/AdminUi/apps/admin_ui/lib/core/modals/confirmation_dialog.dart @@ -6,10 +6,11 @@ Future showConfirmationDialog({ required BuildContext context, required String title, required String message, + required String actionText, }) async { final result = await showDialog( context: context, - builder: (BuildContext context) => _ConfirmationDialog(title: title, message: message), + builder: (BuildContext context) => _ConfirmationDialog(title: title, message: message, actionText: actionText), ); return result ?? false; @@ -18,18 +19,17 @@ Future showConfirmationDialog({ class _ConfirmationDialog extends StatelessWidget { final String title; final String message; + final String actionText; - const _ConfirmationDialog({required this.title, required this.message}); + const _ConfirmationDialog({required this.title, required this.message, required this.actionText}); @override Widget build(BuildContext context) { return AlertDialog( shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)), title: Text(title, textAlign: TextAlign.center), - content: Padding( - padding: const EdgeInsets.only(bottom: 32, top: 32), - child: Text(message), - ), + contentPadding: const EdgeInsets.only(left: 24, right: 24, top: 20, bottom: 32), + content: Text(message), actions: [ OutlinedButton( onPressed: () => Navigator.of(context).pop(false), @@ -37,7 +37,7 @@ class _ConfirmationDialog extends StatelessWidget { ), FilledButton( onPressed: () => Navigator.of(context).pop(true), - child: const Text('Remove'), + child: Text(actionText), ), ], ); diff --git a/AdminUi/apps/admin_ui/lib/core/modals/settings_dialog.dart b/AdminUi/apps/admin_ui/lib/core/modals/settings_dialog.dart index bd64f802c6..c1592f63d3 100644 --- a/AdminUi/apps/admin_ui/lib/core/modals/settings_dialog.dart +++ b/AdminUi/apps/admin_ui/lib/core/modals/settings_dialog.dart @@ -20,27 +20,24 @@ class _SettingsDialog extends StatelessWidget with WatchItMixin { return AlertDialog( shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)), title: Text(context.l10n.settings, textAlign: TextAlign.center), - content: Padding( - padding: const EdgeInsets.only(bottom: 32), - child: Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Gaps.h8, - Text(context.l10n.theme, style: Theme.of(context).textTheme.bodyLarge), - Gaps.h4, - SegmentedButton( - showSelectedIcon: false, - segments: [ - ButtonSegment(value: ThemeMode.light, icon: const Icon(Icons.light_mode), label: Text(context.l10n.light)), - ButtonSegment(value: ThemeMode.system, icon: const Icon(Icons.settings), label: Text(context.l10n.system)), - ButtonSegment(value: ThemeMode.dark, icon: const Icon(Icons.dark_mode), label: Text(context.l10n.dark)), - ], - selected: {themeMode}, - onSelectionChanged: (selected) => GetIt.I().setThemeMode(selected.first), - ), - ], - ), + contentPadding: const EdgeInsets.only(left: 24, right: 24, top: 20, bottom: 32), + content: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text(context.l10n.theme, style: Theme.of(context).textTheme.bodyLarge), + Gaps.h4, + SegmentedButton( + showSelectedIcon: false, + segments: [ + ButtonSegment(value: ThemeMode.light, icon: const Icon(Icons.light_mode), label: Text(context.l10n.light)), + ButtonSegment(value: ThemeMode.system, icon: const Icon(Icons.settings), label: Text(context.l10n.system)), + ButtonSegment(value: ThemeMode.dark, icon: const Icon(Icons.dark_mode), label: Text(context.l10n.dark)), + ], + selected: {themeMode}, + onSelectionChanged: (selected) => GetIt.I().setThemeMode(selected.first), + ), + ], ), actions: [FilledButton(onPressed: () => context.pop(), child: Text(context.l10n.close))], ); diff --git a/AdminUi/apps/admin_ui/lib/core/widgets/quotas_button_group.dart b/AdminUi/apps/admin_ui/lib/core/widgets/quotas_button_group.dart index 0d35220db1..fb2438276b 100644 --- a/AdminUi/apps/admin_ui/lib/core/widgets/quotas_button_group.dart +++ b/AdminUi/apps/admin_ui/lib/core/widgets/quotas_button_group.dart @@ -66,6 +66,7 @@ class _QuotasButtonGroupState extends State { title: context.l10n.quotaButtonGroup_removeQuotas_title, message: '${context.l10n.quotaButtonGroup_deletionMessage} ${widget.identityAddress != null ? '${context.l10n.quotaButtonGroup_theIdentity} "${widget.identityAddress}"' : '${context.l10n.quotaButtonGroup_theTier} "${widget.tierId}"'}?', + actionText: context.l10n.remove, ); if (!confirmed) return; diff --git a/AdminUi/apps/admin_ui/lib/home/clients_overview/clients_overview.dart b/AdminUi/apps/admin_ui/lib/home/clients_overview/clients_overview.dart index b345ddcd52..6103a578a9 100644 --- a/AdminUi/apps/admin_ui/lib/home/clients_overview/clients_overview.dart +++ b/AdminUi/apps/admin_ui/lib/home/clients_overview/clients_overview.dart @@ -155,6 +155,7 @@ class _ClientsOverviewState extends State { context: context, title: context.l10n.clientsOverview_removeSelectedClients_title, message: context.l10n.clientsOverview_removeSelectedClients_message, + actionText: context.l10n.remove, ); if (!confirmed) return; diff --git a/AdminUi/apps/admin_ui/lib/home/clients_overview/modals/change_client_secret_dialog.dart b/AdminUi/apps/admin_ui/lib/home/clients_overview/modals/change_client_secret_dialog.dart index 3eccc6cb31..bf40c1ebf0 100644 --- a/AdminUi/apps/admin_ui/lib/home/clients_overview/modals/change_client_secret_dialog.dart +++ b/AdminUi/apps/admin_ui/lib/home/clients_overview/modals/change_client_secret_dialog.dart @@ -57,60 +57,58 @@ class _ChangeClientSecretDialogState extends State<_ChangeClientSecretDialog> { child: AlertDialog( shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)), title: Text(context.l10n.changeClientSecret, textAlign: TextAlign.center), + contentPadding: const EdgeInsets.only(left: 24, right: 24, top: 32, bottom: 32), content: SizedBox( width: 500, - child: Padding( - padding: const EdgeInsets.only(bottom: 32, top: 32), - child: Column( - mainAxisSize: MainAxisSize.min, - children: [ - TextField( - controller: _newClientSecretController, - focusNode: _focusNode, - readOnly: _saveSucceeded, - obscureText: _isClientSecretVisible, - decoration: InputDecoration( - border: const OutlineInputBorder(), - labelText: context.l10n.clientSecret, - helperText: context.l10n.clientSecret_message, - suffixIcon: Padding( - padding: const EdgeInsets.symmetric(horizontal: 8), - child: Row( - mainAxisSize: MainAxisSize.min, - children: [ - IconButton( - icon: Icon(_isClientSecretVisible ? Icons.visibility_off : Icons.visibility), - onPressed: () => setState(() => _isClientSecretVisible = !_isClientSecretVisible), - ), - Gaps.w4, - CopyToClipboardButton( - tooltip: context.l10n.changeClientSecretDialog_copyToClipboard, - clipboardText: _newClientSecretController.text, - successMessage: context.l10n.clientSecret_copiedToClipboard, - ), - ], - ), + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + TextField( + controller: _newClientSecretController, + focusNode: _focusNode, + readOnly: _saveSucceeded, + obscureText: _isClientSecretVisible, + decoration: InputDecoration( + border: const OutlineInputBorder(), + labelText: context.l10n.clientSecret, + helperText: context.l10n.clientSecret_message, + suffixIcon: Padding( + padding: const EdgeInsets.symmetric(horizontal: 8), + child: Row( + mainAxisSize: MainAxisSize.min, + children: [ + IconButton( + icon: Icon(_isClientSecretVisible ? Icons.visibility_off : Icons.visibility), + onPressed: () => setState(() => _isClientSecretVisible = !_isClientSecretVisible), + ), + Gaps.w4, + CopyToClipboardButton( + tooltip: context.l10n.changeClientSecretDialog_copyToClipboard, + clipboardText: _newClientSecretController.text, + successMessage: context.l10n.clientSecret_copiedToClipboard, + ), + ], ), ), ), - if (_saveSucceeded) - Padding( - padding: const EdgeInsets.symmetric(vertical: 8), - child: Text( - context.l10n.clientSecret_save_message, - style: TextStyle(color: Theme.of(context).colorScheme.primary), - ), + ), + if (_saveSucceeded) + Padding( + padding: const EdgeInsets.symmetric(vertical: 8), + child: Text( + context.l10n.clientSecret_save_message, + style: TextStyle(color: Theme.of(context).colorScheme.primary), ), - if (_errorMessage != null) - Padding( - padding: const EdgeInsets.symmetric(vertical: 8), - child: Text( - _errorMessage!, - style: TextStyle(color: Theme.of(context).colorScheme.error), - ), + ), + if (_errorMessage != null) + Padding( + padding: const EdgeInsets.symmetric(vertical: 8), + child: Text( + _errorMessage!, + style: TextStyle(color: Theme.of(context).colorScheme.error), ), - ], - ), + ), + ], ), ), actions: [ diff --git a/AdminUi/apps/admin_ui/lib/home/clients_overview/modals/create_client_dialog.dart b/AdminUi/apps/admin_ui/lib/home/clients_overview/modals/create_client_dialog.dart index bfca9e6f6f..efe3f74e30 100644 --- a/AdminUi/apps/admin_ui/lib/home/clients_overview/modals/create_client_dialog.dart +++ b/AdminUi/apps/admin_ui/lib/home/clients_overview/modals/create_client_dialog.dart @@ -65,103 +65,101 @@ class _CreateClientDialogState extends State<_CreateClientDialog> { child: AlertDialog( shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)), title: Text(context.l10n.createClientDialog_title, textAlign: TextAlign.center), + contentPadding: const EdgeInsets.only(left: 24, right: 24, top: 32, bottom: 32), content: SizedBox( width: 500, - child: Padding( - padding: const EdgeInsets.only(bottom: 32, top: 32), - child: Column( - mainAxisSize: MainAxisSize.min, - children: [ - TextField( - controller: _clientIdController, - readOnly: _saveSucceeded, - decoration: InputDecoration( - border: const OutlineInputBorder(), - labelText: context.l10n.clientID, - helperText: context.l10n.createClientDialog_clientID_message, - ), + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + TextField( + controller: _clientIdController, + readOnly: _saveSucceeded, + decoration: InputDecoration( + border: const OutlineInputBorder(), + labelText: context.l10n.clientID, + helperText: context.l10n.createClientDialog_clientID_message, ), - Gaps.h24, - TextField( - controller: _clientSecretController, - readOnly: _saveSucceeded, - obscureText: _isClientSecretVisible, - decoration: InputDecoration( - border: const OutlineInputBorder(), - labelText: context.l10n.clientSecret, - helperText: context.l10n.clientSecret_message, - suffixIcon: Padding( - padding: const EdgeInsets.symmetric(horizontal: 8), - child: Row( - mainAxisSize: MainAxisSize.min, - children: [ - IconButton( - icon: Icon(_isClientSecretVisible ? Icons.visibility_off : Icons.visibility), - onPressed: () => setState(() => _isClientSecretVisible = !_isClientSecretVisible), - ), - Gaps.w4, - CopyToClipboardButton( - tooltip: context.l10n.createClientDialog_clientSecret_copyToClipboard, - clipboardText: _clientSecretController.text, - successMessage: context.l10n.clientSecret_copiedToClipboard, - ), - ], - ), + ), + Gaps.h24, + TextField( + controller: _clientSecretController, + readOnly: _saveSucceeded, + obscureText: _isClientSecretVisible, + decoration: InputDecoration( + border: const OutlineInputBorder(), + labelText: context.l10n.clientSecret, + helperText: context.l10n.clientSecret_message, + suffixIcon: Padding( + padding: const EdgeInsets.symmetric(horizontal: 8), + child: Row( + mainAxisSize: MainAxisSize.min, + children: [ + IconButton( + icon: Icon(_isClientSecretVisible ? Icons.visibility_off : Icons.visibility), + onPressed: () => setState(() => _isClientSecretVisible = !_isClientSecretVisible), + ), + Gaps.w4, + CopyToClipboardButton( + tooltip: context.l10n.createClientDialog_clientSecret_copyToClipboard, + clipboardText: _clientSecretController.text, + successMessage: context.l10n.clientSecret_copiedToClipboard, + ), + ], ), ), ), - if (_saveSucceeded) ...[ - Gaps.h16, - Text( - context.l10n.clientSecret_save_message, - style: TextStyle(color: Theme.of(context).colorScheme.primary), - ), - ], - Gaps.h24, - TextField( - controller: _displayNameController, - readOnly: _saveSucceeded, - decoration: InputDecoration( - border: const OutlineInputBorder(), - labelText: context.l10n.displayName, - helperText: context.l10n.createClientDialog_displayName_message, - ), + ), + if (_saveSucceeded) ...[ + Gaps.h16, + Text( + context.l10n.clientSecret_save_message, + style: TextStyle(color: Theme.of(context).colorScheme.primary), ), - Gaps.h24, - TextField( - controller: _maxIdentitiesController, - readOnly: _saveSucceeded, - decoration: InputDecoration( - border: const OutlineInputBorder(), - labelText: context.l10n.maxIdentities, - helperText: '${context.l10n.createClientDialog_maxIdentities_message}' - '\n${context.l10n.createClientDialog_maxIdentities_noLimit_message}', - ), - inputFormatters: [FilteringTextInputFormatter.digitsOnly], - keyboardType: TextInputType.number, + ], + Gaps.h24, + TextField( + controller: _displayNameController, + readOnly: _saveSucceeded, + decoration: InputDecoration( + border: const OutlineInputBorder(), + labelText: context.l10n.displayName, + helperText: context.l10n.createClientDialog_displayName_message, ), - Gaps.h24, - DropdownButtonFormField( - isExpanded: true, - decoration: InputDecoration( - border: const OutlineInputBorder(), - labelText: '${context.l10n.defaultTier}*', - ), - value: _chosenDefaultTier, - onChanged: _saveSucceeded ? null : (tier) => setState(() => _chosenDefaultTier = tier), - items: widget.defaultTiers.map((tier) { - return DropdownMenuItem( - value: tier.id, - child: Text(tier.name), - ); - }).toList(), + ), + Gaps.h24, + TextField( + controller: _maxIdentitiesController, + readOnly: _saveSucceeded, + decoration: InputDecoration( + border: const OutlineInputBorder(), + labelText: context.l10n.maxIdentities, + helperText: '${context.l10n.createClientDialog_maxIdentities_message}' + '\n${context.l10n.createClientDialog_maxIdentities_noLimit_message}', ), - if (_errorMessage != null) ...[ - Gaps.h16, - Text(_errorMessage!, style: TextStyle(color: Theme.of(context).colorScheme.error)), - ], + inputFormatters: [FilteringTextInputFormatter.digitsOnly], + keyboardType: TextInputType.number, + ), + Gaps.h24, + DropdownButtonFormField( + isExpanded: true, + decoration: InputDecoration( + border: const OutlineInputBorder(), + labelText: '${context.l10n.defaultTier}*', + ), + value: _chosenDefaultTier, + onChanged: _saveSucceeded ? null : (tier) => setState(() => _chosenDefaultTier = tier), + items: widget.defaultTiers.map((tier) { + return DropdownMenuItem( + value: tier.id, + child: Text(tier.name), + ); + }).toList(), + ), + if (_errorMessage != null) ...[ + Gaps.h16, + Text(_errorMessage!, style: TextStyle(color: Theme.of(context).colorScheme.error)), ], - ), + ], ), ), actions: [ diff --git a/AdminUi/apps/admin_ui/lib/home/identity_details/modals/change_tier.dart b/AdminUi/apps/admin_ui/lib/home/identity_details/modals/change_tier.dart index 11504d19c6..940bd7213f 100644 --- a/AdminUi/apps/admin_ui/lib/home/identity_details/modals/change_tier.dart +++ b/AdminUi/apps/admin_ui/lib/home/identity_details/modals/change_tier.dart @@ -54,21 +54,19 @@ class _ShowChangeTierDialogState extends State<_ShowChangeTierDialog> { child: AlertDialog( shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)), title: Text(context.l10n.changeTier, textAlign: TextAlign.center), + contentPadding: const EdgeInsets.only(left: 24, right: 24, top: 20, bottom: 32), content: SizedBox( width: 500, - child: Padding( - padding: const EdgeInsets.only(bottom: 32, top: 32), - child: DropdownButtonFormField( - value: selectedTier, - decoration: const InputDecoration(border: OutlineInputBorder()), - onChanged: _saving ? null : (String? newValue) => setState(() => selectedTier = newValue!), - items: widget.availableTiers.where((tier) => tier.canBeManuallyAssigned).map((TierOverview tier) { - return DropdownMenuItem( - value: tier.id, - child: Text(tier.name), - ); - }).toList(), - ), + child: DropdownButtonFormField( + value: selectedTier, + decoration: const InputDecoration(border: OutlineInputBorder()), + onChanged: _saving ? null : (String? newValue) => setState(() => selectedTier = newValue!), + items: widget.availableTiers.where((tier) => tier.canBeManuallyAssigned).map((TierOverview tier) { + return DropdownMenuItem( + value: tier.id, + child: Text(tier.name), + ); + }).toList(), ), ), actions: [ diff --git a/AdminUi/apps/admin_ui/lib/home/tiers_overview/modals/show_create_tier_dialog.dart b/AdminUi/apps/admin_ui/lib/home/tiers_overview/modals/show_create_tier_dialog.dart index dd34c50915..8972b0aa41 100644 --- a/AdminUi/apps/admin_ui/lib/home/tiers_overview/modals/show_create_tier_dialog.dart +++ b/AdminUi/apps/admin_ui/lib/home/tiers_overview/modals/show_create_tier_dialog.dart @@ -46,6 +46,7 @@ class _CreateTierDialogState extends State<_CreateTierDialog> { child: AlertDialog( shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)), title: Text(context.l10n.createTierDialog_title, textAlign: TextAlign.center), + contentPadding: const EdgeInsets.only(left: 24, right: 24, top: 20, bottom: 32), content: _isLoading ? const Padding( padding: EdgeInsets.all(16), @@ -53,40 +54,37 @@ class _CreateTierDialogState extends State<_CreateTierDialog> { ) : SizedBox( width: 500, - child: Padding( - padding: const EdgeInsets.only(bottom: 32), - child: Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Padding( - padding: const EdgeInsets.all(8), - child: Text('*${context.l10n.required}'), + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: const EdgeInsets.all(8), + child: Text('*${context.l10n.required}'), + ), + Gaps.h32, + TextField( + controller: _tierNameController, + focusNode: _focusNode, + onChanged: (_) { + if (_errorMessage == null) return; + setState(() => _errorMessage = null); + }, + onSubmitted: _onSubmitted, + decoration: InputDecoration( + border: const OutlineInputBorder(), + labelText: context.l10n.name, + helperText: context.l10n.createTierDialog_formMessage, + error: _errorMessage != null + ? Text( + _errorMessage!, + style: Theme.of(context).textTheme.labelSmall!.copyWith(color: Theme.of(context).colorScheme.error), + textAlign: TextAlign.left, + ) + : null, ), - Gaps.h32, - TextField( - controller: _tierNameController, - focusNode: _focusNode, - onChanged: (_) { - if (_errorMessage == null) return; - setState(() => _errorMessage = null); - }, - onSubmitted: _onSubmitted, - decoration: InputDecoration( - border: const OutlineInputBorder(), - labelText: context.l10n.name, - helperText: context.l10n.createTierDialog_formMessage, - error: _errorMessage != null - ? Text( - _errorMessage!, - style: Theme.of(context).textTheme.labelSmall!.copyWith(color: Theme.of(context).colorScheme.error), - textAlign: TextAlign.left, - ) - : null, - ), - ), - ], - ), + ), + ], ), ), actions: [ From e1e7398ef907a3b104da860eff8d97397768f69a Mon Sep 17 00:00:00 2001 From: Vladimir Vuckovic Date: Wed, 10 Jul 2024 09:29:45 +0200 Subject: [PATCH 12/13] chore: add remove to translations --- AdminUi/apps/admin_ui/lib/l10n/app_en.arb | 1 + 1 file changed, 1 insertion(+) diff --git a/AdminUi/apps/admin_ui/lib/l10n/app_en.arb b/AdminUi/apps/admin_ui/lib/l10n/app_en.arb index fab0e2af82..a5d410a18f 100644 --- a/AdminUi/apps/admin_ui/lib/l10n/app_en.arb +++ b/AdminUi/apps/admin_ui/lib/l10n/app_en.arb @@ -39,6 +39,7 @@ "quotas": "Quotas", "retry": "Retry", "required": "required", + "remove": "Remove", "save": "Save", "searchTiers": "Search Tiers", "settings": "Settings", From ddbcbf2198c571ca47f0cfb4d0a002b2c9808ed4 Mon Sep 17 00:00:00 2001 From: Vladimir Vuckovic Date: Wed, 10 Jul 2024 09:49:55 +0200 Subject: [PATCH 13/13] chore: use the default values except for bottom --- .../clients_overview/modals/change_client_secret_dialog.dart | 2 +- .../lib/home/clients_overview/modals/create_client_dialog.dart | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/AdminUi/apps/admin_ui/lib/home/clients_overview/modals/change_client_secret_dialog.dart b/AdminUi/apps/admin_ui/lib/home/clients_overview/modals/change_client_secret_dialog.dart index bf40c1ebf0..9304a1f89d 100644 --- a/AdminUi/apps/admin_ui/lib/home/clients_overview/modals/change_client_secret_dialog.dart +++ b/AdminUi/apps/admin_ui/lib/home/clients_overview/modals/change_client_secret_dialog.dart @@ -57,7 +57,7 @@ class _ChangeClientSecretDialogState extends State<_ChangeClientSecretDialog> { child: AlertDialog( shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)), title: Text(context.l10n.changeClientSecret, textAlign: TextAlign.center), - contentPadding: const EdgeInsets.only(left: 24, right: 24, top: 32, bottom: 32), + contentPadding: const EdgeInsets.only(left: 24, right: 24, top: 20, bottom: 32), content: SizedBox( width: 500, child: Column( diff --git a/AdminUi/apps/admin_ui/lib/home/clients_overview/modals/create_client_dialog.dart b/AdminUi/apps/admin_ui/lib/home/clients_overview/modals/create_client_dialog.dart index efe3f74e30..ee78448379 100644 --- a/AdminUi/apps/admin_ui/lib/home/clients_overview/modals/create_client_dialog.dart +++ b/AdminUi/apps/admin_ui/lib/home/clients_overview/modals/create_client_dialog.dart @@ -65,7 +65,7 @@ class _CreateClientDialogState extends State<_CreateClientDialog> { child: AlertDialog( shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)), title: Text(context.l10n.createClientDialog_title, textAlign: TextAlign.center), - contentPadding: const EdgeInsets.only(left: 24, right: 24, top: 32, bottom: 32), + contentPadding: const EdgeInsets.only(left: 24, right: 24, top: 20, bottom: 32), content: SizedBox( width: 500, child: Column(