dxvid-pts / miniplayer

A lightweight flutter package to simplify the creation of a miniplayer.
https://pub.dev/packages/miniplayer
MIT License
106 stars 79 forks source link

Option to set initial snap position of the Miniplayer #4

Closed vishal-akg closed 3 years ago

vishal-akg commented 3 years ago

Instead of having always start from min snap position, there should be an option to customise initial snap position. That can be anything in between max and min.

vishal-akg commented 3 years ago

I have tried a workaround this- _playerExpandProgress = ValueNotifier({max height of device}); But then the issue arises because you don't consider its initial value in initState method. you have simply assumed it to be always _dragHeight minHeight;

I made these following changes;-

if (widget.valueNotifier == null) { heightNotifier = ValueNotifier(widget.minHeight); _dragHeight = min.maxHeight; } else { heightNotifier = widget.valueNotifier; _dragHeight = widget.valueNotifer.value; }

Just review it please.

dxvid-pts commented 3 years ago

You can achieve that through providing a custom ValueNotifier:

final ValueNotifier<double> customValueNotifier =
    ValueNotifier(INITIAL_HEIGHT);

Miniplayer(
    valueNotifier: customValueNotifier,
),

I'm not completely convinced that it is required to add a new parameter as I don't want the list to get messy over time. Do you still think we should add a new parameter?

vishal-akg commented 3 years ago

yes I am using valueNotifier to initially show miniplayer in expanded state, but then on drag down it doesn't work as expected, First drag down gesture it won't minimise.

dxvid-pts commented 3 years ago

Ok, I'll take a look tomorrow.

dxvid-pts commented 3 years ago

yes I am using valueNotifier to initially show miniplayer in expanded state, but then on drag down it doesn't work as expected, First drag down gesture it won't minimise.

Fixed.