2024-03-06 04:42:22 +01:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
2024-11-13 07:13:21 +01:00
|
|
|
import 'package:immich_mobile/constants/immich_colors.dart';
|
2024-05-02 22:59:14 +02:00
|
|
|
import 'package:immich_mobile/providers/asset_viewer/show_controls.provider.dart';
|
2024-11-13 07:13:21 +01:00
|
|
|
import 'package:immich_mobile/widgets/asset_viewer/video_position.dart';
|
2024-03-06 04:42:22 +01:00
|
|
|
|
2024-11-13 07:13:21 +01:00
|
|
|
/// The video controls for the [videoPlayerControlsProvider]
|
2024-03-06 04:42:22 +01:00
|
|
|
class VideoControls extends ConsumerWidget {
|
|
|
|
const VideoControls({super.key});
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context, WidgetRef ref) {
|
2024-11-13 07:13:21 +01:00
|
|
|
final isPortrait =
|
|
|
|
MediaQuery.orientationOf(context) == Orientation.portrait;
|
2024-03-06 04:42:22 +01:00
|
|
|
return AnimatedOpacity(
|
|
|
|
opacity: ref.watch(showControlsProvider) ? 1.0 : 0.0,
|
|
|
|
duration: const Duration(milliseconds: 100),
|
2024-11-13 07:13:21 +01:00
|
|
|
child: isPortrait
|
|
|
|
? const ColoredBox(
|
|
|
|
color: blackOpacity40,
|
|
|
|
child: Padding(
|
|
|
|
padding: EdgeInsets.symmetric(horizontal: 24.0),
|
|
|
|
child: VideoPosition(),
|
|
|
|
),
|
|
|
|
)
|
|
|
|
: const ColoredBox(
|
|
|
|
color: blackOpacity40,
|
|
|
|
child: Padding(
|
|
|
|
padding: EdgeInsets.symmetric(horizontal: 128.0),
|
|
|
|
child: VideoPosition(),
|
|
|
|
),
|
2024-03-06 04:42:22 +01:00
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|