mirror of
https://github.com/KRTirtho/spotube.git
synced 2025-09-12 23:45:18 +00:00

* feat: add riverpod based favorite album provider * feat: add album is saved, new releases and tracks providers * feat: add artist related providers * feat: add all categories providers * feat: add lyrics provider * feat: add playlist related providers * feat: add search provider * feat: add view and spotify friends provider * feat: add playlist create and update and favorite handlers * feat: use providers in home screen * chore: fix dart lint issues * feat: use new providers for playlist and albums screen * feat: use providers in artist page * feat: use providers on library page * feat: use provider for playlist and album card and heart button * feat: use provider in search page * feat: use providers in generate playlist * feat: use provider in lyrics screen * feat: use provider for create playlist * feat: use provider in add track dialog * feat: use providers in remaining pages and remove fl_query * fix: remove direct access to provider.value * fix: glitching when loading * fix: user album loading next page indicator * feat: make many provider autoDispose after 5 minutes of no usage * fix: ignore episodes in tracks
77 lines
2.0 KiB
Dart
77 lines
2.0 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_hooks/flutter_hooks.dart';
|
|
|
|
import 'package:spotube/collections/spotube_icons.dart';
|
|
|
|
class ZoomControls extends HookWidget {
|
|
final int value;
|
|
final ValueChanged<int> onChanged;
|
|
final int? min;
|
|
final int? max;
|
|
|
|
final int interval;
|
|
final Icon increaseIcon;
|
|
final Icon decreaseIcon;
|
|
|
|
final Axis direction;
|
|
final String unit;
|
|
|
|
const ZoomControls({
|
|
super.key,
|
|
required this.value,
|
|
required this.onChanged,
|
|
this.min,
|
|
this.max,
|
|
this.interval = 10,
|
|
this.increaseIcon = const Icon(SpotubeIcons.zoomIn),
|
|
this.decreaseIcon = const Icon(SpotubeIcons.zoomOut),
|
|
this.direction = Axis.horizontal,
|
|
this.unit = "%",
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final actions = [
|
|
IconButton(
|
|
icon: decreaseIcon,
|
|
onPressed: () {
|
|
if (value == min) return;
|
|
onChanged(value - interval);
|
|
},
|
|
),
|
|
Text("$value$unit"),
|
|
IconButton(
|
|
icon: increaseIcon,
|
|
onPressed: () {
|
|
if (value == max) return;
|
|
onChanged(value + interval);
|
|
},
|
|
),
|
|
];
|
|
|
|
return Container(
|
|
decoration: BoxDecoration(
|
|
color: Theme.of(context).cardColor.withOpacity(0.7),
|
|
borderRadius: BorderRadius.circular(10),
|
|
),
|
|
constraints: BoxConstraints(
|
|
maxHeight: direction == Axis.horizontal ? 50 : 200,
|
|
maxWidth: direction == Axis.vertical ? 50 : double.infinity,
|
|
),
|
|
margin: const EdgeInsets.all(8),
|
|
child: direction == Axis.horizontal
|
|
? Row(
|
|
mainAxisAlignment: MainAxisAlignment.end,
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: actions,
|
|
)
|
|
: Column(
|
|
mainAxisAlignment: MainAxisAlignment.end,
|
|
mainAxisSize: MainAxisSize.min,
|
|
verticalDirection: VerticalDirection.up,
|
|
children: actions,
|
|
),
|
|
);
|
|
}
|
|
}
|