[pve-devel] [PATCH pve-flutter-frontend 04/10] move to OutlinedButton from OutlineButton

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


flutter 3.0 removed OutlineButton in favor of OutlinedButton.
also change the default text color to white, and drop an unnecessary
padding in one case

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 lib/main.dart                                  | 10 ++++++++++
 .../firstWelcomeScreen/pve_welcome_faq.dart    |  8 +++++---
 .../firstWelcomeScreen/pve_welcome_last.dart   | 18 ++++++++++--------
 lib/widgets/pve_cd_selector_widget.dart        |  7 ++++---
 lib/widgets/pve_guest_backup_widget.dart       |  9 ++++-----
 lib/widgets/pve_main_navigation_drawer.dart    |  4 ++--
 .../pve_task_log_expansiontile_widget.dart     |  4 ++--
 7 files changed, 37 insertions(+), 23 deletions(-)

diff --git a/lib/main.dart b/lib/main.dart
index fca91c6..d467626 100644
--- a/lib/main.dart
+++ b/lib/main.dart
@@ -117,6 +117,11 @@ class MyApp extends StatelessWidget {
           textButtonTheme: TextButtonThemeData(
             style: TextButton.styleFrom(primary: ProxmoxColors.grey),
           ),
+          outlinedButtonTheme: OutlinedButtonThemeData(
+            style: OutlinedButton.styleFrom(
+              foregroundColor: Colors.black,
+            ),
+          ),
           fontFamily: "Open Sans",
           primaryTextTheme: TextTheme(
             headline6:
@@ -149,6 +154,11 @@ class MyApp extends StatelessWidget {
           textButtonTheme: TextButtonThemeData(
             style: TextButton.styleFrom(primary: ProxmoxColors.greyTint80),
           ),
+          outlinedButtonTheme: OutlinedButtonThemeData(
+            style: OutlinedButton.styleFrom(
+              foregroundColor: Colors.white,
+            ),
+          ),
           fontFamily: "Open Sans",
           primaryTextTheme: TextTheme(
             headline6:
diff --git a/lib/widgets/firstWelcomeScreen/pve_welcome_faq.dart b/lib/widgets/firstWelcomeScreen/pve_welcome_faq.dart
index 2e0e44e..470d118 100644
--- a/lib/widgets/firstWelcomeScreen/pve_welcome_faq.dart
+++ b/lib/widgets/firstWelcomeScreen/pve_welcome_faq.dart
@@ -42,14 +42,16 @@ class PveWelcomePageFAQ extends StatelessWidget {
               text:
                   'Currently only the following 3rd party Spice client works:'),
           Center(
-            child: OutlineButton(
+            child: OutlinedButton(
               onPressed: () => {
                 launch(
                     'https://play.google.com/store/apps/details?id=com.undatech.opaque')
               },
               child: Text('Opague'),
-              borderSide: BorderSide(color: ProxmoxColors.supportGrey),
-              textColor: Colors.white,
+              style: OutlinedButton.styleFrom(
+                side: BorderSide(color: ProxmoxColors.supportGrey),
+                foregroundColor: Colors.white,
+              ),
             ),
           ),
         ],
diff --git a/lib/widgets/firstWelcomeScreen/pve_welcome_last.dart b/lib/widgets/firstWelcomeScreen/pve_welcome_last.dart
index 5f135e0..3a6391e 100644
--- a/lib/widgets/firstWelcomeScreen/pve_welcome_last.dart
+++ b/lib/widgets/firstWelcomeScreen/pve_welcome_last.dart
@@ -57,23 +57,25 @@ class PveWelcomePageLast extends StatelessWidget {
                         Row(
                           mainAxisAlignment: MainAxisAlignment.spaceEvenly,
                           children: [
-                            OutlineButton(
+                            OutlinedButton(
                               onPressed: () =>
                                   {launch('https://forum.proxmox.com')},
                               child: Text('Forum'),
-                              borderSide:
-                                  BorderSide(color: ProxmoxColors.supportGrey),
-                              textColor: Colors.white,
+                              style: OutlinedButton.styleFrom(
+                                side: BorderSide(color: ProxmoxColors.supportGrey),
+                                foregroundColor: Colors.white,
+                              ),
                             ),
-                            OutlineButton(
+                            OutlinedButton(
                               onPressed: () => {
                                 launch(
                                     'https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-user')
                               },
                               child: Text('User Mailing List'),
-                              borderSide:
-                                  BorderSide(color: ProxmoxColors.supportGrey),
-                              textColor: Colors.white,
+                              style: OutlinedButton.styleFrom(
+                                side: BorderSide(color: ProxmoxColors.supportGrey),
+                                foregroundColor: Colors.white,
+                              ),
                             ),
                           ],
                         ),
diff --git a/lib/widgets/pve_cd_selector_widget.dart b/lib/widgets/pve_cd_selector_widget.dart
index c7600fe..cac5288 100644
--- a/lib/widgets/pve_cd_selector_widget.dart
+++ b/lib/widgets/pve_cd_selector_widget.dart
@@ -29,9 +29,10 @@ class PveCdSelector extends StatelessWidget {
                 onChanged: (value) => cdBloc.events.add(ChangeValue(value)),
               ),
               if (state.value == CdType.iso)
-                OutlineButton(
-                  borderSide:
-                      state.hasError ? BorderSide(color: Colors.red) : null,
+                OutlinedButton(
+                  style: OutlinedButton.styleFrom(
+                    side: state.hasError ? BorderSide(color: Colors.red) : null,
+                  ),
                   child: Text((state.file == null || state.file!.isEmpty)
                       ? "Choose File"
                       : state.file!),
diff --git a/lib/widgets/pve_guest_backup_widget.dart b/lib/widgets/pve_guest_backup_widget.dart
index 72a81c4..b766efb 100644
--- a/lib/widgets/pve_guest_backup_widget.dart
+++ b/lib/widgets/pve_guest_backup_widget.dart
@@ -258,13 +258,12 @@ class PveGuestBackupContent extends StatelessWidget {
                 child: Padding(
                   padding: const EdgeInsets.all(8.0),
                   child: ListView(children: [
-                    OutlineButton.icon(
-                      padding: EdgeInsets.symmetric(horizontal: 8),
+                    OutlinedButton.icon(
                       onPressed: null,
                       icon: Icon(Icons.restore),
                       label: Text("Restore"),
                     ),
-                    OutlineButton.icon(
+                    OutlinedButton.icon(
                       onPressed: () async {
                         final guard = await (_showConfirmDialog(
                                 context,
@@ -279,7 +278,7 @@ class PveGuestBackupContent extends StatelessWidget {
                       icon: Icon(Icons.delete),
                       label: Text("Remove"),
                     ),
-                    OutlineButton.icon(
+                    OutlinedButton.icon(
                       onPressed: () =>
                           _showConfigurationDialog(context, fBloc, volid),
                       icon: Icon(Icons.featured_play_list),
@@ -462,7 +461,7 @@ class _PveBackupFormState extends State<PveBackupForm> {
                     return null;
                   },
                 ),
-                OutlineButton.icon(
+                OutlinedButton.icon(
                     onPressed: enableSubmitButton
                         ? () {
                             //TODO remove when async validation is implemented
diff --git a/lib/widgets/pve_main_navigation_drawer.dart b/lib/widgets/pve_main_navigation_drawer.dart
index 57ad0ce..757d05e 100644
--- a/lib/widgets/pve_main_navigation_drawer.dart
+++ b/lib/widgets/pve_main_navigation_drawer.dart
@@ -130,14 +130,14 @@ class PveMainNavigationDrawer extends StatelessWidget {
                       Row(
                         mainAxisAlignment: MainAxisAlignment.spaceEvenly,
                         children: <Widget>[
-                          OutlineButton(
+                          OutlinedButton(
                             child: Text("new VM"),
                             onPressed: () {
                               Navigator.pushNamed(context, '/qemu/create');
                             },
                           ),
                           // TODO General new button or distinct ones??
-                          OutlineButton(
+                          OutlinedButton(
                             child: Text("new CT"),
                             onPressed: null,
                           )
diff --git a/lib/widgets/pve_task_log_expansiontile_widget.dart b/lib/widgets/pve_task_log_expansiontile_widget.dart
index 03ed1bf..dabe309 100644
--- a/lib/widgets/pve_task_log_expansiontile_widget.dart
+++ b/lib/widgets/pve_task_log_expansiontile_widget.dart
@@ -108,13 +108,13 @@ class _PveTaskExpansionTileState extends State<PveTaskExpansionTile> {
         ButtonBar(
           children: <Widget>[
             if (widget.showMorePage != null)
-              OutlineButton.icon(
+              OutlinedButton.icon(
                 onPressed: () => Navigator.of(context).push(
                     _createTaskLogRoute(taskLogBloc, widget.showMorePage)),
                 icon: Icon(Icons.format_list_bulleted),
                 label: Text('More Tasks'),
               ),
-            OutlineButton.icon(
+            OutlinedButton.icon(
               onPressed: () => showTaskLogBottomSheet(context,
                   taskLogBloc.apiClient, widget.task.node, widget.task.upid),
               icon: Icon(Icons.article),
-- 
2.30.2






More information about the pve-devel mailing list