]> git.proxmox.com Git - flutter/proxmox_login_manager.git/commitdiff
migrate from FlatButton to TextButton
authorDominik Csapak <d.csapak@proxmox.com>
Thu, 8 Sep 2022 09:55:39 +0000 (11:55 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Thu, 8 Sep 2022 14:02:50 +0000 (16:02 +0200)
since flutter 3 removed FlatButton. For this we have to do the colors a
little different, so i moved the color/disabledColor into the
textButtonTheme, which does not modify anything else here.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
lib/proxmox_login_form.dart
lib/proxmox_tfa_form.dart

index bb00b5cc4127efc82c6a5f168ef3e18c4719632d..5e9198fd5df3e55d7cdfc7a1c1278b9070ff0403 100644 (file)
@@ -212,9 +212,18 @@ class _ProxmoxLoginPageState extends State<ProxmoxLoginPage> {
     return Theme(
       //data: ThemeData.dark().copyWith(accentColor: Color(0xFFE47225)),
       data: ThemeData.dark().copyWith(
-          colorScheme: ColorScheme.dark().copyWith(
-              secondary: ProxmoxColors.orange,
-              onSecondary: ProxmoxColors.supportGrey)),
+        textButtonTheme: TextButtonThemeData(
+          style: TextButton.styleFrom(
+            foregroundColor: Colors.white,
+            backgroundColor: ProxmoxColors.orange,
+            disabledBackgroundColor: Colors.grey,
+          ),
+        ),
+        colorScheme: ColorScheme.dark().copyWith(
+            secondary: ProxmoxColors.orange,
+            onSecondary: ProxmoxColors.supportGrey
+        ),
+      ),
       child: Scaffold(
         backgroundColor: ProxmoxColors.supportBlue,
         extendBodyBehindAppBar: true,
@@ -324,7 +333,7 @@ class _ProxmoxLoginPageState extends State<ProxmoxLoginPage> {
                                       child: Container(
                                         width:
                                             MediaQuery.of(context).size.width,
-                                        child: FlatButton(
+                                        child: TextButton(
                                           onPressed: _submittButtonEnabled
                                               ? () {
                                                   final isValid = _formKey
@@ -339,8 +348,6 @@ class _ProxmoxLoginPageState extends State<ProxmoxLoginPage> {
                                                   }
                                                 }
                                               : null,
-                                          color: ProxmoxColors.orange,
-                                          disabledColor: Colors.grey,
                                           child: Text('Continue'),
                                         ),
                                       ),
@@ -353,7 +360,7 @@ class _ProxmoxLoginPageState extends State<ProxmoxLoginPage> {
                                       child: Container(
                                         width:
                                             MediaQuery.of(context).size.width,
-                                        child: FlatButton(
+                                        child: TextButton(
                                           onPressed: _submittButtonEnabled
                                               ? () {
                                                   final isValid = _formKey
@@ -371,9 +378,7 @@ class _ProxmoxLoginPageState extends State<ProxmoxLoginPage> {
                                                   }
                                                 }
                                               : null,
-                                          color: ProxmoxColors.orange,
                                           child: Text('Continue'),
-                                          disabledColor: Colors.grey,
                                         ),
                                       ),
                                     ),
@@ -459,7 +464,7 @@ class _ProxmoxLoginPageState extends State<ProxmoxLoginPage> {
             content: Text(
                 'Proxmox VE version not supported, please update your instance to use this app.'),
             actions: [
-              FlatButton(
+              TextButton(
                 onPressed: () => Navigator.of(context).pop(),
                 child: Text('Close'),
               ),
@@ -532,7 +537,7 @@ class _ProxmoxLoginPageState extends State<ProxmoxLoginPage> {
             title: Text('Connection error'),
             content: Text('Could not establish connection.'),
             actions: [
-              FlatButton(
+              TextButton(
                 onPressed: () => Navigator.of(context).pop(),
                 child: Text('Close'),
               ),
@@ -616,7 +621,7 @@ class ProxmoxApiErrorDialog extends StatelessWidget {
         child: Text(exception.message),
       ),
       actions: [
-        FlatButton(
+        TextButton(
           onPressed: () => Navigator.of(context).pop(),
           child: Text('Close'),
         ),
@@ -648,11 +653,11 @@ class ProxmoxCertificateErrorDialog extends StatelessWidget {
         ),
       ),
       actions: [
-        FlatButton(
+        TextButton(
           onPressed: () => Navigator.of(context).pop(),
           child: Text('Close'),
         ),
-        FlatButton(
+        TextButton(
           onPressed: () => Navigator.of(context).pushReplacement(
               MaterialPageRoute(
                   builder: (context) => ProxmoxGeneralSettingsForm())),
index 3743455a68fcb5c21c7ecb43d312d6620d2d2713..945c75cb93b1a1306df0dae8be1db5b41d76b297 100644 (file)
@@ -81,11 +81,14 @@ class _ProxmoxTfaFormState extends State<ProxmoxTfaForm> {
                           alignment: Alignment.bottomCenter,
                           child: Container(
                             width: MediaQuery.of(context).size.width,
-                            child: FlatButton(
+                            child: TextButton(
+                              style: TextButton.styleFrom(
+                                foregroundColor: Colors.white,
+                                backgroundColor: Color(0xFFE47225),
+                                disabledBackgroundColor: Colors.grey,
+                              ),
                               onPressed: () => _submitTfaCode(),
-                              color: Color(0xFFE47225),
                               child: Text('Continue'),
-                              disabledColor: Colors.grey,
                             ),
                           ),
                         ),
@@ -129,7 +132,7 @@ class _ProxmoxTfaFormState extends State<ProxmoxTfaForm> {
           title: Text('Connection error'),
           content: Text('Could not establish connection.'),
           actions: [
-            FlatButton(
+            TextButton(
               onPressed: () => Navigator.of(context).pop(),
               child: Text('Close'),
             ),