mirror of
https://github.com/gabehf/Fladder.git
synced 2026-03-08 23:18:16 -07:00
chore: Added a small animation to skip button
This commit is contained in:
parent
a06591084b
commit
9442a5bd41
2 changed files with 36 additions and 26 deletions
|
|
@ -2,9 +2,12 @@ import 'package:flutter/material.dart';
|
||||||
|
|
||||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
|
|
||||||
|
import 'package:fladder/models/items/media_segments_model.dart';
|
||||||
import 'package:fladder/providers/video_player_provider.dart';
|
import 'package:fladder/providers/video_player_provider.dart';
|
||||||
|
import 'package:fladder/screens/shared/animated_fade_size.dart';
|
||||||
import 'package:fladder/screens/video_player/components/video_player_chapters.dart';
|
import 'package:fladder/screens/video_player/components/video_player_chapters.dart';
|
||||||
import 'package:fladder/screens/video_player/components/video_player_queue.dart';
|
import 'package:fladder/screens/video_player/components/video_player_queue.dart';
|
||||||
|
import 'package:fladder/util/localization_helper.dart';
|
||||||
|
|
||||||
class ChapterButton extends ConsumerWidget {
|
class ChapterButton extends ConsumerWidget {
|
||||||
final Duration position;
|
final Duration position;
|
||||||
|
|
@ -61,28 +64,36 @@ class OpenQueueButton extends ConsumerWidget {
|
||||||
}
|
}
|
||||||
|
|
||||||
class SkipSegmentButton extends ConsumerWidget {
|
class SkipSegmentButton extends ConsumerWidget {
|
||||||
final String label;
|
final MediaSegment? segment;
|
||||||
final bool isOverlayVisible;
|
final bool isOverlayVisible;
|
||||||
|
|
||||||
final Function() pressedSkip;
|
final Function() pressedSkip;
|
||||||
const SkipSegmentButton({required this.label, required this.isOverlayVisible, required this.pressedSkip, super.key});
|
const SkipSegmentButton(
|
||||||
|
{required this.segment, required this.isOverlayVisible, required this.pressedSkip, super.key});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context, WidgetRef ref) {
|
Widget build(BuildContext context, WidgetRef ref) {
|
||||||
return AnimatedOpacity(
|
return AnimatedFadeSize(
|
||||||
opacity: isOverlayVisible ? 0.85 : 0,
|
child: segment != null
|
||||||
duration: const Duration(milliseconds: 500),
|
? AnimatedOpacity(
|
||||||
child: ElevatedButton(
|
opacity: isOverlayVisible ? 1 : 0.15,
|
||||||
onPressed: pressedSkip,
|
duration: const Duration(milliseconds: 500),
|
||||||
style: ElevatedButton.styleFrom(shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(5))),
|
child: ElevatedButton(
|
||||||
child: Padding(
|
onPressed: pressedSkip,
|
||||||
padding: const EdgeInsets.all(8),
|
style: ElevatedButton.styleFrom(shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(5))),
|
||||||
child: Row(
|
child: Padding(
|
||||||
mainAxisSize: MainAxisSize.min,
|
padding: const EdgeInsets.all(8),
|
||||||
children: [Text(label), const Icon(Icons.skip_next_rounded)],
|
child: Row(
|
||||||
),
|
mainAxisSize: MainAxisSize.min,
|
||||||
),
|
children: [
|
||||||
),
|
Text(context.localized.skipButtonLabel(segment!.type.label(context))),
|
||||||
|
const Icon(Icons.skip_next_rounded)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: const SizedBox.shrink(key: Key("Other")),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -159,18 +159,17 @@ class _DesktopControlsState extends ConsumerState<DesktopControls> {
|
||||||
bool forceShow = segment?.forceShow(position) ?? false;
|
bool forceShow = segment?.forceShow(position) ?? false;
|
||||||
return Stack(
|
return Stack(
|
||||||
children: [
|
children: [
|
||||||
if (segment != null)
|
Align(
|
||||||
Align(
|
alignment: Alignment.centerRight,
|
||||||
alignment: Alignment.centerRight,
|
child: Padding(
|
||||||
child: Padding(
|
padding: const EdgeInsets.all(32),
|
||||||
padding: const EdgeInsets.all(32),
|
child: SkipSegmentButton(
|
||||||
child: SkipSegmentButton(
|
segment: segment,
|
||||||
label: context.localized.skipButtonLabel(segment.type.label(context).toLowerCase()),
|
isOverlayVisible: forceShow ? true : showOverlay,
|
||||||
isOverlayVisible: forceShow ? true : showOverlay,
|
pressedSkip: () => skipToSegmentEnd(segment),
|
||||||
pressedSkip: () => skipToSegmentEnd(segment),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue