]> git.proxmox.com Git - flutter/proxmox_login_manager.git/blobdiff - lib/proxmox_tfa_form.dart
tree wide: various small lint auto-fixes
[flutter/proxmox_login_manager.git] / lib / proxmox_tfa_form.dart
index 568a2356cc7458d8d8602888b001c3fafb9e4239..f761462aadfc6adfeefc08011439808f87c78c02 100644 (file)
@@ -28,7 +28,7 @@ class _ProxmoxTfaFormState extends State<ProxmoxTfaForm> {
   Widget build(BuildContext context) {
     return Theme(
       data: ThemeData.dark().copyWith(
-          colorScheme: ColorScheme.dark().copyWith(
+          colorScheme: const ColorScheme.dark().copyWith(
               secondary: ProxmoxColors.orange,
               onSecondary: ProxmoxColors.supportGrey)),
       child: Scaffold(
@@ -38,7 +38,7 @@ class _ProxmoxTfaFormState extends State<ProxmoxTfaForm> {
           elevation: 0.0,
           backgroundColor: Colors.transparent,
           leading: IconButton(
-            icon: Icon(Icons.close),
+            icon: const Icon(Icons.close),
             onPressed: () => Navigator.of(context).pop(),
           ),
         ),
@@ -56,21 +56,21 @@ class _ProxmoxTfaFormState extends State<ProxmoxTfaForm> {
                       mainAxisAlignment: MainAxisAlignment.start,
                       crossAxisAlignment: CrossAxisAlignment.center,
                       children: <Widget>[
-                        Padding(
-                          padding: const EdgeInsets.fromLTRB(0, 100.0, 0, 30.0),
+                        const Padding(
+                          padding: EdgeInsets.fromLTRB(0, 100.0, 0, 30.0),
                           child: Icon(
                             Icons.lock,
                             size: 48,
                           ),
                         ),
-                        Text(
+                        const Text(
                           'Verify',
                           style: TextStyle(
                               fontSize: 36,
                               color: Colors.white,
                               fontWeight: FontWeight.bold),
                         ),
-                        Text(
+                        const Text(
                           'Check your second factor provider',
                           style: TextStyle(
                               color: Colors.white38,
@@ -83,13 +83,13 @@ class _ProxmoxTfaFormState extends State<ProxmoxTfaForm> {
                             child: Column(
                               children: <Widget>[
                                 DropdownButtonFormField(
-                                  decoration: InputDecoration(
+                                  decoration: const InputDecoration(
                                       labelText: 'Method',
                                       icon: Icon(Icons.input)),
                                   items: _tfa_kinds
                                       .map((e) => DropdownMenuItem(
-                                            child: ListTile(title: Text(e)),
                                             value: e,
+                                            child: ListTile(title: Text(e)),
                                           ))
                                       .toList(),
                                   onChanged: (String? value) {
@@ -104,9 +104,12 @@ class _ProxmoxTfaFormState extends State<ProxmoxTfaForm> {
                                 TextField(
                                     controller: _codeController,
                                     textAlign: TextAlign.center,
-                                    decoration: InputDecoration(
+                                    decoration: const InputDecoration(
                                         labelText: 'Code',
                                         icon: Icon(Icons.pin)),
+                                    keyboardType: _selected_tfa_kind == 'totp'
+                                        ? TextInputType.number
+                                        : TextInputType.visiblePassword,
                                     autofocus: true,
                                     onSubmitted: (value) => _submitTfaCode()),
                               ],
@@ -121,11 +124,11 @@ class _ProxmoxTfaFormState extends State<ProxmoxTfaForm> {
                               child: TextButton(
                                 style: TextButton.styleFrom(
                                   foregroundColor: Colors.white,
-                                  backgroundColor: Color(0xFFE47225),
+                                  backgroundColor: const Color(0xFFE47225),
                                   disabledBackgroundColor: Colors.grey,
                                 ),
                                 onPressed: () => _submitTfaCode(),
-                                child: Text('Continue'),
+                                child: const Text('Continue'),
                               ),
                             ),
                           ),
@@ -137,7 +140,7 @@ class _ProxmoxTfaFormState extends State<ProxmoxTfaForm> {
               ),
             ),
             if (_isLoading)
-              ProxmoxProgressOverlay(
+              const ProxmoxProgressOverlay(
                 message: 'Verifying second-factor...',
               )
           ],