Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Stop using spread list operator #1872

Merged
merged 1 commit into from
Apr 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions packages/dynamite/dynamite/lib/src/builder/client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
9 changes: 3 additions & 6 deletions packages/file_icons/bin/file_icons.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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';",
Expand Down
3 changes: 1 addition & 2 deletions packages/neon/neon_files/lib/src/pages/details.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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)),
],
),
],
],
),
],
Expand Down
7 changes: 2 additions & 5 deletions packages/neon/neon_news/lib/src/widgets/articles_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,7 @@ class _NewsArticlesViewState extends State<NewsArticlesView> {
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;
Expand Down Expand Up @@ -141,13 +139,12 @@ class _NewsArticlesViewState extends State<NewsArticlesView> {
: 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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,21 +49,17 @@

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)

Check warning on line 53 in packages/neon_framework/lib/src/pages/app_implementation_settings.dart

View check run for this annotation

Codecov / codecov/patch

packages/neon_framework/lib/src/pages/app_implementation_settings.dart#L52-L53

Added lines #L52 - L53 were not covered by tests
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))

Check warning on line 59 in packages/neon_framework/lib/src/pages/app_implementation_settings.dart

View check run for this annotation

Codecov / codecov/patch

packages/neon_framework/lib/src/pages/app_implementation_settings.dart#L59

Added line #L59 was not covered by tests
OptionSettingsTile(option: option),
],
],
),
],
],
],
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
builder: (context, state) => Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
if (state.hasError) ...[
if (state.hasError)

Check warning on line 69 in packages/neon_framework/lib/src/pages/login_check_account.dart

View check run for this annotation

Codecov / codecov/patch

packages/neon_framework/lib/src/pages/login_check_account.dart#L69

Added line #L69 was not covered by tests
Builder(
builder: (context) {
final details = NeonError.getDetails(state.error);
Expand All @@ -78,7 +78,6 @@
);
},
),
],
_buildAccountTile(state),
Align(
alignment: Alignment.bottomRight,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,11 @@
return Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
if (state.hasError) ...[
if (state.hasError)

Check warning on line 73 in packages/neon_framework/lib/src/pages/login_check_server_status.dart

View check run for this annotation

Codecov / codecov/patch

packages/neon_framework/lib/src/pages/login_check_server_status.dart#L73

Added line #L73 was not covered by tests
NeonValidationTile(
title: NeonError.getDetails(state.error).getText(context),
state: ValidationState.failure,
),
],
_buildServerVersionTile(state),
_buildMaintenanceModeTile(state),
Align(
Expand Down
9 changes: 3 additions & 6 deletions packages/neon_framework/lib/src/pages/settings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -135,17 +135,15 @@
title: Text(NeonLocalizations.of(context).settingsApps),
key: ValueKey(SettingsCategories.apps.name),
tiles: <SettingsTile>[
for (final appImplementation in appImplementations) ...[
if (appImplementation.options.options.isNotEmpty) ...[
for (final appImplementation in appImplementations)
if (appImplementation.options.options.isNotEmpty)

Check warning on line 139 in packages/neon_framework/lib/src/pages/settings.dart

View check run for this annotation

Codecov / codecov/patch

packages/neon_framework/lib/src/pages/settings.dart#L138-L139

Added lines #L138 - L139 were not covered by tests
CustomSettingsTile(
leading: appImplementation.buildIcon(),
title: Text(appImplementation.name(context)),
onTap: () {
AppImplementationSettingsRoute(appid: appImplementation.id).go(context);
},
),
],
],
],
),
SettingsCategory(
Expand Down Expand Up @@ -176,7 +174,7 @@
],
),
if (NeonPlatform.instance.canUsePushNotifications) buildNotificationsCategory(),
if (NeonPlatform.instance.canUseWindowManager) ...[
if (NeonPlatform.instance.canUseWindowManager)

Check warning on line 177 in packages/neon_framework/lib/src/pages/settings.dart

View check run for this annotation

Codecov / codecov/patch

packages/neon_framework/lib/src/pages/settings.dart#L177

Added line #L177 was not covered by tests
SettingsCategory(
title: Text(NeonLocalizations.of(context).optionsCategoryStartup),
key: ValueKey(SettingsCategories.startup.name),
Expand All @@ -189,7 +187,6 @@
),
],
),
],
...buildAccountCategory(),
SettingsCategory(
hasLeading: true,
Expand Down
3 changes: 1 addition & 2 deletions packages/neon_framework/lib/src/widgets/app_bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -177,12 +177,11 @@
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(app.name(context)),
if (_accounts.length > 1) ...[
if (_accounts.length > 1)

Check warning on line 180 in packages/neon_framework/lib/src/widgets/app_bar.dart

View check run for this annotation

Codecov / codecov/patch

packages/neon_framework/lib/src/widgets/app_bar.dart#L180

Added line #L180 was not covered by tests
Text(
_account.humanReadableID,
style: Theme.of(context).textTheme.bodySmall,
),
],
],
),
),
Expand Down