123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167 |
- import 'package:fis_vid/data_host/data_host.dart';
- import 'package:flutter/material.dart';
- import 'package:get/get.dart';
- import 'index.dart';
- import 'view/main/desktop.dart';
- class VidPlayerPage extends StatefulWidget {
- const VidPlayerPage(this.url, {Key? key}) : super(key: key);
- final String url;
- @override
- State<StatefulWidget> createState() => _VidPlayerPageState();
- }
- class _VidPlayerPageState extends State<VidPlayerPage> {
- late final _dataHost = Get.put(VidDataHost(widget.url));
- late final _playerController =
- Get.put(VidPlayerController(dataHost: _dataHost));
- @override
- Widget build(BuildContext context) {
- // _playerController.load().then((value) {
- // _playerController.play();
- // });
- return FutureBuilder(
- future: _playerController.load(),
- builder: (_, snapshot) {
- if (snapshot.connectionState == ConnectionState.done) {
- if (_playerController.canPlay) {
- _playerController.play();
- return buildPage();
- } else {
- return const Material(child: Center(child: Text("Load fila")));
- }
- } else {
- return const Material(
- child: Center(child: CircularProgressIndicator()));
- }
- },
- );
- }
- Widget buildPage() {
- return Scaffold(
- // appBar: AppBar(),
- body: Row(
- children: [
- _LeftSider(),
- _Body(_playerController),
- _RightSider(),
- ],
- ),
- );
- }
- @override
- void dispose() {
- _playerController.dispose();
- super.dispose();
- }
- }
- class _Body extends StatelessWidget {
- const _Body(this.controller);
- final VidPlayerController controller;
- @override
- Widget build(BuildContext context) {
- const borderSide = BorderSide(color: Colors.grey);
- return Expanded(
- child: Container(
- decoration: const BoxDecoration(
- border: Border(left: borderSide, right: borderSide),
- ),
- child: Column(
- mainAxisSize: MainAxisSize.max,
- children: [
- const Expanded(
- // child: VidPlayer(controller),
- child: MeasureMainView(),
- ),
- SizedBox(
- height: 160,
- // color: Colors.black,
- child: controller.totalFramesCount > 1
- ? VidPlayerControlBoard(
- controller,
- )
- : Container(),
- ),
- ],
- ),
- ),
- );
- }
- }
- class _LeftSider extends StatelessWidget {
- @override
- Widget build(BuildContext context) {
- return Container(
- width: 180 + 12 * 2,
- alignment: Alignment.topCenter,
- padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 16),
- child: ListView.separated(
- itemCount: 20,
- itemBuilder: (_, index) {
- return Container(
- width: 180,
- height: 180,
- alignment: Alignment.center,
- decoration: BoxDecoration(
- border: Border.all(
- color: Colors.grey,
- ),
- ),
- child: const Text("Placeholder"),
- );
- },
- separatorBuilder: (_, index) {
- return const SizedBox(height: 8);
- },
- ),
- );
- }
- }
- class _RightSider extends StatelessWidget {
- @override
- Widget build(BuildContext context) {
- return Container(
- width: 320,
- // height: double.infinity,
- alignment: Alignment.topCenter,
- child: LayoutBuilder(
- builder: (context, constraints) {
- final height = constraints.biggest.height / 2;
- return Column(
- mainAxisSize: MainAxisSize.max,
- children: [
- Container(
- height: height,
- padding: const EdgeInsets.all(8),
- alignment: Alignment.topLeft,
- child: const Text('Measure Tools'),
- ),
- Container(
- height: height,
- padding: const EdgeInsets.all(8),
- decoration: const BoxDecoration(
- border: Border(
- top: BorderSide(color: Colors.grey),
- ),
- ),
- alignment: Alignment.topLeft,
- child: const Text('Comment'),
- ),
- ],
- );
- },
- ),
- );
- }
- }
|