import 'dart:io';

import  'package:camera_camera/camera_camera.dart';

import 'package:flutter/material.dart';

///@Description     录制视频页面
///@author          helinlin
///@create          2021-09-26 17:16
class VideoRecord extends StatefulWidget {
  const VideoRecord({Key key}) : super(key: key);

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

class _VideoRecordState extends State<VideoRecord> {
  File val;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(title: const Text('')),
        floatingActionButton: FloatingActionButton(
            child: const Icon(Icons.camera_alt),
            onPressed: () async {
              val = await showDialog(
                  context: context,
                  builder: (context) => Video(
                       /* mode: CameraMode.fullscreen,
                        initialCamera: CameraSide.back,
                        //enableCameraChange: false,
                        //  orientationEnablePhoto: CameraOrientation.landscape,
                        onChangeCamera: (direction, _) {
                          print('--------------');
                          print('$direction');
                          print('--------------');
                        },
                        // imageMask: CameraFocus.square(
                        //   color: Colors.black.withOpacity(0.5),
                        // ),*/
                      ));
              setState(() {});
            }),
        body: Center(
            child: Container(
                height: MediaQuery.of(context).size.height * 0.7,
                width: MediaQuery.of(context).size.width * 0.8,
                child: val != null
                    ? Image.file(
                        val,
                        fit: BoxFit.contain,
                      )
                    : const Text('Tire a foto'))));
  }
}
