Skip to content

Commit

Permalink
Merge pull request #1709 from d-loose/update-lints
Browse files Browse the repository at this point in the history
refactor: update lints
  • Loading branch information
d-loose authored Jun 24, 2024
2 parents 460b236 + 7e337c4 commit 73b4233
Show file tree
Hide file tree
Showing 64 changed files with 1,257 additions and 872 deletions.
2 changes: 1 addition & 1 deletion melos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ command:
flutter: '>=3.19.6'

dev_dependencies:
ubuntu_lints: ^0.3.1
ubuntu_lints: ^0.4.0

scripts:
# analyze all packages
Expand Down
3 changes: 2 additions & 1 deletion packages/app_center/integration_test/app_center_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ void main() {
);
expect(
find.text(
'This is a minimal test package for App Center integration tests.'),
'This is a minimal test package for App Center integration tests.',
),
findsOneWidget,
);
expect(
Expand Down
24 changes: 14 additions & 10 deletions packages/app_center/lib/about/about_providers.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,22 @@ final contributorsProvider = FutureProvider.autoDispose
final contributors = await getService<GitHub>()
.repositories
.listContributors(RepositorySlug.full(repo))
.where((c) =>
c.type == 'User' &&
!designers.contains(c.login) &&
!exclude.contains(c.login))
.where(
(c) =>
c.type == 'User' &&
!designers.contains(c.login) &&
!exclude.contains(c.login),
)
.toList();
return [
...designers.map((d) => Contributor(
login: d,
htmlUrl: 'https://github.com/$d',
avatarUrl: 'https://avatars.githubusercontent.com/$d',
)),
...contributors
...designers.map(
(d) => Contributor(
login: d,
htmlUrl: 'https://github.com/$d',
avatarUrl: 'https://avatars.githubusercontent.com/$d',
),
),
...contributors,
].sortedBy((c) => c.login?.toLowerCase() ?? '');
});

Expand Down
16 changes: 13 additions & 3 deletions packages/app_center/lib/appstream/appstream_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,17 @@ class _CachedComponent {
.split(nonWordCharacters)
.toList();

return _CachedComponent(component, id, name, keywords, summary, description,
origin, package, mediaTypes);
return _CachedComponent(
component,
id,
name,
keywords,
summary,
description,
origin,
package,
mediaTypes,
);
}
final AppstreamComponent component;
final String id;
Expand Down Expand Up @@ -166,7 +175,8 @@ class AppstreamService {
} else {
locale = const Locale('en');
log.info(
'Unsupported locale: ${PlatformDispatcher.instance.locale}. Defaulting to "en".');
'Unsupported locale: ${PlatformDispatcher.instance.locale}. Defaulting to "en".',
);
}
return lookupAppLocalizations(locale);
}
Expand Down
8 changes: 5 additions & 3 deletions packages/app_center/lib/appstream/appstream_utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,11 @@ extension Metadata on AppstreamComponent {
}

List<String> get screenshotUrls => screenshots
.map((screenshot) => screenshot.images
.where((image) => image.type == AppstreamImageType.source)
.map((image) => image.url))
.map(
(screenshot) => screenshot.images
.where((image) => image.type == AppstreamImageType.source)
.map((image) => image.url),
)
.expand((images) => images)
.toList();
}
22 changes: 12 additions & 10 deletions packages/app_center/lib/deb/deb_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,14 @@ class _DebView extends StatelessWidget {
AppstreamUrlType.homepage,
].contains(url.type),
)
.map((url) => Html(
data:
'<a href="${url.url}">${url.type.localize(l10n)}</a>',
style: {'body': Style(margin: Margins.zero)},
onLinkTap: (url, attributes, element) =>
launchUrlString(url!),
))
.map(
(url) => Html(
data: '<a href="${url.url}">${url.type.localize(l10n)}</a>',
style: {'body': Style(margin: Margins.zero)},
onLinkTap: (url, attributes, element) =>
launchUrlString(url!),
),
)
.toList(),
),
),
Expand Down Expand Up @@ -169,7 +170,7 @@ class _DebActionButtons extends ConsumerWidget {
builder: (context, ref, child) {
final transaction = ref
.watch(transactionProvider(debModel.activeTransactionId!))
.whenOrNull(data: (data) => data);
.valueOrNull;
return Center(
child: SizedBox.square(
dimension: kCircularProgressIndicatorHeight,
Expand Down Expand Up @@ -198,7 +199,7 @@ class _DebActionButtons extends ConsumerWidget {
primaryActionButton
else
Text(l10n.debPageErrorNoPackageInfo),
if (debModel.activeTransactionId != null) cancelButton
if (debModel.activeTransactionId != null) cancelButton,
].whereNotNull().toList(),
);
}
Expand Down Expand Up @@ -245,7 +246,8 @@ class _Header extends StatelessWidget {
icon: const Icon(YaruIcons.share),
onPressed: () {
Clipboard.setData(
ClipboardData(text: debModel.component.website!));
ClipboardData(text: debModel.component.website!),
);
},
),
],
Expand Down
9 changes: 6 additions & 3 deletions packages/app_center/lib/deb/local_deb_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,17 @@ class LocalDebModel extends _$LocalDebModel {
final packageKit = getService<PackageKitService>();
final activeTransactionId = await packageKit.installLocal(path);
state = AsyncValue.data(
state.value!.copyWith(activeTransactionId: activeTransactionId));
state.value!.copyWith(activeTransactionId: activeTransactionId),
);
await packageKit.waitTransaction(activeTransactionId);
ref.invalidateSelf();
}

