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

fix: local cover and chip sizes #1015

Merged
merged 1 commit into from
Nov 14, 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
2 changes: 1 addition & 1 deletion lib/common/view/theme.dart
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ FontWeight get mediumTextWeight =>
FontWeight get largeTextWeight =>
yaruStyled ? FontWeight.w200 : FontWeight.w300;

double get chipHeight => isMobile ? 40 : 36.0;
double get chipHeight => isMobile ? 40 : 34.0;

EdgeInsets get audioTilePadding =>
isMobile ? kMobileAudioTilePadding : kDesktopAudioTilePadding;
Expand Down
7 changes: 5 additions & 2 deletions lib/local_audio/view/artist_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,11 @@ class ArtistPage extends StatelessWidget with WatchItMixin {
child: AudioPageHeader(
imageRadius: BorderRadius.circular(10000),
title: artistAudios?.firstOrNull?.artist ?? '',
image:
ArtistRoundImageContainer(artistAudios: artistAudios),
image: ArtistRoundImageContainer(
artistAudios: artistAudios,
height: kMaxAudioPageHeaderHeight,
width: kMaxAudioPageHeaderHeight,
),
subTitle: artistAudios?.firstOrNull?.genre,
label: context.l10n.artist,
onLabelTab: onAlbumTap,
Expand Down
5 changes: 5 additions & 0 deletions lib/local_audio/view/artist_round_image_container.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,12 @@ class ArtistRoundImageContainer extends StatelessWidget {
const ArtistRoundImageContainer({
super.key,
required this.artistAudios,
this.height,
this.width,
});

final List<Audio>? artistAudios;
final double? height, width;

@override
Widget build(BuildContext context) {
Expand All @@ -30,6 +33,8 @@ class ArtistRoundImageContainer extends StatelessWidget {
path: e.path!,
fallback: const CoverBackground(),
fit: BoxFit.cover,
height: height,
width: width,
),
)
.toList(),
Expand Down
3 changes: 3 additions & 0 deletions lib/local_audio/view/artists_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import '../../common/view/no_search_result_page.dart';
import '../../common/view/round_image_container.dart';
import '../../common/view/sliver_fill_remaining_progress.dart';
import '../../common/view/snackbars.dart';
import '../../common/view/theme.dart';
import '../../constants.dart';
import '../../l10n/l10n.dart';
import '../../library/library_model.dart';
Expand Down Expand Up @@ -72,6 +73,8 @@ class ArtistsView extends StatelessWidget {
height: double.infinity,
child: ArtistRoundImageContainer(
artistAudios: artistAudios,
height: audioCardDimension,
width: audioCardDimension,
),
),
ArtistVignette(text: text),
Expand Down
35 changes: 15 additions & 20 deletions lib/local_audio/view/local_audio_control_panel.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
import 'package:watch_it/watch_it.dart';
import 'package:yaru/yaru.dart';

import '../../common/view/theme.dart';
import '../../l10n/l10n.dart';
import '../local_audio_model.dart';
import 'local_audio_view.dart';
Expand All @@ -13,26 +14,20 @@ class LocalAudioControlPanel extends StatelessWidget with WatchItMixin {
Widget build(BuildContext context) {
final index = watchPropertyValue((LocalAudioModel m) => m.localAudioindex);

return Align(
alignment: Alignment.center,
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 20),
child: YaruChoiceChipBar(
style: YaruChoiceChipBarStyle.stack,
selectedFirst: false,
clearOnSelect: false,
labels: LocalAudioView.values
.map(
(e) => Text(
e.localize(context.l10n),
),
)
.toList(),
isSelected: LocalAudioView.values
.map((e) => e == LocalAudioView.values[index])
.toList(),
onSelected: (index) => di<LocalAudioModel>().localAudioindex = index,
),
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 5),
child: YaruChoiceChipBar(
chipHeight: chipHeight,
style: YaruChoiceChipBarStyle.stack,
selectedFirst: false,
clearOnSelect: false,
labels: LocalAudioView.values
.map((e) => Text(e.localize(context.l10n)))
.toList(),
isSelected: LocalAudioView.values
.map((e) => e == LocalAudioView.values[index])
.toList(),
onSelected: (index) => di<LocalAudioModel>().localAudioindex = index,
),
);
}
Expand Down
2 changes: 0 additions & 2 deletions lib/local_audio/view/local_audio_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,7 @@ class _LocalAudioPageState extends State<LocalAudioPage> {
padding: getAdaptiveHorizontalPadding(constraints: constraints)
.copyWith(
bottom: filterPanelPadding.bottom,
left: filterPanelPadding.left,
top: filterPanelPadding.top,
right: filterPanelPadding.right,
),
title: const LocalAudioControlPanel(),
),
Expand Down
21 changes: 12 additions & 9 deletions lib/local_audio/view/local_cover.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,15 @@ class LocalCover extends StatefulWidget with WatchItStatefulWidgetMixin {

class _LocalCoverState extends State<LocalCover> {
late Future<Uint8List?> _future;
Uint8List? _cover;

@override
void initState() {
super.initState();
final localCoverModel = di<LocalCoverModel>();
final init = localCoverModel.get(widget.albumId);
_future = init != null
? Future.value(init)
_cover = localCoverModel.get(widget.albumId);
_future = _cover != null
? Future.value(_cover)
: localCoverModel.getCover(
albumId: widget.albumId,
path: widget.path,
Expand All @@ -47,15 +48,17 @@ class _LocalCoverState extends State<LocalCover> {

@override
Widget build(BuildContext context) {
watchPropertyValue((LocalCoverModel m) => m.storeLength);
final cover = di<LocalCoverModel>().get(widget.albumId);
if (_cover == null) {
watchPropertyValue((LocalCoverModel m) => m.storeLength);
_cover = di<LocalCoverModel>().get(widget.albumId);
}
final fit = widget.fit ?? BoxFit.fitHeight;
const medium = FilterQuality.medium;

Widget child = cover != null
Widget child = _cover != null
? Image.memory(
key: ValueKey(widget.albumId),
cover,
_cover!,
fit: fit,
height: widget.dimension ?? widget.height,
width: widget.width,
Expand Down Expand Up @@ -86,10 +89,10 @@ class _LocalCoverState extends State<LocalCover> {
height: widget.dimension ?? widget.height,
width: widget.dimension ?? widget.width,
child: AnimatedSwitcher(
duration: const Duration(milliseconds: 500),
duration: const Duration(milliseconds: 200),
transitionBuilder: (Widget child, Animation<double> animation) =>
FadeTransition(opacity: animation, child: child),
reverseDuration: const Duration(milliseconds: 500),
reverseDuration: const Duration(milliseconds: 200),
child: child,
),
);
Expand Down
8 changes: 4 additions & 4 deletions linux/flutter/generated_plugin_registrant.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include <irondash_engine_context/irondash_engine_context_plugin.h>
#include <media_kit_libs_linux/media_kit_libs_linux_plugin.h>
#include <media_kit_video/media_kit_video_plugin.h>
#include <screen_retriever/screen_retriever_plugin.h>
#include <screen_retriever_linux/screen_retriever_linux_plugin.h>
#include <super_native_extensions/super_native_extensions_plugin.h>
#include <system_theme/system_theme_plugin.h>
#include <url_launcher_linux/url_launcher_plugin.h>
Expand All @@ -38,9 +38,9 @@ void fl_register_plugins(FlPluginRegistry* registry) {
g_autoptr(FlPluginRegistrar) media_kit_video_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "MediaKitVideoPlugin");
media_kit_video_plugin_register_with_registrar(media_kit_video_registrar);
g_autoptr(FlPluginRegistrar) screen_retriever_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "ScreenRetrieverPlugin");
screen_retriever_plugin_register_with_registrar(screen_retriever_registrar);
g_autoptr(FlPluginRegistrar) screen_retriever_linux_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "ScreenRetrieverLinuxPlugin");
screen_retriever_linux_plugin_register_with_registrar(screen_retriever_linux_registrar);
g_autoptr(FlPluginRegistrar) super_native_extensions_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "SuperNativeExtensionsPlugin");
super_native_extensions_plugin_register_with_registrar(super_native_extensions_registrar);
Expand Down
2 changes: 1 addition & 1 deletion linux/flutter/generated_plugins.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ list(APPEND FLUTTER_PLUGIN_LIST
irondash_engine_context
media_kit_libs_linux
media_kit_video
screen_retriever
screen_retriever_linux
super_native_extensions
system_theme
url_launcher_linux
Expand Down
4 changes: 2 additions & 2 deletions macos/Flutter/GeneratedPluginRegistrant.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import media_kit_video
import package_info_plus
import path_provider_foundation
import screen_brightness_macos
import screen_retriever
import screen_retriever_macos
import shared_preferences_foundation
import sqflite_darwin
import super_native_extensions
Expand All @@ -37,7 +37,7 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
FPPPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FPPPackageInfoPlusPlugin"))
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
ScreenBrightnessMacosPlugin.register(with: registry.registrar(forPlugin: "ScreenBrightnessMacosPlugin"))
ScreenRetrieverPlugin.register(with: registry.registrar(forPlugin: "ScreenRetrieverPlugin"))
ScreenRetrieverMacosPlugin.register(with: registry.registrar(forPlugin: "ScreenRetrieverMacosPlugin"))
SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin"))
SqflitePlugin.register(with: registry.registrar(forPlugin: "SqflitePlugin"))
SuperNativeExtensionsPlugin.register(with: registry.registrar(forPlugin: "SuperNativeExtensionsPlugin"))
Expand Down
14 changes: 7 additions & 7 deletions macos/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ PODS:
- FlutterMacOS
- screen_brightness_macos (0.1.0):
- FlutterMacOS
- screen_retriever (0.0.1):
- screen_retriever_macos (0.0.1):
- FlutterMacOS
- shared_preferences_foundation (0.0.1):
- Flutter
Expand Down Expand Up @@ -62,7 +62,7 @@ DEPENDENCIES:
- package_info_plus (from `Flutter/ephemeral/.symlinks/plugins/package_info_plus/macos`)
- path_provider_foundation (from `Flutter/ephemeral/.symlinks/plugins/path_provider_foundation/darwin`)
- screen_brightness_macos (from `Flutter/ephemeral/.symlinks/plugins/screen_brightness_macos/macos`)
- screen_retriever (from `Flutter/ephemeral/.symlinks/plugins/screen_retriever/macos`)
- screen_retriever_macos (from `Flutter/ephemeral/.symlinks/plugins/screen_retriever_macos/macos`)
- shared_preferences_foundation (from `Flutter/ephemeral/.symlinks/plugins/shared_preferences_foundation/darwin`)
- sqflite_darwin (from `Flutter/ephemeral/.symlinks/plugins/sqflite_darwin/darwin`)
- super_native_extensions (from `Flutter/ephemeral/.symlinks/plugins/super_native_extensions/macos`)
Expand Down Expand Up @@ -100,8 +100,8 @@ EXTERNAL SOURCES:
:path: Flutter/ephemeral/.symlinks/plugins/path_provider_foundation/darwin
screen_brightness_macos:
:path: Flutter/ephemeral/.symlinks/plugins/screen_brightness_macos/macos
screen_retriever:
:path: Flutter/ephemeral/.symlinks/plugins/screen_retriever/macos
screen_retriever_macos:
:path: Flutter/ephemeral/.symlinks/plugins/screen_retriever_macos/macos
shared_preferences_foundation:
:path: Flutter/ephemeral/.symlinks/plugins/shared_preferences_foundation/darwin
sqflite_darwin:
Expand Down Expand Up @@ -129,12 +129,12 @@ SPEC CHECKSUMS:
media_kit_libs_macos_video: b3e2bbec2eef97c285f2b1baa7963c67c753fb82
media_kit_native_event_loop: 81fd5b45192b72f8b5b69eaf5b540f45777eb8d5
media_kit_video: c75b07f14d59706c775778e4dd47dd027de8d1e5
package_info_plus: f5790acc797bf17c3e959e9d6cf162cc68ff7523
package_info_plus: 12f1c5c2cfe8727ca46cbd0b26677728972d9a5b
path_provider_foundation: 2b6b4c569c0fb62ec74538f866245ac84301af46
screen_brightness_macos: 2d6d3af2165592d9a55ffcd95b7550970e41ebda
screen_retriever: 59634572a57080243dd1bf715e55b6c54f241a38
screen_retriever_macos: 776e0fa5d42c6163d2bf772d22478df4b302b161
shared_preferences_foundation: fcdcbc04712aee1108ac7fda236f363274528f78
sqflite_darwin: a553b1fd6fe66f53bbb0fe5b4f5bab93f08d7a13
sqflite_darwin: 5a7236e3b501866c1c9befc6771dfd73ffb8702d
super_native_extensions: 85efee3a7495b46b04befcfc86ed12069264ebf3
system_theme: c7b9f6659a5caa26c9bc2284da096781e9a6fcbc
url_launcher_macos: c82c93949963e55b228a30115bd219499a6fe404
Expand Down
Loading