chore(mobile): Add const linter (#14447)

This commit is contained in:
Alex 2024-12-02 09:33:44 -06:00 committed by GitHub
parent 4eb7758f56
commit 1bb6926b5e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 39 additions and 34 deletions

View file

@ -78,7 +78,7 @@ class AlbumsPage extends HookConsumerWidget {
showUploadButton: false,
actions: [
IconButton(
icon: Icon(
icon: const Icon(
Icons.add_rounded,
size: 28,
),
@ -112,13 +112,13 @@ class AlbumsPage extends HookConsumerWidget {
],
begin: Alignment.topLeft,
end: Alignment.bottomRight,
transform: GradientRotation(0.5 * pi),
transform: const GradientRotation(0.5 * pi),
),
),
child: TextField(
autofocus: false,
decoration: InputDecoration(
contentPadding: EdgeInsets.all(16),
contentPadding: const EdgeInsets.all(16),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(25),
borderSide: BorderSide(
@ -362,13 +362,13 @@ class SortButton extends ConsumerWidget {
return MenuAnchor(
style: MenuStyle(
elevation: WidgetStatePropertyAll(1),
elevation: const WidgetStatePropertyAll(1),
shape: WidgetStateProperty.all(
RoundedRectangleBorder(
borderRadius: BorderRadius.circular(24),
),
),
padding: WidgetStatePropertyAll(
padding: const WidgetStatePropertyAll(
EdgeInsets.all(4),
),
),

View file

@ -49,7 +49,7 @@ class AlbumOptionsPage extends HookConsumerWidget {
if (isSuccess) {
context.navigateTo(
TabControllerRoute(children: [AlbumsRoute()]),
const TabControllerRoute(children: [AlbumsRoute()]),
);
} else {
showErrorMessage();

View file

@ -33,7 +33,7 @@ class AlbumSharedUserSelectionPage extends HookConsumerWidget {
if (newAlbum != null) {
ref.watch(albumTitleProvider.notifier).clearAlbumTitle();
context.maybePop(true);
context.navigateTo(TabControllerRoute(children: [AlbumsRoute()]));
context.navigateTo(const TabControllerRoute(children: [AlbumsRoute()]));
}
ScaffoldMessenger(

View file

@ -28,7 +28,7 @@ class LibraryPage extends ConsumerWidget {
ref.watch(serverInfoProvider.select((v) => v.serverFeatures.trash));
return Scaffold(
appBar: ImmichAppBar(),
appBar: const ImmichAppBar(),
body: Padding(
padding: const EdgeInsets.symmetric(horizontal: 16),
child: ListView(
@ -81,7 +81,7 @@ class LibraryPage extends ConsumerWidget {
],
),
const SizedBox(height: 12),
QuickAccessButtons(),
const QuickAccessButtons(),
const SizedBox(
height: 32,
),
@ -122,8 +122,8 @@ class QuickAccessButtons extends ConsumerWidget {
ListTile(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(20),
topRight: Radius.circular(20),
topLeft: const Radius.circular(20),
topRight: const Radius.circular(20),
bottomLeft: Radius.circular(partners.isEmpty ? 20 : 0),
bottomRight: Radius.circular(partners.isEmpty ? 20 : 0),
),
@ -173,7 +173,7 @@ class PartnerList extends ConsumerWidget {
right: 18.0,
),
leading: userAvatar(context, partner, radius: 16),
title: Text(
title: const Text(
"partner_list_user_photos",
style: TextStyle(
fontWeight: FontWeight.w500,

View file

@ -60,7 +60,7 @@ class PlacesCollectionPage extends HookConsumerWidget {
);
},
error: (error, stask) => const Text('Error getting places'),
loading: () => Center(child: const CircularProgressIndicator()),
loading: () => const Center(child: CircularProgressIndicator()),
),
],
),

View file

@ -499,8 +499,8 @@ class SearchPage extends HookConsumerWidget {
controller: textSearchController,
decoration: InputDecoration(
contentPadding: prefilter != null
? EdgeInsets.only(left: 24)
: EdgeInsets.all(8),
? const EdgeInsets.only(left: 24)
: const EdgeInsets.all(8),
prefixIcon: prefilter != null
? null
: Icon(
@ -647,7 +647,9 @@ class SearchResultGrid extends StatelessWidget {
stackEnabled: false,
emptyIndicator: Padding(
padding: const EdgeInsets.symmetric(horizontal: 16.0),
child: !isSearching ? SearchEmptyContent() : SizedBox.shrink(),
child: !isSearching
? const SearchEmptyContent()
: const SizedBox.shrink(),
),
),
),
@ -666,7 +668,7 @@ class SearchEmptyContent extends StatelessWidget {
child: ListView(
shrinkWrap: false,
children: [
SizedBox(height: 40),
const SizedBox(height: 40),
Center(
child: Image.asset(
context.isDarkTheme
@ -675,15 +677,15 @@ class SearchEmptyContent extends StatelessWidget {
height: 125,
),
),
SizedBox(height: 16),
const SizedBox(height: 16),
Center(
child: Text(
"Search for your photos and videos",
style: context.textTheme.labelLarge,
),
),
SizedBox(height: 32),
QuickLinkList(),
const SizedBox(height: 32),
const QuickLinkList(),
],
),
);
@ -725,13 +727,13 @@ class QuickLinkList extends StatelessWidget {
QuickLink(
title: 'videos'.tr(),
icon: Icons.play_circle_outline_rounded,
onTap: () => context.pushRoute(AllVideosRoute()),
onTap: () => context.pushRoute(const AllVideosRoute()),
),
QuickLink(
title: 'favorites'.tr(),
icon: Icons.favorite_border_rounded,
isBottom: true,
onTap: () => context.pushRoute(FavoritesRoute()),
onTap: () => context.pushRoute(const FavoritesRoute()),
),
],
),