aspect ratio 위젯으로 공백을 만들어주니 영상이 존재하는 부분은 gesture detector로 onTap 이벤트 수신이 되지만 나머지 빈 곳은 터치가 안됨.
gesture detector 대신 InkWell을 쓰고 Effect를 없앤다.
NoEffectInkWell(
onTap: () {
// some event
},
child: Center(
child: AspectRatio(
aspectRatio: _videoPlayerController.value.aspectRatio,
child: VideoPlayer(
_videoPlayerController,
),
),
),
);
import 'package:flutter/material.dart';
class NoEffectInkWell extends StatelessWidget {
final Widget child;
final void Function() onTap;
const NoEffectInkWell({Key? key, required this.child, required this.onTap})
: super(key: key);
Widget build(BuildContext context) {
return InkWell(
highlightColor: Colors.transparent,
hoverColor: Colors.transparent,
splashColor: Colors.transparent,
splashFactory: NoSplash.splashFactory,
onTap: onTap,
child: child,
);
}
}