Fladder/lib/util/debug_banner.dart
PartyDonut a518ae457e
chore: Update MPV package to latest version (#165)
Co-authored-by: PartyDonut <PartyDonut@users.noreply.github.com>
2024-11-28 21:42:40 +01:00

52 lines
1.7 KiB
Dart

import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:fladder/providers/video_player_provider.dart';
class DebugBanner extends ConsumerWidget {
final Widget child;
const DebugBanner({required this.child, super.key});
@override
Widget build(BuildContext context, WidgetRef ref) {
final isPlaying = ref.watch(mediaPlaybackProvider.select((value) => value.playing));
if (!kDebugMode) return child;
return Directionality(
textDirection: TextDirection.ltr,
child: Stack(
fit: StackFit.expand,
children: [
child,
Align(
alignment: Alignment.bottomRight,
child: AnimatedOpacity(
opacity: isPlaying ? 0 : 1,
duration: const Duration(milliseconds: 500),
child: IgnorePointer(
child: Padding(
padding: const EdgeInsets.all(4.0),
child: Card(
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(6)),
color: Colors.purpleAccent.withOpacity(0.8),
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 6, vertical: 2),
child: Text(
"Debug",
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
fontWeight: FontWeight.bold,
color: Colors.white,
),
),
),
),
),
),
),
)
],
),
);
}
}