public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH pve_flutter_frontend 0/4] fix: add fix for dart-analyze issues and replace deprecated APIs
@ 2025-09-24 10:36 Shan Shaji
  2025-09-24 10:36 ` [pve-devel] [PATCH pve_flutter_frontend 1/4] fix: run `dart fix` to fix the problems identified by diagnostic Shan Shaji
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Shan Shaji @ 2025-09-24 10:36 UTC (permalink / raw)
  To: pve-devel

After upgrading to Flutter v3.35, the dart analyze command reported 
several issues. This patch series resolves them by applying `dart fix`
to automatically correct issues where possible. For cases where 
automated fixes were not available, I manually replaced deprecated 
APIs and addressed linting errors.

Shan Shaji (4):
  fix: run `dart fix` to fix the problems identified by diagnostic
  cleanup: dart-analyze: add explicit type annotation
  fix: dart-analyze: remove deprecated props and use `RadioGroup`
  chore: add upper bound flutter constraint and update dart sdk
    constraint

 lib/main.dart                                 |  4 ++--
 lib/pages/main_layout_slim.dart               |  5 ++++-
 lib/utils/validators.dart                     |  8 ++++----
 lib/widgets/pve_bridge_selector_widget.dart   |  2 +-
 lib/widgets/pve_cd_selector_widget.dart       | 13 +++++--------
 lib/widgets/pve_guest_backup_widget.dart      |  4 ++--
 lib/widgets/pve_guest_migrate_widget.dart     |  2 +-
 lib/widgets/pve_guest_os_selector_widget.dart |  2 +-
 lib/widgets/pve_network_model_selector.dart   |  2 +-
 lib/widgets/pve_storage_selector_widget.dart  |  2 +-
 lib/widgets/pve_task_log_widget.dart          |  2 +-
 pubspec.lock                                  |  2 +-
 pubspec.yaml                                  |  3 ++-
 13 files changed, 26 insertions(+), 25 deletions(-)

-- 
2.47.2



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [pve-devel] [PATCH pve_flutter_frontend 1/4] fix: run `dart fix` to fix the problems identified by diagnostic
  2025-09-24 10:36 [pve-devel] [PATCH pve_flutter_frontend 0/4] fix: add fix for dart-analyze issues and replace deprecated APIs Shan Shaji
@ 2025-09-24 10:36 ` Shan Shaji
  2025-09-24 10:36 ` [pve-devel] [PATCH pve_flutter_frontend 2/4] cleanup: dart-analyze: add explicit type annotation Shan Shaji
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Shan Shaji @ 2025-09-24 10:36 UTC (permalink / raw)
  To: pve-devel

After the update to v3.35, `dart analyze` has reported some "problems"
which were identfied by the diagnostic. Fixed problems which had
associated fixes by running `dart fix`.

Signed-off-by: Shan Shaji <s.shaji@proxmox.com>
---
 lib/main.dart                                 | 4 ++--
 lib/utils/validators.dart                     | 8 ++++----
 lib/widgets/pve_bridge_selector_widget.dart   | 2 +-
 lib/widgets/pve_guest_backup_widget.dart      | 4 ++--
 lib/widgets/pve_guest_migrate_widget.dart     | 2 +-
 lib/widgets/pve_guest_os_selector_widget.dart | 2 +-
 lib/widgets/pve_network_model_selector.dart   | 2 +-
 lib/widgets/pve_storage_selector_widget.dart  | 2 +-
 lib/widgets/pve_task_log_widget.dart          | 2 +-
 9 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/lib/main.dart b/lib/main.dart
index 0ffcae7..7328057 100644
--- a/lib/main.dart
+++ b/lib/main.dart
@@ -112,7 +112,6 @@ class MyApp extends StatelessWidget {
             surfaceContainer: ProxmoxColors.supportGreyTint75,
             onSurfaceVariant: Colors.black,
           ),
-          indicatorColor: ProxmoxColors.orange,
           textButtonTheme: TextButtonThemeData(
             style: TextButton.styleFrom(foregroundColor: ProxmoxColors.grey),
           ),
@@ -135,6 +134,7 @@ class MyApp extends StatelessWidget {
             selectionHandleColor: ProxmoxColors.orange,
             cursorColor: ProxmoxColors.orange,
           ),
+          tabBarTheme: TabBarThemeData(indicatorColor: ProxmoxColors.orange),
         ),
         darkTheme: ThemeData(
           colorScheme: ColorScheme.fromSeed(
@@ -151,7 +151,6 @@ class MyApp extends StatelessWidget {
             surfaceContainer: ProxmoxColors.grey,
             onSurfaceVariant: ProxmoxColors.supportGreyTint75,
           ),
-          indicatorColor: ProxmoxColors.orange,
           // flutter has a weird logic where it pulls colors from different
           // scheme properties depending on light/dark mode, avoid that...
           appBarTheme: const AppBarTheme(
@@ -178,6 +177,7 @@ class MyApp extends StatelessWidget {
             selectionHandleColor: ProxmoxColors.orange,
             cursorColor: ProxmoxColors.orange,
           ),
+          tabBarTheme: TabBarThemeData(indicatorColor: ProxmoxColors.orange),
         ),
         builder: (context, child) {
           return StreamListener(
diff --git a/lib/utils/validators.dart b/lib/utils/validators.dart
index 9c2d859..fa4bf95 100644
--- a/lib/utils/validators.dart
+++ b/lib/utils/validators.dart
@@ -12,19 +12,19 @@ class Validators {
   static final RegExp _ipv4RegExp =
       RegExp("^(?:(?:(?:$ipv4Octet\\.){3}$ipv4Octet))\$");
 
-  static isValidEmail(String email) {
+  static bool isValidEmail(String email) {
     return _emailRegExp.hasMatch(email);
   }
 
-  static isValidPassword(String password) {
+  static bool isValidPassword(String password) {
     return _passwordRegExp.hasMatch(password);
   }
 
-  static isValidDnsName(String name) {
+  static bool isValidDnsName(String name) {
     return _dnsExp.hasMatch(name);
   }
 
-  static isValidIPV4(String ip) {
+  static bool isValidIPV4(String ip) {
     return _ipv4RegExp.hasMatch(ip);
   }
 }
diff --git a/lib/widgets/pve_bridge_selector_widget.dart b/lib/widgets/pve_bridge_selector_widget.dart
index dcf5890..9d29e98 100644
--- a/lib/widgets/pve_bridge_selector_widget.dart
+++ b/lib/widgets/pve_bridge_selector_widget.dart
@@ -41,7 +41,7 @@ class PveBridgeSelector extends StatelessWidget {
             ],
             onChanged: (PveNodeNetworkModel? selection) =>
                 bBloc.events.add(BridgeSelectedEvent(selection)),
-            value: state.value,
+            initialValue: state.value,
             autovalidateMode: AutovalidateMode.onUserInteraction,
             validator: (dynamic _) {
               return state.errorText;
diff --git a/lib/widgets/pve_guest_backup_widget.dart b/lib/widgets/pve_guest_backup_widget.dart
index 7bd38d4..4966e9d 100644
--- a/lib/widgets/pve_guest_backup_widget.dart
+++ b/lib/widgets/pve_guest_backup_widget.dart
@@ -545,7 +545,7 @@ class _PveBackupFormState extends State<PveBackupForm> {
       onChanged: (PveVZDumpModeType? selection) => setState(() {
         mode = selection;
       }),
-      value: mode,
+      initialValue: mode,
       autovalidateMode: AutovalidateMode.onUserInteraction,
     );
   }
@@ -566,7 +566,7 @@ class _PveBackupFormState extends State<PveBackupForm> {
       onChanged: (PveVZDumpCompressionType? selection) => setState(() {
         compression = selection;
       }),
-      value: compression,
+      initialValue: compression,
       autovalidateMode: AutovalidateMode.onUserInteraction,
     );
   }
diff --git a/lib/widgets/pve_guest_migrate_widget.dart b/lib/widgets/pve_guest_migrate_widget.dart
index c57ee22..cb6cd38 100644
--- a/lib/widgets/pve_guest_migrate_widget.dart
+++ b/lib/widgets/pve_guest_migrate_widget.dart
@@ -200,7 +200,7 @@ class _MigrateTargetSelector extends StatelessWidget {
                     migrateBloc.events
                         .add(MigrationTargetChanged(selectedNode));
                   },
-            value: state.selectedNode?.nodeName,
+            initialValue: state.selectedNode?.nodeName,
             isExpanded: true,
           ),
         );
diff --git a/lib/widgets/pve_guest_os_selector_widget.dart b/lib/widgets/pve_guest_os_selector_widget.dart
index b9f83a8..2b3bd82 100644
--- a/lib/widgets/pve_guest_os_selector_widget.dart
+++ b/lib/widgets/pve_guest_os_selector_widget.dart
@@ -31,7 +31,7 @@ class PveGuestOsSelector extends StatelessWidget {
             onChanged: (choice) {
               gBloc.events.add(ChangeOsType(choice));
             },
-            value: snapshot.data?.value,
+            initialValue: snapshot.data?.value,
             validator: (_) => snapshot.data?.errorText,
             autovalidateMode: AutovalidateMode.onUserInteraction,
           );
diff --git a/lib/widgets/pve_network_model_selector.dart b/lib/widgets/pve_network_model_selector.dart
index 31c8d34..6e77e52 100644
--- a/lib/widgets/pve_network_model_selector.dart
+++ b/lib/widgets/pve_network_model_selector.dart
@@ -46,7 +46,7 @@ class _PveNetworkInterfaceModelSelectorState
         });
         widget.onChange!(selection);
       },
-      value: selection ?? widget.initialSelection,
+      initialValue: selection ?? widget.initialSelection,
     );
   }
 }
diff --git a/lib/widgets/pve_storage_selector_widget.dart b/lib/widgets/pve_storage_selector_widget.dart
index 66d4a33..0cac29e 100644
--- a/lib/widgets/pve_storage_selector_widget.dart
+++ b/lib/widgets/pve_storage_selector_widget.dart
@@ -66,7 +66,7 @@ class PveStorageSelectorDropdown extends StatelessWidget {
                   .add(StorageSelectedEvent(storage: selectedStorage)),
           selectedItemBuilder: (context) =>
               state.storages.map((item) => Text(item.id)).toList(),
-          value: state.selected,
+          initialValue: state.selected,
           autovalidateMode: AutovalidateMode.onUserInteraction,
           validator: (dynamic value) {
             if (state.errorMessage.isNotEmpty) {
diff --git a/lib/widgets/pve_task_log_widget.dart b/lib/widgets/pve_task_log_widget.dart
index 292e499..5e9e733 100644
--- a/lib/widgets/pve_task_log_widget.dart
+++ b/lib/widgets/pve_task_log_widget.dart
@@ -94,7 +94,7 @@ class _PveTaskLogState extends State<PveTaskLog> {
                     ),
                     DropdownButtonFormField<String>(
                       decoration: const InputDecoration(labelText: 'Source'),
-                      value: state.source,
+                      initialValue: state.source,
                       icon: const Icon(Icons.arrow_downward),
                       iconSize: 24,
                       elevation: 16,
-- 
2.47.2



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [pve-devel] [PATCH pve_flutter_frontend 2/4] cleanup: dart-analyze: add explicit type annotation
  2025-09-24 10:36 [pve-devel] [PATCH pve_flutter_frontend 0/4] fix: add fix for dart-analyze issues and replace deprecated APIs Shan Shaji
  2025-09-24 10:36 ` [pve-devel] [PATCH pve_flutter_frontend 1/4] fix: run `dart fix` to fix the problems identified by diagnostic Shan Shaji
@ 2025-09-24 10:36 ` Shan Shaji
  2025-09-24 10:36 ` [pve-devel] [PATCH pve_flutter_frontend 3/4] fix: dart-analyze: remove deprecated props and use `RadioGroup` Shan Shaji
  2025-09-24 10:36 ` [pve-devel] [PATCH pve_flutter_frontend 4/4] chore: add upper bound flutter constraint and update dart sdk constraint Shan Shaji
  3 siblings, 0 replies; 5+ messages in thread
From: Shan Shaji @ 2025-09-24 10:36 UTC (permalink / raw)
  To: pve-devel

The lint warns about every omitted return type, parameter type, and
variable type of a top-level declaration. Inorder to fix the issue add
explicit type annotation.

Signed-off-by: Shan Shaji <s.shaji@proxmox.com>
---
 lib/pages/main_layout_slim.dart | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/lib/pages/main_layout_slim.dart b/lib/pages/main_layout_slim.dart
index 14a2bca..0aca666 100644
--- a/lib/pages/main_layout_slim.dart
+++ b/lib/pages/main_layout_slim.dart
@@ -103,7 +103,10 @@ class _MainLayoutSlimState extends State<MainLayoutSlim> {
   }
 }
 
-Widget getMainContent(snapshot, context) {
+Widget getMainContent(
+  AsyncSnapshot<int> snapshot,
+  BuildContext context,
+) {
   if (snapshot.hasData) {
     switch (snapshot.data) {
       case 0:
-- 
2.47.2



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [pve-devel] [PATCH pve_flutter_frontend 3/4] fix: dart-analyze: remove deprecated props and use `RadioGroup`
  2025-09-24 10:36 [pve-devel] [PATCH pve_flutter_frontend 0/4] fix: add fix for dart-analyze issues and replace deprecated APIs Shan Shaji
  2025-09-24 10:36 ` [pve-devel] [PATCH pve_flutter_frontend 1/4] fix: run `dart fix` to fix the problems identified by diagnostic Shan Shaji
  2025-09-24 10:36 ` [pve-devel] [PATCH pve_flutter_frontend 2/4] cleanup: dart-analyze: add explicit type annotation Shan Shaji
@ 2025-09-24 10:36 ` Shan Shaji
  2025-09-24 10:36 ` [pve-devel] [PATCH pve_flutter_frontend 4/4] chore: add upper bound flutter constraint and update dart sdk constraint Shan Shaji
  3 siblings, 0 replies; 5+ messages in thread
From: Shan Shaji @ 2025-09-24 10:36 UTC (permalink / raw)
  To: pve-devel

Starting from flutter v3.32 [0] the `groupValue` and `onChanged` has
been deprecated from `RadioListTile` and need to use `RadioGroup`
widget. Fixed the issue by wrapping the group of `RadioListTile`
widgets with `RadioGroup` [1].

- [0] http://api.flutter.dev/flutter/material/RadioListTile/groupValue.html
- [1] https://api.flutter.dev/flutter/widgets/RadioGroup-class.html

Signed-off-by: Shan Shaji <s.shaji@proxmox.com>
---
 lib/widgets/pve_cd_selector_widget.dart | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/lib/widgets/pve_cd_selector_widget.dart b/lib/widgets/pve_cd_selector_widget.dart
index d1f260e..b4591d0 100644
--- a/lib/widgets/pve_cd_selector_widget.dart
+++ b/lib/widgets/pve_cd_selector_widget.dart
@@ -22,12 +22,13 @@ class PveCdSelector extends StatelessWidget {
         builder: (context, snapshot) {
           if (snapshot.hasData) {
             final state = snapshot.data!;
-            return Column(children: [
+            return RadioGroup(
+              groupValue: state.value,
+              onChanged: (value) => cdBloc.events.add(ChangeValue(value)),
+              child: Column(children: [
               RadioListTile<CdType>(
                 title: const Text('Use CD/DVD disc image file (iso)'),
                 value: CdType.iso,
-                groupValue: state.value,
-                onChanged: (value) => cdBloc.events.add(ChangeValue(value)),
               ),
               if (state.value == CdType.iso)
                 OutlinedButton(
@@ -63,16 +64,12 @@ class PveCdSelector extends StatelessWidget {
               RadioListTile<CdType>(
                 title: const Text('Use physical CD/DVD Drive'),
                 value: CdType.cdrom,
-                groupValue: state.value,
-                onChanged: (value) => cdBloc.events.add(ChangeValue(value)),
               ),
               RadioListTile<CdType>(
                 title: const Text('Do not use any media'),
                 value: CdType.none,
-                groupValue: state.value,
-                onChanged: (value) => cdBloc.events.add(ChangeValue(value)),
               ),
-            ]);
+            ]));
           }
 
           return Container();
-- 
2.47.2



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [pve-devel] [PATCH pve_flutter_frontend 4/4] chore: add upper bound flutter constraint and update dart sdk constraint
  2025-09-24 10:36 [pve-devel] [PATCH pve_flutter_frontend 0/4] fix: add fix for dart-analyze issues and replace deprecated APIs Shan Shaji
                   ` (2 preceding siblings ...)
  2025-09-24 10:36 ` [pve-devel] [PATCH pve_flutter_frontend 3/4] fix: dart-analyze: remove deprecated props and use `RadioGroup` Shan Shaji
@ 2025-09-24 10:36 ` Shan Shaji
  3 siblings, 0 replies; 5+ messages in thread
From: Shan Shaji @ 2025-09-24 10:36 UTC (permalink / raw)
  To: pve-devel

Starting form language version 3.9, the flutter constrain upper bound is
now respected in the root package. Setting the flutter constraint can be
usefull to ensure everyone will use the same SDK.

Signed-off-by: Shan Shaji <s.shaji@proxmox.com>
---
 pubspec.lock | 2 +-
 pubspec.yaml | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/pubspec.lock b/pubspec.lock
index 862241e..4f51e63 100644
--- a/pubspec.lock
+++ b/pubspec.lock
@@ -909,4 +909,4 @@ packages:
     version: "3.1.3"
 sdks:
   dart: ">=3.9.0 <4.0.0"
-  flutter: ">=3.35.0"
+  flutter: "3.35.0"
diff --git a/pubspec.yaml b/pubspec.yaml
index a4d5b69..e447377 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -15,7 +15,8 @@ publish_to: none
 version: 1.8.1+46
 
 environment:
-  sdk: '>=3.0.0 <4.0.0'
+  sdk: '>=3.9.0 <4.0.0'
+  flutter: 3.35.0
 
 dependencies:
   flutter:
-- 
2.47.2



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-09-24 10:36 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-09-24 10:36 [pve-devel] [PATCH pve_flutter_frontend 0/4] fix: add fix for dart-analyze issues and replace deprecated APIs Shan Shaji
2025-09-24 10:36 ` [pve-devel] [PATCH pve_flutter_frontend 1/4] fix: run `dart fix` to fix the problems identified by diagnostic Shan Shaji
2025-09-24 10:36 ` [pve-devel] [PATCH pve_flutter_frontend 2/4] cleanup: dart-analyze: add explicit type annotation Shan Shaji
2025-09-24 10:36 ` [pve-devel] [PATCH pve_flutter_frontend 3/4] fix: dart-analyze: remove deprecated props and use `RadioGroup` Shan Shaji
2025-09-24 10:36 ` [pve-devel] [PATCH pve_flutter_frontend 4/4] chore: add upper bound flutter constraint and update dart sdk constraint Shan Shaji

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal