From: Aaron Lauterer <a.lauterer@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH login_manager 1/2] login_form: keep Continue button above Android softnav
Date: Mon, 27 Dec 2021 15:07:04 +0100 [thread overview]
Message-ID: <20211227140705.1531308-2-a.lauterer@proxmox.com> (raw)
In-Reply-To: <20211227140705.1531308-1-a.lauterer@proxmox.com>
By placing the items in a SafeArea we avoid having the "Continue" button
behind the Android soft navigation buttons.
Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
---
lib/proxmox_login_form.dart | 265 ++++++++++++++++++------------------
1 file changed, 135 insertions(+), 130 deletions(-)
diff --git a/lib/proxmox_login_form.dart b/lib/proxmox_login_form.dart
index 2609f71..bb00b5c 100644
--- a/lib/proxmox_login_form.dart
+++ b/lib/proxmox_login_form.dart
@@ -232,152 +232,157 @@ class _ProxmoxLoginPageState extends State<ProxmoxLoginPage> {
child: ConstrainedBox(
constraints: BoxConstraints.tightFor(
height: MediaQuery.of(context).size.height),
- child: Padding(
- padding: const EdgeInsets.all(8.0),
- child: FutureBuilder<List<PveAccessDomainModel?>?>(
- future: _accessDomains,
- builder: (context, snapshot) {
- return Form(
- key: _formKey,
- onChanged: () {
- setState(() {
- _submittButtonEnabled =
- _formKey.currentState!.validate();
- });
- },
- child: Column(
- mainAxisAlignment: MainAxisAlignment.center,
- children: [
- Expanded(
- child: Container(
- child: Column(
- mainAxisAlignment: MainAxisAlignment.center,
- children: [
- Image.asset(
- 'assets/images/proxmox_logo_symbol_wordmark.png',
- package: 'proxmox_login_manager',
- ),
- ],
+ child: SafeArea(
+ child: Padding(
+ padding: const EdgeInsets.all(8.0),
+ child: FutureBuilder<List<PveAccessDomainModel?>?>(
+ future: _accessDomains,
+ builder: (context, snapshot) {
+ return Form(
+ key: _formKey,
+ onChanged: () {
+ setState(() {
+ _submittButtonEnabled =
+ _formKey.currentState!.validate();
+ });
+ },
+ child: Column(
+ mainAxisAlignment: MainAxisAlignment.center,
+ children: [
+ Expanded(
+ child: Container(
+ child: Column(
+ mainAxisAlignment:
+ MainAxisAlignment.center,
+ children: [
+ Image.asset(
+ 'assets/images/proxmox_logo_symbol_wordmark.png',
+ package: 'proxmox_login_manager',
+ ),
+ ],
+ ),
),
),
- ),
- ProxmoxLoginForm(
- originController: _originController,
- originValidator: (value) {
- if (value == null || value.isEmpty) {
- return 'Please enter origin';
- }
- if (value.startsWith('https://') ||
- value.startsWith('http://')) {
- return 'Do not prefix with scheme';
- }
- try {
- Uri.https(value, '');
- return null;
- } on FormatException catch (_) {
- return 'Invalid URI';
- }
- },
- usernameController: _usernameController,
- passwordController: _passwordController,
- accessDomains: snapshot.data,
- selectedDomain: _selectedDomain,
- onDomainChanged: (value) {
- setState(() {
- _selectedDomain = value;
- });
- },
- onOriginSubmitted: _submittButtonEnabled
- ? () {
- final isValid =
- _formKey.currentState!.validate();
- setState(() {
- _submittButtonEnabled = isValid;
- });
- if (isValid) {
+ ProxmoxLoginForm(
+ originController: _originController,
+ originValidator: (value) {
+ if (value == null || value.isEmpty) {
+ return 'Please enter origin';
+ }
+ if (value.startsWith('https://') ||
+ value.startsWith('http://')) {
+ return 'Do not prefix with scheme';
+ }
+ try {
+ Uri.https(value, '');
+ return null;
+ } on FormatException catch (_) {
+ return 'Invalid URI';
+ }
+ },
+ usernameController: _usernameController,
+ passwordController: _passwordController,
+ accessDomains: snapshot.data,
+ selectedDomain: _selectedDomain,
+ onDomainChanged: (value) {
+ setState(() {
+ _selectedDomain = value;
+ });
+ },
+ onOriginSubmitted: _submittButtonEnabled
+ ? () {
+ final isValid =
+ _formKey.currentState!.validate();
setState(() {
- _accessDomains =
- _getAccessDomains();
+ _submittButtonEnabled = isValid;
});
+ if (isValid) {
+ setState(() {
+ _accessDomains =
+ _getAccessDomains();
+ });
+ }
}
- }
- : null,
- onPasswordSubmitted: _submittButtonEnabled
- ? () {
- final isValid =
- _formKey.currentState!.validate();
- setState(() {
- _submittButtonEnabled = isValid;
- });
- if (isValid) {
- _onLoginButtonPressed();
+ : null,
+ onPasswordSubmitted: _submittButtonEnabled
+ ? () {
+ final isValid =
+ _formKey.currentState!.validate();
+ setState(() {
+ _submittButtonEnabled = isValid;
+ });
+ if (isValid) {
+ _onLoginButtonPressed();
+ }
}
- }
- : null,
- ),
- if (snapshot.hasData)
- Expanded(
- child: Align(
- alignment: Alignment.bottomCenter,
- child: Container(
- width: MediaQuery.of(context).size.width,
- child: FlatButton(
- onPressed: _submittButtonEnabled
- ? () {
- final isValid = _formKey
- .currentState!
- .validate();
- setState(() {
- _submittButtonEnabled =
- isValid;
- });
- if (isValid) {
- _onLoginButtonPressed();
+ : null,
+ ),
+ if (snapshot.hasData)
+ Expanded(
+ child: Align(
+ alignment: Alignment.bottomCenter,
+ child: Container(
+ width:
+ MediaQuery.of(context).size.width,
+ child: FlatButton(
+ onPressed: _submittButtonEnabled
+ ? () {
+ final isValid = _formKey
+ .currentState!
+ .validate();
+ setState(() {
+ _submittButtonEnabled =
+ isValid;
+ });
+ if (isValid) {
+ _onLoginButtonPressed();
+ }
}
- }
- : null,
- color: ProxmoxColors.orange,
- disabledColor: Colors.grey,
- child: Text('Continue'),
+ : null,
+ color: ProxmoxColors.orange,
+ disabledColor: Colors.grey,
+ child: Text('Continue'),
+ ),
),
),
),
- ),
- if (!snapshot.hasData)
- Expanded(
- child: Align(
- alignment: Alignment.bottomCenter,
- child: Container(
- width: MediaQuery.of(context).size.width,
- child: FlatButton(
- onPressed: _submittButtonEnabled
- ? () {
- final isValid = _formKey
- .currentState!
- .validate();
- setState(() {
- _submittButtonEnabled =
- isValid;
- });
- if (isValid) {
+ if (!snapshot.hasData)
+ Expanded(
+ child: Align(
+ alignment: Alignment.bottomCenter,
+ child: Container(
+ width:
+ MediaQuery.of(context).size.width,
+ child: FlatButton(
+ onPressed: _submittButtonEnabled
+ ? () {
+ final isValid = _formKey
+ .currentState!
+ .validate();
setState(() {
- _accessDomains =
- _getAccessDomains();
+ _submittButtonEnabled =
+ isValid;
});
+ if (isValid) {
+ setState(() {
+ _accessDomains =
+ _getAccessDomains();
+ });
+ }
}
- }
- : null,
- color: ProxmoxColors.orange,
- child: Text('Continue'),
- disabledColor: Colors.grey,
+ : null,
+ color: ProxmoxColors.orange,
+ child: Text('Continue'),
+ disabledColor: Colors.grey,
+ ),
),
),
),
- ),
- ],
- ),
- );
- }),
+ ],
+ ),
+ );
+ }),
+ ),
),
),
),
--
2.30.2
next prev parent reply other threads:[~2021-12-27 14:07 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-27 14:07 [pve-devel] [PATCH login_manager, flutter_frontend 0/2] Avoid elements hiding behind Android soft nav buttons Aaron Lauterer
2021-12-27 14:07 ` Aaron Lauterer [this message]
2021-12-27 14:07 ` [pve-devel] [PATCH flutter_frontend 2/2] avoid elements hiding behind Android softnav buttons Aaron Lauterer
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=20211227140705.1531308-2-a.lauterer@proxmox.com \
--to=a.lauterer@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox