feat: initialize new Flutter project with core feature structure and cross-platform configuration
This commit is contained in:
@@ -0,0 +1,58 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:media_kit/media_kit.dart';
|
||||
import 'package:media_kit_video/media_kit_video.dart';
|
||||
|
||||
class TVPlayerScreen extends StatefulWidget {
|
||||
final String url;
|
||||
final String? title;
|
||||
|
||||
const TVPlayerScreen({super.key, required this.url, this.title});
|
||||
|
||||
@override
|
||||
State<TVPlayerScreen> createState() => _TVPlayerScreenState();
|
||||
}
|
||||
|
||||
class _TVPlayerScreenState extends State<TVPlayerScreen> {
|
||||
late final player = Player();
|
||||
late final controller = VideoController(player);
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
player.open(Media(widget.url));
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
player.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: Colors.black,
|
||||
body: Stack(
|
||||
children: [
|
||||
Video(controller: controller),
|
||||
if (widget.title != null)
|
||||
Positioned(
|
||||
top: 40,
|
||||
left: 40,
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.black54,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: Text(
|
||||
widget.title!,
|
||||
style: const TextStyle(color: Colors.white, fontSize: 24),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user