import 'package:fijkplayer/fijkplayer.dart';
import 'package:flutter/material.dart';

class VideoScreen extends StatefulWidget {
  final String url = 'http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4';

  // VideoScreen({@required this.url});

  @override
  _VideoScreenState createState() => _VideoScreenState();
}

class _VideoScreenState extends State<VideoScreen> {
  final FijkPlayer player = FijkPlayer();

  _VideoScreenState();

  @override
  void initState() {
    super.initState();
    player.setDataSource(widget.url, autoPlay: true);
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(
          backgroundColor: Colors.black,
          title: Text('视频播放'),
          leading: GestureDetector(
            onTap: () {
              Navigator.pop(context);
            },
            child: Container(child: Icon(Icons.close,color: Colors.white)),
          ),
        ),
        body: Container(
          alignment: Alignment.center,
          child: FijkView(
            color: Colors.black,
            player: player,
          ),
        ));
  }

  @override
  void dispose() {
    super.dispose();
    player.release();
  }
}