mirror of
https://github.com/gabehf/Fladder.git
synced 2026-03-07 21:48:14 -08:00
43 lines
1.5 KiB
Dart
43 lines
1.5 KiB
Dart
import 'package:fladder/providers/settings/client_settings_provider.dart';
|
|
import 'package:fladder/widgets/shared/fladder_slider.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|
|
|
class PosterSizeWidget extends ConsumerWidget {
|
|
final Color? iconColor;
|
|
final double width;
|
|
const PosterSizeWidget({this.width = 150, this.iconColor, super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context, WidgetRef ref) {
|
|
if (ref.watch(clientSettingsProvider.select((value) => value.pinchPosterZoom))) {
|
|
return Row(
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
Tooltip(
|
|
message: 'Set poster size',
|
|
child: IconButton(
|
|
onPressed: () =>
|
|
ref.read(clientSettingsProvider.notifier).update((current) => current.copyWith(posterSize: 1)),
|
|
icon: const Icon(Icons.photo_size_select_large_rounded),
|
|
color: iconColor ?? Theme.of(context).colorScheme.onSurface,
|
|
),
|
|
),
|
|
SizedBox(
|
|
width: width,
|
|
child: FladderSlider(
|
|
value: ref.watch(clientSettingsProvider.select((value) => value.posterSize)),
|
|
min: 0.5,
|
|
divisions: 12,
|
|
max: 1.5,
|
|
onChanged: (value) =>
|
|
ref.read(clientSettingsProvider.notifier).update((current) => current.copyWith(posterSize: value)),
|
|
),
|
|
),
|
|
],
|
|
);
|
|
} else {
|
|
return Container();
|
|
}
|
|
}
|
|
}
|