12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- import 'dart:io';
- import 'dart:math';
- import 'package:cached_network_image/cached_network_image.dart';
- import 'package:flutter/material.dart';
- import 'package:flutter/services.dart';
- import 'package:get_it/get_it.dart';
- import 'package:provider/provider.dart';
- import 'package:sport/application.dart';
- import 'package:sport/bean/carousel.dart';
- import 'package:sport/bean/game.dart';
- import 'package:sport/pages/game/game_detail.dart';
- import 'package:sport/provider/game_model.dart';
- import 'package:sport/router/navigator_util.dart';
- import 'package:sport/widgets/image.dart';
- import 'package:sport/widgets/video.dart';
- import 'package:umeng_common_sdk/umeng_common_sdk.dart';
- import 'package:url_launcher/url_launcher.dart';
- import 'package:video_player/video_player.dart';
- import 'package:visibility_detector/visibility_detector.dart';
- class VideoPage extends StatefulWidget {
- final String url;
- final bool autoPlay;
- final bool loop;
- const VideoPage({Key? key, required this.url, this.autoPlay = false, this.loop = true}) : super(key: key);
- @override
- State<StatefulWidget> createState() => _VideoState();
- }
- class _VideoState extends State<VideoPage> {
- @override
- void initState() {
- super.initState();
- SystemChrome.setPreferredOrientations(Platform.isIOS ? [DeviceOrientation.landscapeRight] : [DeviceOrientation.landscapeLeft]);
- SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual, overlays: []);
- }
- @override
- void dispose() {
- SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
- SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual, overlays: [SystemUiOverlay.bottom, SystemUiOverlay.top]);
- super.dispose();
- }
- @override
- Widget build(BuildContext context) {
- return Scaffold(
- backgroundColor: Colors.white,
- body: Stack(
- fit: StackFit.expand,
- children: [
- VideoWidget(
- carousel: Carousel(
- url: widget.url,
- id: 0,
- type: "",
- gameId: 0,
- outerUrl: '',
- outerDesc: '',
- cover: null,
- position: 0,
- ),
- autoPlay: widget.autoPlay,
- loop: widget.loop,
- ),
- Positioned(
- left: 8,top: 12,
- child:
- IconButton(
- icon: arrowBack(),
- onPressed: () {
- Navigator.pop(context);
- },
- ),)
- ],
- ),
- );
- }
- }
|