]> git.proxmox.com Git - flutter/proxmox_login_manager.git/commitdiff
tfa form: wrap in SafeArea
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 5 Jul 2023 10:07:30 +0000 (12:07 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 5 Jul 2023 10:07:33 +0000 (12:07 +0200)
to avoid that the submit button is cut-off halfway

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
lib/proxmox_tfa_form.dart

index 84c6ad87202eff6b2533e7f91263336c3bedc8c1..568a2356cc7458d8d8602888b001c3fafb9e4239 100644 (file)
@@ -49,85 +49,89 @@ class _ProxmoxTfaFormState extends State<ProxmoxTfaForm> {
               child: ConstrainedBox(
                 constraints: BoxConstraints.tightFor(
                     height: MediaQuery.of(context).size.height),
-                child: Padding(
-                  padding: const EdgeInsets.all(8.0),
-                  child: Column(
-                    mainAxisAlignment: MainAxisAlignment.start,
-                    crossAxisAlignment: CrossAxisAlignment.center,
-                    children: <Widget>[
-                      Padding(
-                        padding: const EdgeInsets.fromLTRB(0, 100.0, 0, 30.0),
-                        child: Icon(
-                          Icons.lock,
-                          size: 48,
+                child: SafeArea(
+                  child: Padding(
+                    padding: const EdgeInsets.all(8.0),
+                    child: Column(
+                      mainAxisAlignment: MainAxisAlignment.start,
+                      crossAxisAlignment: CrossAxisAlignment.center,
+                      children: <Widget>[
+                        Padding(
+                          padding: const EdgeInsets.fromLTRB(0, 100.0, 0, 30.0),
+                          child: Icon(
+                            Icons.lock,
+                            size: 48,
+                          ),
                         ),
-                      ),
-                      Text(
-                        'Verify',
-                        style: TextStyle(
-                            fontSize: 36,
-                            color: Colors.white,
-                            fontWeight: FontWeight.bold),
-                      ),
-                      Text(
-                        'Check your second factor provider',
-                        style: TextStyle(
-                            color: Colors.white38, fontWeight: FontWeight.bold),
-                      ),
-                      Padding(
-                        padding: const EdgeInsets.fromLTRB(0, 50.0, 0, 8.0),
-                        child: Container(
-                          width: 175,
-                          child: Column(
-                            children: <Widget>[
-                              DropdownButtonFormField(
-                                decoration: InputDecoration(
-                                    labelText: 'Method',
-                                    icon: Icon(Icons.input)),
-                                items: _tfa_kinds
-                                    .map((e) => DropdownMenuItem(
-                                          child: ListTile(title: Text(e)),
-                                          value: e,
-                                        ))
-                                    .toList(),
-                                onChanged: (String? value) {
-                                  setState(() {
-                                    _selected_tfa_kind = value!;
-                                  });
-                                },
-                                selectedItemBuilder: (context) =>
-                                    _tfa_kinds.map((e) => Text(e)).toList(),
-                                value: _selected_tfa_kind,
-                              ),
-                              TextField(
-                                  controller: _codeController,
-                                  textAlign: TextAlign.center,
+                        Text(
+                          'Verify',
+                          style: TextStyle(
+                              fontSize: 36,
+                              color: Colors.white,
+                              fontWeight: FontWeight.bold),
+                        ),
+                        Text(
+                          'Check your second factor provider',
+                          style: TextStyle(
+                              color: Colors.white38,
+                              fontWeight: FontWeight.bold),
+                        ),
+                        Padding(
+                          padding: const EdgeInsets.fromLTRB(0, 50.0, 0, 8.0),
+                          child: Container(
+                            width: 175,
+                            child: Column(
+                              children: <Widget>[
+                                DropdownButtonFormField(
                                   decoration: InputDecoration(
-                                      labelText: 'Code', icon: Icon(Icons.pin)),
-                                  autofocus: true,
-                                  onSubmitted: (value) => _submitTfaCode()),
-                            ],
+                                      labelText: 'Method',
+                                      icon: Icon(Icons.input)),
+                                  items: _tfa_kinds
+                                      .map((e) => DropdownMenuItem(
+                                            child: ListTile(title: Text(e)),
+                                            value: e,
+                                          ))
+                                      .toList(),
+                                  onChanged: (String? value) {
+                                    setState(() {
+                                      _selected_tfa_kind = value!;
+                                    });
+                                  },
+                                  selectedItemBuilder: (context) =>
+                                      _tfa_kinds.map((e) => Text(e)).toList(),
+                                  value: _selected_tfa_kind,
+                                ),
+                                TextField(
+                                    controller: _codeController,
+                                    textAlign: TextAlign.center,
+                                    decoration: InputDecoration(
+                                        labelText: 'Code',
+                                        icon: Icon(Icons.pin)),
+                                    autofocus: true,
+                                    onSubmitted: (value) => _submitTfaCode()),
+                              ],
+                            ),
                           ),
                         ),
-                      ),
-                      Expanded(
-                        child: Align(
-                          alignment: Alignment.bottomCenter,
-                          child: Container(
-                            width: MediaQuery.of(context).size.width,
-                            child: TextButton(
-                              style: TextButton.styleFrom(
-                                foregroundColor: Colors.white,
-                                backgroundColor: Color(0xFFE47225),
-                                disabledBackgroundColor: Colors.grey,
+                        Expanded(
+                          child: Align(
+                            alignment: Alignment.bottomCenter,
+                            child: Container(
+                              width: MediaQuery.of(context).size.width,
+                              child: TextButton(
+                                style: TextButton.styleFrom(
+                                  foregroundColor: Colors.white,
+                                  backgroundColor: Color(0xFFE47225),
+                                  disabledBackgroundColor: Colors.grey,
+                                ),
+                                onPressed: () => _submitTfaCode(),
+                                child: Text('Continue'),
                               ),
-                              onPressed: () => _submitTfaCode(),
-                              child: Text('Continue'),
                             ),
                           ),
                         ),
-                      ),
-                    ],
+                      ],
+                    ),
                   ),
                 ),
               ),