import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:vid_player_demo/controller/player_controller.dart';
import 'package:vid_player_demo/pages/canvas_player/view.dart';

class ColorFilterPage extends StatefulWidget {
  const ColorFilterPage({Key? key}) : super(key: key);
  @override
  _ColorFilterPageState createState() => _ColorFilterPageState();
}

class _ColorFilterPageState extends State<ColorFilterPage> {
  final vidURLs = [
    "http://cdn-bj.fis.plus/093BE20682B14BFB95D811F221A2B2FD.vid",
  ];

  final _playerStateController = Get.put(PlayerStateController());

  @override
  void initState() {
    // TODO: implement initState
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(
          title: const Text("视频滤镜（亮度，对比度）"),
        ),
        body: Column(
          children: [
            const SizedBox(height: 24),
            ElevatedButton(
                onPressed: () => {_playerStateController.play(context)},
                child: const Text("Play Together")),
            const SizedBox(height: 24),
            SizedBox(
                height: 800,
                child: Row(
                  mainAxisAlignment: MainAxisAlignment.spaceAround,
                  children: [
                    CanvasPlayerView(vidURLs[0],
                        viewSize: const Size(700, 600)),
                    CanvasPlayerView(vidURLs[0],
                        viewSize: const Size(700, 600)),
                  ],
                )),
          ],
        ));
  }

  @override
  void dispose() {
    super.dispose();
    Get.delete<PlayerStateController>();
    _playerStateController.dispose();
  }
}
