adding video background

This commit is contained in:
ALEZ-DEV 2024-05-12 00:08:27 +02:00
parent 9aaf3a0672
commit 66146b10f8
4 changed files with 90 additions and 13 deletions

View File

@ -1,11 +1,14 @@
import 'package:babylonia_terminal_launcher/screens/screens.dart';
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:media_kit/media_kit.dart';
import 'package:yaru/theme.dart';
import './screens/screens.dart';
void main() {
WidgetsFlutterBinding.ensureInitialized();
MediaKit.ensureInitialized();
runApp(const BabyloniaLauncher());
}

View File

@ -1,27 +1,34 @@
import 'package:flutter/material.dart';
import './../widgets/background.dart';
class HomeScreen extends StatelessWidget {
const HomeScreen({super.key});
@override
Widget build(BuildContext context) {
return SizedBox(
child: Align(
alignment: Alignment.bottomCenter,
child: Padding(
padding: const EdgeInsets.only(bottom: 50),
child: FilledButton(
onPressed: () {},
child: const SizedBox(
width: 300,
height: 25,
child: Center(
child: Text("Download"),
return Stack(
children: [
const Background(),
SizedBox(
child: Align(
alignment: Alignment.bottomCenter,
child: Padding(
padding: const EdgeInsets.only(bottom: 50),
child: FilledButton(
onPressed: () {},
child: const SizedBox(
width: 300,
height: 25,
child: Center(
child: Text("Download"),
),
),
),
),
),
),
),
],
);
}
}

View File

@ -0,0 +1,37 @@
import 'package:flutter/material.dart';
import 'package:media_kit/media_kit.dart';
import 'package:media_kit_video/media_kit_video.dart';
class Background extends StatefulWidget {
const Background({super.key});
@override
State<Background> createState() => _BackgroundState();
}
class _BackgroundState extends State<Background> {
late final player = Player();
late final controller = VideoController(player);
@override
void initState() {
super.initState();
player.open(
Media(
'https://media-cdn-zspms.kurogame.net/pnswebsite/website2.0/video/1715184000000/1l5uvj9eqpjjcazt4p-1715219648481.mp4',
),
);
}
@override
void dispose() {
player.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
player.play();
return Video(controller: controller);
}
}

View File

@ -36,6 +36,36 @@ dependencies:
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^1.0.6
yaru: ^4.1.0
# media_kit: ^1.1.10+1
# media_kit_video: ^1.2.4
# media_kit_libs_video: ^1.0.4
media_kit: any
media_kit_video: any
media_kit_libs_video: any
media_kit_native_event_loop: any
dependency_overrides:
media_kit:
git:
url: https://github.com/media-kit/media-kit
path: media_kit
ref: main
media_kit_video:
git:
url: https://github.com/media-kit/media-kit
path: media_kit_video
ref: main
media_kit_libs_video:
git:
url: https://github.com/media-kit/media-kit
path: libs/universal/media_kit_libs_video
ref: main
media_kit_native_event_loop:
git:
url: https://github.com/media-kit/media-kit
path: media_kit_native_event_loop
ref: main
dev_dependencies:
flutter_test: