From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id D44AF1FF18A for ; Fri, 1 Aug 2025 11:59:45 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id E2F5B157BC; Fri, 1 Aug 2025 12:01:06 +0200 (CEST) From: Shan Shaji To: pve-devel@lists.proxmox.com Date: Fri, 1 Aug 2025 12:00:51 +0200 Message-Id: <20250801100051.83035-3-s.shaji@proxmox.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250801100051.83035-1-s.shaji@proxmox.com> References: <20250801100051.83035-1-s.shaji@proxmox.com> MIME-Version: 1.0 X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1754042450000 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.215 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pve-devel] [PATCH proxmox_login_manager 1/1] refactor: ui: move settings page to `pve_flutter_frontend` X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox VE development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pve-devel-bounces@lists.proxmox.com Sender: "pve-devel" The setting screen UI was previously defined in this repo. If a new app settings needs to be added eg: privacy policy link, app version string. The change had to be done in the package even though the change is not package specific. Inorder to fix that, move settings page to `pve_flutter_frontend` and use `ProxmoxGeneralSettingsForm` as a widget in the new settings page. Signed-off-by: Shan Shaji --- lib/proxmox_general_settings_form.dart | 58 +++++++++++--------------- lib/proxmox_login_form.dart | 5 +-- lib/proxmox_login_selector.dart | 13 +++--- 3 files changed, 31 insertions(+), 45 deletions(-) diff --git a/lib/proxmox_general_settings_form.dart b/lib/proxmox_general_settings_form.dart index cb0afef..e39f91d 100644 --- a/lib/proxmox_general_settings_form.dart +++ b/lib/proxmox_general_settings_form.dart @@ -12,6 +12,7 @@ class ProxmoxGeneralSettingsForm extends StatefulWidget { class _ProxmoxGeneralSettingsFormState extends State { Future? _settings; + @override void initState() { super.initState(); @@ -20,41 +21,30 @@ class _ProxmoxGeneralSettingsFormState @override Widget build(BuildContext context) { - return Scaffold( - appBar: AppBar( - title: const Text('Settings'), - ), - body: FutureBuilder( - future: _settings, - builder: (context, snaptshot) { - if (snaptshot.hasData) { - final settings = snaptshot.data!; - return SingleChildScrollView( - child: Column( - children: [ - SwitchListTile( - title: const Text('Validate SSL connections'), - subtitle: const Text('e.g. validates certificates'), - value: settings.sslValidation!, - onChanged: (value) async { - await settings - .rebuild((b) => b.sslValidation = value) - .toLocalStorage(); - setState(() { - _settings = - ProxmoxGeneralSettingsModel.fromLocalStorage(); - }); - }, - ) - ], - ), - ); - } + return FutureBuilder( + future: _settings, + builder: (context, snapShot) { + if (snapShot.hasData) { + final settings = snapShot.data!; + return SwitchListTile( + title: const Text('Validate SSL connections'), + subtitle: const Text('e.g. validates certificates'), + value: settings.sslValidation!, + onChanged: (value) async { + await settings + .rebuild((b) => b.sslValidation = value) + .toLocalStorage(); + setState(() { + _settings = ProxmoxGeneralSettingsModel.fromLocalStorage(); + }); + }, + ); + } - return const Center( - child: CircularProgressIndicator(), - ); - }), + return const Center( + child: CircularProgressIndicator(), + ); + }, ); } } diff --git a/lib/proxmox_login_form.dart b/lib/proxmox_login_form.dart index 5a2db3b..db9994b 100644 --- a/lib/proxmox_login_form.dart +++ b/lib/proxmox_login_form.dart @@ -6,7 +6,6 @@ import 'package:collection/collection.dart'; import 'package:proxmox_dart_api_client/proxmox_dart_api_client.dart' as proxclient; import 'package:proxmox_dart_api_client/proxmox_dart_api_client.dart'; -import 'package:proxmox_login_manager/proxmox_general_settings_form.dart'; import 'package:proxmox_login_manager/proxmox_general_settings_model.dart'; import 'package:proxmox_login_manager/proxmox_login_model.dart'; import 'package:proxmox_login_manager/proxmox_tfa_form.dart'; @@ -829,9 +828,7 @@ class ProxmoxCertificateErrorDialog extends StatelessWidget { child: const Text('Close'), ), TextButton( - onPressed: () => Navigator.of(context).pushReplacement( - MaterialPageRoute( - builder: (context) => const ProxmoxGeneralSettingsForm())), + onPressed: () => Navigator.popAndPushNamed(context, '/settings'), child: const Text('Settings'), ) ], diff --git a/lib/proxmox_login_selector.dart b/lib/proxmox_login_selector.dart index ba84d7d..c8d9813 100644 --- a/lib/proxmox_login_selector.dart +++ b/lib/proxmox_login_selector.dart @@ -1,6 +1,5 @@ import 'package:flutter/material.dart'; import 'package:built_collection/built_collection.dart'; -import 'package:proxmox_login_manager/proxmox_general_settings_form.dart'; import 'package:proxmox_login_manager/proxmox_login_form.dart'; import 'package:proxmox_login_manager/proxmox_login_model.dart'; import 'package:proxmox_dart_api_client/proxmox_dart_api_client.dart' @@ -52,12 +51,12 @@ class _ProxmoxLoginSelectorState extends State { ), actions: [ IconButton( - icon: const Icon(Icons.settings), - onPressed: () { - Navigator.of(context).push(MaterialPageRoute( - builder: (context) => const ProxmoxGeneralSettingsForm(), - )); - }) + icon: const Icon(Icons.settings), + onPressed: () => Navigator.pushNamed( + context, + '/settings', + ), + ) ], ), body: FutureBuilder( -- 2.39.5 _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel