From bb8a29651b371166131e8254afa36550802c8f8a Mon Sep 17 00:00:00 2001 From: provokateurin Date: Sat, 6 Apr 2024 01:50:08 +0200 Subject: [PATCH] refactor: Stop using spread list operator Signed-off-by: provokateurin --- packages/dynamite/dynamite/lib/src/builder/client.dart | 3 +-- packages/file_icons/bin/file_icons.dart | 9 +++------ packages/neon/neon_files/lib/src/pages/details.dart | 3 +-- .../neon/neon_news/lib/src/widgets/articles_view.dart | 7 ++----- .../lib/src/pages/app_implementation_settings.dart | 10 +++------- .../lib/src/pages/login_check_account.dart | 3 +-- .../lib/src/pages/login_check_server_status.dart | 3 +-- packages/neon_framework/lib/src/pages/settings.dart | 9 +++------ packages/neon_framework/lib/src/widgets/app_bar.dart | 3 +-- 9 files changed, 16 insertions(+), 34 deletions(-) diff --git a/packages/dynamite/dynamite/lib/src/builder/client.dart b/packages/dynamite/dynamite/lib/src/builder/client.dart index 4c6b3674438..5b3a3db8626 100644 --- a/packages/dynamite/dynamite/lib/src/builder/client.dart +++ b/packages/dynamite/dynamite/lib/src/builder/client.dart @@ -74,14 +74,13 @@ Class buildRootClient( ..toSuper = true ..named = true, ), - if (spec.hasAnySecurity) ...[ + if (spec.hasAnySecurity) Parameter( (b) => b ..name = 'authentications' ..toSuper = true ..named = true, ), - ], ]), ), Constructor( diff --git a/packages/file_icons/bin/file_icons.dart b/packages/file_icons/bin/file_icons.dart index 07a87247e73..6f1668a40ee 100644 --- a/packages/file_icons/bin/file_icons.dart +++ b/packages/file_icons/bin/file_icons.dart @@ -99,15 +99,12 @@ void generateData() { '', '// Code points', // This filters unused code points. - for (final type in codePoints.keys - .where((type) => iconSet.keys.map((pattern) => iconSet[pattern]![0] == type).contains(true))) ...[ + for (final type + in codePoints.keys.where((type) => iconSet.keys.map((pattern) => iconSet[pattern]![0] == type).contains(true))) 'const ${_toVariableName(type)} = ${codePoints[type]};', - ], '', '// Colors', - for (final colorName in colors.keys) ...[ - 'const ${_toVariableName(colorName)} = ${colors[colorName]};', - ], + for (final colorName in colors.keys) 'const ${_toVariableName(colorName)} = ${colors[colorName]};', '', "const _fontFamily = 'Seti';", "const _fontPackage = 'file_icons';", diff --git a/packages/neon/neon_files/lib/src/pages/details.dart b/packages/neon/neon_files/lib/src/pages/details.dart index ddeb7a7d4df..6f2bdff3df4 100644 --- a/packages/neon/neon_files/lib/src/pages/details.dart +++ b/packages/neon/neon_files/lib/src/pages/details.dart @@ -66,14 +66,13 @@ class FilesDetailsPage extends StatelessWidget { ? NeonLocalizations.of(context).actionYes : NeonLocalizations.of(context).actionNo, }, - }.entries) ...[ + }.entries) DataRow( cells: [ DataCell(Text(entry.key)), DataCell(Text(entry.value)), ], ), - ], ], ), ], diff --git a/packages/neon/neon_news/lib/src/widgets/articles_view.dart b/packages/neon/neon_news/lib/src/widgets/articles_view.dart index b7cad2fa6eb..f1e08bedcbd 100644 --- a/packages/neon/neon_news/lib/src/widgets/articles_view.dart +++ b/packages/neon/neon_news/lib/src/widgets/articles_view.dart @@ -89,9 +89,7 @@ class _NewsArticlesViewState extends State { items: [ FilterType.all, FilterType.unread, - if (widget.bloc.listType == null) ...[ - FilterType.starred, - ], + if (widget.bloc.listType == null) FilterType.starred, ].map( (a) { late final String label; @@ -141,13 +139,12 @@ class _NewsArticlesViewState extends State { : Theme.of(context).textTheme.titleMedium!.copyWith(color: Theme.of(context).disabledColor), ), ), - if (article.mediaThumbnail != null) ...[ + if (article.mediaThumbnail != null) NeonUriImage( uri: Uri.parse(article.mediaThumbnail!), size: const Size(100, 50), fit: BoxFit.cover, ), - ], ], ), subtitle: Row( diff --git a/packages/neon_framework/lib/src/pages/app_implementation_settings.dart b/packages/neon_framework/lib/src/pages/app_implementation_settings.dart index 21f029734cf..0b35da8d5d8 100644 --- a/packages/neon_framework/lib/src/pages/app_implementation_settings.dart +++ b/packages/neon_framework/lib/src/pages/app_implementation_settings.dart @@ -49,21 +49,17 @@ class AppImplementationSettingsPage extends StatelessWidget { final body = SettingsList( categories: [ - for (final category in [...appImplementation.options.categories, null]) ...[ - if (appImplementation.options.options.where((option) => option.category == category).isNotEmpty) ...[ + for (final category in [...appImplementation.options.categories, null]) + if (appImplementation.options.options.where((option) => option.category == category).isNotEmpty) SettingsCategory( title: Text( category != null ? category.name(context) : NeonLocalizations.of(context).optionsCategoryOther, ), tiles: [ - for (final option - in appImplementation.options.options.where((option) => option.category == category)) ...[ + for (final option in appImplementation.options.options.where((option) => option.category == category)) OptionSettingsTile(option: option), - ], ], ), - ], - ], ], ); diff --git a/packages/neon_framework/lib/src/pages/login_check_account.dart b/packages/neon_framework/lib/src/pages/login_check_account.dart index 53ba3b66cb3..3641d5b0cf1 100644 --- a/packages/neon_framework/lib/src/pages/login_check_account.dart +++ b/packages/neon_framework/lib/src/pages/login_check_account.dart @@ -66,7 +66,7 @@ class _LoginCheckAccountPageState extends State { builder: (context, state) => Column( mainAxisAlignment: MainAxisAlignment.center, children: [ - if (state.hasError) ...[ + if (state.hasError) Builder( builder: (context) { final details = NeonError.getDetails(state.error); @@ -78,7 +78,6 @@ class _LoginCheckAccountPageState extends State { ); }, ), - ], _buildAccountTile(state), Align( alignment: Alignment.bottomRight, diff --git a/packages/neon_framework/lib/src/pages/login_check_server_status.dart b/packages/neon_framework/lib/src/pages/login_check_server_status.dart index 8722650ab6d..696c1e2595c 100644 --- a/packages/neon_framework/lib/src/pages/login_check_server_status.dart +++ b/packages/neon_framework/lib/src/pages/login_check_server_status.dart @@ -70,12 +70,11 @@ class _LoginCheckServerStatusPageState extends State return Column( mainAxisAlignment: MainAxisAlignment.center, children: [ - if (state.hasError) ...[ + if (state.hasError) NeonValidationTile( title: NeonError.getDetails(state.error).getText(context), state: ValidationState.failure, ), - ], _buildServerVersionTile(state), _buildMaintenanceModeTile(state), Align( diff --git a/packages/neon_framework/lib/src/pages/settings.dart b/packages/neon_framework/lib/src/pages/settings.dart index 1f86f8459d6..f7e3616ec3a 100644 --- a/packages/neon_framework/lib/src/pages/settings.dart +++ b/packages/neon_framework/lib/src/pages/settings.dart @@ -135,8 +135,8 @@ class _SettingsPageState extends State { title: Text(NeonLocalizations.of(context).settingsApps), key: ValueKey(SettingsCategories.apps.name), tiles: [ - for (final appImplementation in appImplementations) ...[ - if (appImplementation.options.options.isNotEmpty) ...[ + for (final appImplementation in appImplementations) + if (appImplementation.options.options.isNotEmpty) CustomSettingsTile( leading: appImplementation.buildIcon(), title: Text(appImplementation.name(context)), @@ -144,8 +144,6 @@ class _SettingsPageState extends State { AppImplementationSettingsRoute(appid: appImplementation.id).go(context); }, ), - ], - ], ], ), SettingsCategory( @@ -176,7 +174,7 @@ class _SettingsPageState extends State { ], ), if (NeonPlatform.instance.canUsePushNotifications) buildNotificationsCategory(), - if (NeonPlatform.instance.canUseWindowManager) ...[ + if (NeonPlatform.instance.canUseWindowManager) SettingsCategory( title: Text(NeonLocalizations.of(context).optionsCategoryStartup), key: ValueKey(SettingsCategories.startup.name), @@ -189,7 +187,6 @@ class _SettingsPageState extends State { ), ], ), - ], ...buildAccountCategory(), SettingsCategory( hasLeading: true, diff --git a/packages/neon_framework/lib/src/widgets/app_bar.dart b/packages/neon_framework/lib/src/widgets/app_bar.dart index 0373c0140bd..6b61220d12c 100644 --- a/packages/neon_framework/lib/src/widgets/app_bar.dart +++ b/packages/neon_framework/lib/src/widgets/app_bar.dart @@ -177,12 +177,11 @@ class _NotificationIconButtonState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ Text(app.name(context)), - if (_accounts.length > 1) ...[ + if (_accounts.length > 1) Text( _account.humanReadableID, style: Theme.of(context).textTheme.bodySmall, ), - ], ], ), ),