[pve-devel] [PATCH pve-flutter-frontend 05/10] move to TextButton from FlatButton

Dominik Csapak d.csapak at proxmox.com
Thu Sep 8 11:55:45 CEST 2022


flutter 3.0 removed FlatButton

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 lib/pages/main_layout_slim.dart               |  2 +-
 lib/widgets/pve_console_menu_widget.dart      |  4 +--
 lib/widgets/pve_first_welcome_screen.dart     | 32 ++++++++++++-------
 lib/widgets/pve_guest_backup_widget.dart      |  6 ++--
 .../pve_subscription_alert_dialog.dart        |  2 +-
 5 files changed, 27 insertions(+), 19 deletions(-)

diff --git a/lib/pages/main_layout_slim.dart b/lib/pages/main_layout_slim.dart
index 9839428..ba95fe8 100644
--- a/lib/pages/main_layout_slim.dart
+++ b/lib/pages/main_layout_slim.dart
@@ -853,7 +853,7 @@ class _MobileResourceFilterSheet extends StatelessWidget {
                     'Filter Results',
                   ),
                   trailing: rBloc.isFiltered
-                      ? FlatButton(
+                      ? TextButton(
                           onPressed: () => rBloc.events.add(ResetFilter()),
                           child: Text(
                             'Reset',
diff --git a/lib/widgets/pve_console_menu_widget.dart b/lib/widgets/pve_console_menu_widget.dart
index 17be9a3..ac5ad26 100644
--- a/lib/widgets/pve_console_menu_widget.dart
+++ b/lib/widgets/pve_console_menu_widget.dart
@@ -83,7 +83,7 @@ class PveConsoleMenu extends StatelessWidget {
                               title: Text('Got Exception'),
                               content: Text(e.message!),
                               actions: [
-                                FlatButton(
+                                TextButton(
                                     onPressed: () =>
                                         Navigator.of(context).pop(),
                                     child: Text('Close'))
@@ -154,7 +154,7 @@ class PveConsoleMenu extends StatelessWidget {
         title: Text(title),
         content: Text(content),
         actions: [
-          FlatButton(
+          TextButton(
               onPressed: () => Navigator.of(context).pop(),
               child: Text('Close'))
         ],
diff --git a/lib/widgets/pve_first_welcome_screen.dart b/lib/widgets/pve_first_welcome_screen.dart
index 3a09943..46d2ee0 100644
--- a/lib/widgets/pve_first_welcome_screen.dart
+++ b/lib/widgets/pve_first_welcome_screen.dart
@@ -67,9 +67,11 @@ class _PveWelcomeState extends State<PveWelcome> with TickerProviderStateMixin {
 
   Widget nextDoneButton() {
     if (_isLast) {
-      return FlatButton(
-        textColor: _buttonTextColor,
-        disabledTextColor: _buttonDisabledTextColor,
+      return TextButton(
+        style: TextButton.styleFrom(
+          foregroundColor: _buttonTextColor,
+          disabledForegroundColor: _buttonDisabledTextColor,
+        ),
         child: Text(
           "Done",
         ),
@@ -78,10 +80,12 @@ class _PveWelcomeState extends State<PveWelcome> with TickerProviderStateMixin {
         },
       );
     } else {
-      return FlatButton(
+      return TextButton(
         child: Text("Next"),
-        textColor: _buttonTextColor,
-        disabledTextColor: _buttonDisabledTextColor,
+        style: TextButton.styleFrom(
+          foregroundColor: _buttonTextColor,
+          disabledForegroundColor: _buttonDisabledTextColor,
+        ),
         onPressed: () {
           _controller!
               .nextPage(duration: _pageChangeDuration, curve: _pageChangeCurve);
@@ -92,9 +96,11 @@ class _PveWelcomeState extends State<PveWelcome> with TickerProviderStateMixin {
 
   Widget skipPrevButton() {
     if (_isFirst) {
-      return FlatButton(
-        textColor: _buttonTextColor,
-        disabledTextColor: _buttonDisabledTextColor,
+      return TextButton(
+        style: TextButton.styleFrom(
+          foregroundColor: _buttonTextColor,
+          disabledForegroundColor: _buttonDisabledTextColor,
+        ),
         onPressed: () {
           skipDone();
         },
@@ -103,9 +109,11 @@ class _PveWelcomeState extends State<PveWelcome> with TickerProviderStateMixin {
         ),
       );
     } else {
-      return FlatButton(
-        textColor: _buttonTextColor,
-        disabledTextColor: _buttonDisabledTextColor,
+      return TextButton(
+        style: TextButton.styleFrom(
+          foregroundColor: _buttonTextColor,
+          disabledForegroundColor: _buttonDisabledTextColor,
+        ),
         child: Text(
           "Prev",
         ),
diff --git a/lib/widgets/pve_guest_backup_widget.dart b/lib/widgets/pve_guest_backup_widget.dart
index b766efb..e6aebde 100644
--- a/lib/widgets/pve_guest_backup_widget.dart
+++ b/lib/widgets/pve_guest_backup_widget.dart
@@ -302,14 +302,14 @@ class PveGuestBackupContent extends StatelessWidget {
         title: Text(title),
         content: Text(body),
         actions: [
-          FlatButton(
+          TextButton(
             onPressed: () => Navigator.of(context).pop(false),
             child: Text(
               'Cancel',
               style: TextStyle(fontWeight: FontWeight.bold),
             ),
           ),
-          FlatButton(
+          TextButton(
             onPressed: () => Navigator.of(context).pop(true),
             child: Text(
               'Confirm',
@@ -371,7 +371,7 @@ class _PveConfigurationDialogState extends State<PveConfigurationDialog> {
                 child: CircularProgressIndicator(),
               ),
         actions: [
-          FlatButton(
+          TextButton(
             onPressed: () => Navigator.of(context).pop(true),
             child: Text(
               'Close',
diff --git a/lib/widgets/pve_subscription_alert_dialog.dart b/lib/widgets/pve_subscription_alert_dialog.dart
index df880f7..e5d85a4 100644
--- a/lib/widgets/pve_subscription_alert_dialog.dart
+++ b/lib/widgets/pve_subscription_alert_dialog.dart
@@ -11,7 +11,7 @@ class PveSubscriptionAlertDialog extends StatelessWidget {
           ' software and getting stable updates and security enhancements,'
           ' as well as quick enterprise support.\n\nPlease consider to buy a subscription.'),
       actions: [
-        FlatButton(
+        TextButton(
             onPressed: () async {
               final url = 'https://www.proxmox.com/proxmox-ve/pricing';
               if (await canLaunch(url)) {
-- 
2.30.2






More information about the pve-devel mailing list