Video Player
import 'package:flutter/material.dart';
import 'package:webview_flutter/webview_flutter.dart';
class ScreenPalVideoPage extends StatefulWidget {
const ScreenPalVideoPage({Key? key}) : super(key: key);
@override
State createState() => _ScreenPalVideoPageState();
}
class _ScreenPalVideoPageState extends State {
late final WebViewController _controller;
@override
void initState() {
super.initState();
_controller = WebViewController()
..setJavaScriptMode(JavaScriptMode.unrestricted)
..loadRequest(Uri.parse(
'https://go.screenpal.com/player/cT1ni5n6d5c?ff=1&title=0&autoPlay=1'));
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: const Text('ScreenPal Video')),
body: SingleChildScrollView(
padding: const EdgeInsets.all(16),
child: Column(
children: [
// Container for video like YouTube player
AspectRatio(
aspectRatio: 16 / 9, // YouTube video ratio
child: ClipRRect(
borderRadius: BorderRadius.circular(12),
child: WebViewWidget(controller: _controller),
),
),
const SizedBox(height: 20),
// Sample content below video
const Text(
'ScreenPal Tutorial Video',
style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
),
const SizedBox(height: 10),
const Text(
'This video is embedded in a container like YouTube, not fullscreen.',
textAlign: TextAlign.center,
),
],
),
),
);
}
}

0 Comments