mirror of
https://github.com/KRTirtho/spotube.git
synced 2025-09-13 07:55:18 +00:00

fix(theme): remove splash effect feat(artists-albums): horizontal paginated list instead of grid view page
30 lines
708 B
Dart
30 lines
708 B
Dart
import 'package:flutter/cupertino.dart';
|
|
import 'package:visibility_detector/visibility_detector.dart';
|
|
|
|
class Waypoint extends StatelessWidget {
|
|
final void Function()? onEnter;
|
|
final void Function()? onLeave;
|
|
final Widget? child;
|
|
const Waypoint({
|
|
Key? key,
|
|
this.onEnter,
|
|
this.onLeave,
|
|
this.child,
|
|
}) : super(key: key);
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return VisibilityDetector(
|
|
key: const Key("waypoint"),
|
|
onVisibilityChanged: (info) {
|
|
if (info.visibleFraction == 0) {
|
|
onLeave?.call();
|
|
} else if (info.visibleFraction > 0) {
|
|
onEnter?.call();
|
|
}
|
|
},
|
|
child: child ?? Container(),
|
|
);
|
|
}
|
|
}
|