From: Shan Shaji <s.shaji@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH proxmox_login_manager] fix: ui: remove `SafeArea` to avoid black background in status bar
Date: Thu, 15 May 2025 15:34:01 +0200 [thread overview]
Message-ID: <20250515133401.72669-1-s.shaji@proxmox.com> (raw)
Since the `SafeArea` widget was wrapping the `Scaffold` widget, the
background color of the status bar was black rather than influenced by
the `AppBar` color.
This patch fixes it by removing the `SafeArea` widget. According to
flutter docs [0] when using `AppBar` with `Scaffold` the
appropriate spacing will be calculated at the top of the screen
without the needing to wrap the `Scaffold` in a `SafeArea` and the
status bar color will be influenced by the app bar color.
This patch also fixes the app name title alignment issue in iOS.
[0] - https://api.flutter.dev/flutter/material/AppBar-class.html?utm_source
Signed-off-by: Shan Shaji <s.shaji@proxmox.com>
---
lib/proxmox_login_selector.dart | 264 ++++++++++++++++----------------
1 file changed, 130 insertions(+), 134 deletions(-)
diff --git a/lib/proxmox_login_selector.dart b/lib/proxmox_login_selector.dart
index f063699..fb1218b 100644
--- a/lib/proxmox_login_selector.dart
+++ b/lib/proxmox_login_selector.dart
@@ -29,152 +29,87 @@ class _ProxmoxLoginSelectorState extends State<ProxmoxLoginSelector> {
@override
Widget build(BuildContext context) {
- return SafeArea(
- child: Scaffold(
- backgroundColor: Theme.of(context).colorScheme.background,
- appBar: AppBar(
- title: const Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text(
- 'Proxmox',
- style: TextStyle(
- fontSize: 14,
- ),
+ return Scaffold(
+ backgroundColor: Theme.of(context).colorScheme.background,
+ appBar: AppBar(
+ centerTitle: false,
+ title: const Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Text(
+ 'Proxmox',
+ style: TextStyle(
+ fontSize: 14,
),
- Text(
- 'Virtual Environment',
- style: TextStyle(
- fontSize: 14,
- ),
- )
- ],
- ),
- actions: [
- IconButton(
- icon: const Icon(Icons.settings),
- onPressed: () {
- Navigator.of(context).push(MaterialPageRoute(
- builder: (context) => const ProxmoxGeneralSettingsForm(),
- ));
- })
+ ),
+ Text(
+ 'Virtual Environment',
+ style: TextStyle(
+ fontSize: 14,
+ ),
+ )
],
),
- body: FutureBuilder<ProxmoxLoginStorage?>(
- future: loginStorage,
- builder: (context, snapshot) {
- if (!snapshot.hasData) {
- return const Center(
- child: CircularProgressIndicator(),
- );
- }
- if (snapshot.hasData &&
- (snapshot.data!.logins?.isEmpty ?? true)) {
- return const Center(
- child: Text('Add an account'),
- );
- }
- var items = <Widget>[];
- final BuiltList<ProxmoxLoginModel> logins =
- snapshot.data?.logins ?? BuiltList<ProxmoxLoginModel>();
+ actions: [
+ IconButton(
+ icon: const Icon(Icons.settings),
+ onPressed: () {
+ Navigator.of(context).push(MaterialPageRoute(
+ builder: (context) => const ProxmoxGeneralSettingsForm(),
+ ));
+ })
+ ],
+ ),
+ body: FutureBuilder<ProxmoxLoginStorage?>(
+ future: loginStorage,
+ builder: (context, snapshot) {
+ if (!snapshot.hasData) {
+ return const Center(
+ child: CircularProgressIndicator(),
+ );
+ }
+ if (snapshot.hasData && (snapshot.data!.logins?.isEmpty ?? true)) {
+ return const Center(
+ child: Text('Add an account'),
+ );
+ }
+ var items = <Widget>[];
+ final BuiltList<ProxmoxLoginModel> logins =
+ snapshot.data?.logins ?? BuiltList<ProxmoxLoginModel>();
- final activeSessions =
- logins.rebuild((b) => b.where((b) => b.activeSession));
+ final activeSessions =
+ logins.rebuild((b) => b.where((b) => b.activeSession));
- if (activeSessions.isNotEmpty) {
- items.addAll([
- const Padding(
- padding: EdgeInsets.all(12.0),
- child: Text(
- 'Active Sessions',
- style: TextStyle(
- fontSize: 18,
- fontWeight: FontWeight.bold,
- ),
- ),
- ),
- ...activeSessions.map((s) => ListTile(
- title: Text(s.fullHostname),
- subtitle: Text(s.fullUsername),
- trailing: const Icon(Icons.navigate_next),
- leading: PopupMenuButton(
- icon: const Icon(Icons.more_vert,
- color: Colors.green),
- itemBuilder: (context) => [
- PopupMenuItem(
- child: ListTile(
- dense: true,
- leading: const Icon(Icons.logout),
- title: const Text('Logout'),
- onTap: () async {
- await snapshot.data!
- .rebuild((b) => b.logins
- .rebuildWhere((m) => s == m,
- (b) => b..ticket = ''))
- .saveToDisk();
- refreshFromStorage();
- if (context.mounted) {
- Navigator.of(context).pop();
- }
- },
- ),
- ),
- ]),
- onTap: () => _login(user: s),
- )),
- ]);
- }
+ if (activeSessions.isNotEmpty) {
items.addAll([
const Padding(
padding: EdgeInsets.all(12.0),
child: Text(
- 'Available Sites',
+ 'Active Sessions',
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold,
),
),
),
- ...logins.where((b) => !b.activeSession).map((login) =>
- ListTile(
- title: Text(login.fullHostname),
- subtitle: Text(login.fullUsername),
+ ...activeSessions.map((s) => ListTile(
+ title: Text(s.fullHostname),
+ subtitle: Text(s.fullUsername),
trailing: const Icon(Icons.navigate_next),
leading: PopupMenuButton(
+ icon:
+ const Icon(Icons.more_vert, color: Colors.green),
itemBuilder: (context) => [
- if (login.passwordSaved ?? false)
- PopupMenuItem(
- child: ListTile(
- dense: true,
- leading: const Icon(Icons.key_off),
- title: const Text('Delete Password'),
- onTap: () async {
- await deletePassword(login.identifier!);
-
- await snapshot.data!
- .rebuild((b) => b
- ..logins.rebuildWhere(
- (m) => m == login,
- (b) =>
- b..passwordSaved = false))
- .saveToDisk();
- refreshFromStorage();
- if (context.mounted) {
- Navigator.of(context).pop();
- }
- },
- ),
- ),
PopupMenuItem(
child: ListTile(
dense: true,
- leading: const Icon(Icons.delete),
- title: const Text('Delete'),
+ leading: const Icon(Icons.logout),
+ title: const Text('Logout'),
onTap: () async {
- await deletePassword(login.identifier!);
await snapshot.data!
- .rebuild(
- (b) => b.logins.remove(login))
+ .rebuild((b) => b.logins.rebuildWhere(
+ (m) => s == m,
+ (b) => b..ticket = ''))
.saveToDisk();
refreshFromStorage();
if (context.mounted) {
@@ -184,18 +119,79 @@ class _ProxmoxLoginSelectorState extends State<ProxmoxLoginSelector> {
),
),
]),
- onTap: () => _login(user: login),
- ))
+ onTap: () => _login(user: s),
+ )),
]);
- return ListView(
- children: items,
- );
- }),
- floatingActionButton: FloatingActionButton.extended(
- onPressed: () => _login(isCreate: true),
- label: const Text('Add'),
- icon: const Icon(Icons.account_circle),
- ),
+ }
+ items.addAll([
+ const Padding(
+ padding: EdgeInsets.all(12.0),
+ child: Text(
+ 'Available Sites',
+ style: TextStyle(
+ fontSize: 18,
+ fontWeight: FontWeight.bold,
+ ),
+ ),
+ ),
+ ...logins.where((b) => !b.activeSession).map((login) => ListTile(
+ title: Text(login.fullHostname),
+ subtitle: Text(login.fullUsername),
+ trailing: const Icon(Icons.navigate_next),
+ leading: PopupMenuButton(
+ itemBuilder: (context) => [
+ if (login.passwordSaved ?? false)
+ PopupMenuItem(
+ child: ListTile(
+ dense: true,
+ leading: const Icon(Icons.key_off),
+ title: const Text('Delete Password'),
+ onTap: () async {
+ await deletePassword(login.identifier!);
+
+ await snapshot.data!
+ .rebuild((b) => b
+ ..logins.rebuildWhere(
+ (m) => m == login,
+ (b) =>
+ b..passwordSaved = false))
+ .saveToDisk();
+ refreshFromStorage();
+ if (context.mounted) {
+ Navigator.of(context).pop();
+ }
+ },
+ ),
+ ),
+ PopupMenuItem(
+ child: ListTile(
+ dense: true,
+ leading: const Icon(Icons.delete),
+ title: const Text('Delete'),
+ onTap: () async {
+ await deletePassword(login.identifier!);
+ await snapshot.data!
+ .rebuild((b) => b.logins.remove(login))
+ .saveToDisk();
+ refreshFromStorage();
+ if (context.mounted) {
+ Navigator.of(context).pop();
+ }
+ },
+ ),
+ ),
+ ]),
+ onTap: () => _login(user: login),
+ ))
+ ]);
+ return ListView(
+ children: items,
+ );
+ }),
+ floatingActionButton: FloatingActionButton.extended(
+ onPressed: () => _login(isCreate: true),
+ label: const Text('Add'),
+ icon: const Icon(Icons.account_circle),
),
);
}
--
2.39.5 (Apple Git-154)
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
next reply other threads:[~2025-05-15 13:34 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-15 13:34 Shan Shaji [this message]
2025-05-16 11:53 ` Michael Köppl
2025-05-21 12:30 ` [pve-devel] applied: " Dominik Csapak
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250515133401.72669-1-s.shaji@proxmox.com \
--to=s.shaji@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal