Skip to content

Commit

Permalink
just refactor theme
Browse files Browse the repository at this point in the history
  • Loading branch information
dvbthien committed Dec 3, 2024
2 parents d12d1b4 + ea887cb commit 1dda6a0
Show file tree
Hide file tree
Showing 15 changed files with 42 additions and 37 deletions.
1 change: 1 addition & 0 deletions mobile/analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ linter:
use_build_context_synchronously: false
require_trailing_commas: true
unrelated_type_equality_checks: true
prefer_const_constructors: true

# Additional information about this file can be found at
# https://dart.dev/guides/language/analysis-options
Expand Down
10 changes: 5 additions & 5 deletions mobile/lib/pages/albums/albums.page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class AlbumsPage extends HookConsumerWidget {
showUploadButton: false,
actions: [
IconButton(
icon: Icon(
icon: const Icon(
Icons.add_rounded,
size: 28,
),
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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),
),
),
Expand Down
2 changes: 1 addition & 1 deletion mobile/lib/pages/common/album_options.page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class AlbumOptionsPage extends HookConsumerWidget {

if (isSuccess) {
context.navigateTo(
TabControllerRoute(children: [AlbumsRoute()]),
const TabControllerRoute(children: [AlbumsRoute()]),
);
} else {
showErrorMessage();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
10 changes: 5 additions & 5 deletions mobile/lib/pages/library/library.page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -81,7 +81,7 @@ class LibraryPage extends ConsumerWidget {
],
),
const SizedBox(height: 12),
QuickAccessButtons(),
const QuickAccessButtons(),
const SizedBox(
height: 32,
),
Expand Down Expand Up @@ -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),
),
Expand Down Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()),
),
],
),
Expand Down
20 changes: 11 additions & 9 deletions mobile/lib/pages/search/search.page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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(),
),
),
),
Expand All @@ -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
Expand All @@ -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(),
],
),
);
Expand Down Expand Up @@ -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()),
),
],
),
Expand Down
4 changes: 3 additions & 1 deletion mobile/lib/repositories/auth_api.repository.dart
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ class AuthApiRepository extends ApiRepository implements IAuthApiRepository {

@override
Future<void> logout() async {
await _apiService.authenticationApi.logout().timeout(Duration(seconds: 7));
await _apiService.authenticationApi
.logout()
.timeout(const Duration(seconds: 7));
}

_mapLoginReponse(LoginResponseDto dto) {
Expand Down
2 changes: 1 addition & 1 deletion mobile/lib/services/api.service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ class ApiService implements Authentication {

try {
await setEndpoint(serverUrl);
await serverInfoApi.pingServer().timeout(Duration(seconds: 5));
await serverInfoApi.pingServer().timeout(const Duration(seconds: 5));
} on TimeoutException catch (_) {
return false;
} on SocketException catch (_) {
Expand Down
2 changes: 1 addition & 1 deletion mobile/lib/theme/dynamic_theme.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import 'package:dynamic_color/dynamic_color.dart';

import 'package:immich_mobile/theme/theme_data.dart';

class DynamicTheme {
abstract final class DynamicTheme {
DynamicTheme._();

static ImmichTheme? _theme;
Expand Down
12 changes: 6 additions & 6 deletions mobile/lib/theme/theme_data.dart
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ ThemeData getThemeData({
scrolledUnderElevation: 0,
centerTitle: true,
),
textTheme: TextTheme(
textTheme: const TextTheme(
displayLarge: TextStyle(
fontSize: 26,
fontWeight: FontWeight.bold,
Expand All @@ -66,15 +66,15 @@ ThemeData getThemeData({
fontSize: 12,
fontWeight: FontWeight.bold,
),
titleSmall: const TextStyle(
titleSmall: TextStyle(
fontSize: 16.0,
fontWeight: FontWeight.bold,
),
titleMedium: const TextStyle(
titleMedium: TextStyle(
fontSize: 18.0,
fontWeight: FontWeight.bold,
),
titleLarge: const TextStyle(
titleLarge: TextStyle(
fontSize: 26.0,
fontWeight: FontWeight.bold,
),
Expand Down Expand Up @@ -135,10 +135,10 @@ ThemeData getThemeData({
cursorColor: colorScheme.primary,
),
dropdownMenuTheme: DropdownMenuThemeData(
menuStyle: MenuStyle(
menuStyle: const MenuStyle(
shape: WidgetStatePropertyAll<OutlinedBorder>(
RoundedRectangleBorder(
borderRadius: BorderRadius.circular(15),
borderRadius: BorderRadius.all(Radius.circular(15)),
),
),
),
Expand Down
4 changes: 2 additions & 2 deletions mobile/lib/widgets/album/album_viewer_appbar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class AlbumViewerAppbar extends HookConsumerWidget
final bool success;
if (album.shared) {
success = await ref.watch(albumProvider.notifier).deleteAlbum(album);
context.navigateTo(TabControllerRoute(children: [AlbumsRoute()]));
context.navigateTo(const TabControllerRoute(children: [AlbumsRoute()]));
} else {
success = await ref.watch(albumProvider.notifier).deleteAlbum(album);
context
Expand Down Expand Up @@ -113,7 +113,7 @@ class AlbumViewerAppbar extends HookConsumerWidget
await ref.watch(albumProvider.notifier).leaveAlbum(album);

if (isSuccess) {
context.navigateTo(TabControllerRoute(children: [AlbumsRoute()]));
context.navigateTo(const TabControllerRoute(children: [AlbumsRoute()]));
} else {
context.pop();
ImmichToast.show(
Expand Down
2 changes: 1 addition & 1 deletion mobile/lib/widgets/asset_viewer/bottom_gallery_bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ class BottomGalleryBar extends ConsumerWidget {
),
position: DecorationPosition.background,
child: Padding(
padding: EdgeInsets.only(top: 40.0),
padding: const EdgeInsets.only(top: 40.0),
child: Column(
children: [
if (showVideoPlayerControls) const VideoControls(),
Expand Down
4 changes: 2 additions & 2 deletions mobile/lib/widgets/common/app_bar_dialog/app_bar_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,9 @@ class ImmichAppBarDialog extends HookConsumerWidget {
);
},
trailing: isLoggingOut.value
? SizedBox.square(
? const SizedBox.square(
dimension: 20,
child: const CircularProgressIndicator(strokeWidth: 2),
child: CircularProgressIndicator(strokeWidth: 2),
)
: null,
);
Expand Down
2 changes: 1 addition & 1 deletion mobile/test/modules/map/map_theme_override_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ void main() {
mapStateNotifier = MockMapStateNotifier(mapState);
overrides = [
mapStateNotifierProvider.overrideWith(() => mapStateNotifier),
localeProvider.overrideWithValue(Locale("en")),
localeProvider.overrideWithValue(const Locale("en")),
];
});

Expand Down

0 comments on commit 1dda6a0

Please sign in to comment.