Future<void> cancel() async {
assert(state.value?.activeTransactionId != null,
'cancel() called without active transaction');
assert(
state.value?.activeTransactionId != null,
'cancel() called without active transaction',
);
final packageKit = getService<PackageKitService>();
await packageKit.cancelTransaction(state.value!.activeTransactionId!);
state = AsyncValue.data(state.value!.copyWith(activeTransactionId: null));
Expand Down
4 changes: 2 additions & 2 deletions packages/app_center/lib/deb/local_deb_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ class _LocalDebActionButtons extends ConsumerWidget {
.textTheme
.bodyMedium!
.copyWith(fontWeight: FontWeight.bold),
)
),
],
),
);
Expand Down Expand Up @@ -178,7 +178,7 @@ class _LocalDebActionButtons extends ConsumerWidget {
primaryActionButton,
if (debData.activeTransactionId != null) ...[
const SizedBox(width: 8),
cancelButton
cancelButton,
],
],
);
Expand Down
100 changes: 58 additions & 42 deletions packages/app_center/lib/explore/explore_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,55 +23,67 @@ class ExplorePage extends ConsumerWidget {
final l10n = AppLocalizations.of(context);
return ResponsiveLayoutScrollView(
slivers: [
SliverList.list(children: const [
SizedBox(height: kPagePadding),
CategoryBanner(category: SnapCategoryEnum.ubuntuDesktop),
SizedBox(height: kPagePadding),
]),
SliverList.list(
children: const [
SizedBox(height: kPagePadding),
CategoryBanner(category: SnapCategoryEnum.ubuntuDesktop),
SizedBox(height: kPagePadding),
],
),
const CategorySnapList(
category: SnapCategoryEnum.ubuntuDesktop,
hideBannerSnaps: true,
),
SliverList.list(children: const [
SizedBox(height: 56),
CategoryBanner(category: SnapCategoryEnum.featured),
SizedBox(height: kPagePadding),
]),
SliverList.list(
children: const [
SizedBox(height: 56),
CategoryBanner(category: SnapCategoryEnum.featured),
SizedBox(height: kPagePadding),
],
),
const CategorySnapList(
category: SnapCategoryEnum.featured,
hideBannerSnaps: true,
),
SliverList.list(children: [
const SizedBox(height: 56),
_Title(text: SnapCategoryEnum.games.slogan(l10n)),
const SizedBox(height: kPagePadding),
]),
SliverList.list(
children: [
const SizedBox(height: 56),
_Title(text: SnapCategoryEnum.games.slogan(l10n)),
const SizedBox(height: kPagePadding),
],
),
const CategorySnapList(
category: SnapCategoryEnum.games,
numberOfSnaps: 4,
showScreenshots: true,
onlyFeatured: true,
),
SliverList.list(children: [
const SizedBox(height: 56),
_Title(text: l10n.explorePageCategoriesLabel),
const SizedBox(height: kPagePadding),
]),
SliverList.list(
children: [
const SizedBox(height: 56),
_Title(text: l10n.explorePageCategoriesLabel),
const SizedBox(height: kPagePadding),
],
),
const _CategoryList(),
SliverList.list(children: const [
SizedBox(height: 56),
CategoryBanner(category: SnapCategoryEnum.development),
SizedBox(height: kPagePadding),
]),
SliverList.list(
children: const [
SizedBox(height: 56),
CategoryBanner(category: SnapCategoryEnum.development),
SizedBox(height: kPagePadding),
],
),
const CategorySnapList(
category: SnapCategoryEnum.development,
hideBannerSnaps: true,
),
SliverList.list(children: const [
SizedBox(height: 56),
CategoryBanner(category: SnapCategoryEnum.productivity),
SizedBox(height: kPagePadding),
]),
SliverList.list(
children: const [
SizedBox(height: 56),
CategoryBanner(category: SnapCategoryEnum.productivity),
SizedBox(height: kPagePadding),
],
),
const CategorySnapList(
category: SnapCategoryEnum.productivity,
hideBannerSnaps: true,
Expand Down Expand Up @@ -109,18 +121,22 @@ class _CategoryList extends StatelessWidget {
crossAxisCount: ResponsiveLayout.of(context).snapInfoColumnCount,
children: SnapCategoryEnum.values
.whereNot((category) => category.hidden)
.map((category) => InkWell(
onTap: () => StoreNavigator.pushSearch(context,
category: category.categoryName),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Icon(category.icon(true)),
const SizedBox(width: 8),
Text(category.localize(AppLocalizations.of(context)))
],
),
))
.map(
(category) => InkWell(
onTap: () => StoreNavigator.pushSearch(
context,
category: category.categoryName,
),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Icon(category.icon(true)),
const SizedBox(width: 8),
Text(category.localize(AppLocalizations.of(context))),
],
),
),
)
.toList(),
);
}
Expand Down
Loading

0 comments on commit 73b4233

Please sign in to comment.