chore: Follow up VideoPlayer in ImageViewer

pull/1905/head
krille-chan 6 months ago
parent d3330c8bdf
commit 92d3e7f1c3
No known key found for this signature in database

@ -75,6 +75,7 @@ class ImageViewerView extends StatelessWidget {
focusNode: controller.focusNode,
onKeyEvent: controller.onKeyEvent,
child: PageView.builder(
scrollDirection: Axis.vertical,
controller: controller.pageController,
itemCount: controller.allEvents.length,
itemBuilder: (context, i) {
@ -119,30 +120,33 @@ class ImageViewerView extends StatelessWidget {
},
),
),
if (hovered && controller.canGoBack)
Align(
alignment: Alignment.centerLeft,
child: Padding(
padding: const EdgeInsets.all(12.0),
child: IconButton(
style: iconButtonStyle,
tooltip: L10n.of(context).previous,
icon: const Icon(Icons.chevron_left_outlined),
onPressed: controller.prevImage,
),
),
),
if (hovered && controller.canGoNext)
if (hovered)
Align(
alignment: Alignment.centerRight,
child: Padding(
padding: const EdgeInsets.all(12.0),
child: IconButton(
style: iconButtonStyle,
tooltip: L10n.of(context).next,
icon: const Icon(Icons.chevron_right_outlined),
onPressed: controller.nextImage,
),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
if (controller.canGoBack)
Padding(
padding: const EdgeInsets.all(12.0),
child: IconButton(
style: iconButtonStyle,
tooltip: L10n.of(context).previous,
icon: const Icon(Icons.arrow_upward_outlined),
onPressed: controller.prevImage,
),
),
if (controller.canGoNext)
Padding(
padding: const EdgeInsets.all(12.0),
child: IconButton(
style: iconButtonStyle,
tooltip: L10n.of(context).next,
icon: const Icon(Icons.arrow_downward_outlined),
onPressed: controller.nextImage,
),
),
],
),
),
],

@ -69,6 +69,10 @@ class EventVideoPlayerState extends State<EventVideoPlayer> {
await videoPlayerController.initialize();
final infoMap = widget.event.content.tryGetMap<String, Object?>('info');
final videoWidth = infoMap?.tryGet<int>('w') ?? 400;
final videoHeight = infoMap?.tryGet<int>('h') ?? 300;
// Create a ChewieController on top.
setState(() {
_chewieController = ChewieController(
@ -77,6 +81,7 @@ class EventVideoPlayerState extends State<EventVideoPlayer> {
autoPlay: true,
autoInitialize: true,
looping: true,
aspectRatio: videoHeight == 0 ? null : videoWidth / videoHeight,
);
});
} on IOException catch (e) {

Loading…
Cancel
Save