version bump to 1.0.1
This commit is contained in:
		@@ -1,92 +0,0 @@
 | 
				
			|||||||
import 'package:f0ckapp/models/mediaitem_detail.dart';
 | 
					 | 
				
			||||||
import 'package:flutter/material.dart';
 | 
					 | 
				
			||||||
import 'package:media_kit/media_kit.dart';
 | 
					 | 
				
			||||||
import 'package:media_kit_video/media_kit_video.dart';
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
class VideoWidget extends StatefulWidget {
 | 
					 | 
				
			||||||
  final MediaItemDetail details;
 | 
					 | 
				
			||||||
  const VideoWidget({super.key, required this.details});
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  @override
 | 
					 | 
				
			||||||
  State createState() => _VideoWidgetState();
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
class _VideoWidgetState extends State<VideoWidget> {
 | 
					 | 
				
			||||||
  late final Player _player;
 | 
					 | 
				
			||||||
  late final VideoController _controller;
 | 
					 | 
				
			||||||
  double? _aspectRatio;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  @override
 | 
					 | 
				
			||||||
  void initState() {
 | 
					 | 
				
			||||||
    super.initState();
 | 
					 | 
				
			||||||
    _player = Player();
 | 
					 | 
				
			||||||
    _controller = VideoController(_player);
 | 
					 | 
				
			||||||
    _player.open(Media(widget.details.mediaUrl));
 | 
					 | 
				
			||||||
    _player.setPlaylistMode(PlaylistMode.loop);
 | 
					 | 
				
			||||||
    _player.setVolume(0);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    //_player.stream.height.first;
 | 
					 | 
				
			||||||
    _player.stream.playing.listen((blah) {
 | 
					 | 
				
			||||||
      setState(() {
 | 
					 | 
				
			||||||
        Future.microtask(() async {
 | 
					 | 
				
			||||||
          int h = await _player.stream.height.first ?? 0;
 | 
					 | 
				
			||||||
          int w = await _player.stream.width.first ?? 0;
 | 
					 | 
				
			||||||
          _aspectRatio = h / w;
 | 
					 | 
				
			||||||
          print(_aspectRatio);
 | 
					 | 
				
			||||||
        });
 | 
					 | 
				
			||||||
      });
 | 
					 | 
				
			||||||
    });
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  @override
 | 
					 | 
				
			||||||
  void dispose() {
 | 
					 | 
				
			||||||
    _player.dispose();
 | 
					 | 
				
			||||||
    super.dispose();
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  @override
 | 
					 | 
				
			||||||
  Widget build(BuildContext context) {
 | 
					 | 
				
			||||||
    //_aspectRatio = _controller.player.state.height! / _controller.player.state.width!;
 | 
					 | 
				
			||||||
    print(_aspectRatio);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    return Scaffold(
 | 
					 | 
				
			||||||
      appBar: AppBar(
 | 
					 | 
				
			||||||
        backgroundColor: const Color.fromARGB(255, 43, 43, 43),
 | 
					 | 
				
			||||||
        foregroundColor: const Color.fromARGB(255, 255, 255, 255),
 | 
					 | 
				
			||||||
        title: Text('f0ck #${widget.details.id}'),
 | 
					 | 
				
			||||||
        centerTitle: true,
 | 
					 | 
				
			||||||
      ),
 | 
					 | 
				
			||||||
      body: Column(
 | 
					 | 
				
			||||||
        children: [
 | 
					 | 
				
			||||||
          if (_aspectRatio != null)
 | 
					 | 
				
			||||||
            AspectRatio(
 | 
					 | 
				
			||||||
              aspectRatio: _aspectRatio!,
 | 
					 | 
				
			||||||
              child: Video(
 | 
					 | 
				
			||||||
                controller: _controller,
 | 
					 | 
				
			||||||
                fit: BoxFit.cover,
 | 
					 | 
				
			||||||
                alignment: Alignment.topCenter,
 | 
					 | 
				
			||||||
              ),
 | 
					 | 
				
			||||||
            )
 | 
					 | 
				
			||||||
          else
 | 
					 | 
				
			||||||
            SizedBox(
 | 
					 | 
				
			||||||
              width: double.infinity,
 | 
					 | 
				
			||||||
              height: MediaQuery.of(context).size.height * 0.75,
 | 
					 | 
				
			||||||
              child: Video(
 | 
					 | 
				
			||||||
                controller: _controller,
 | 
					 | 
				
			||||||
                fit: BoxFit.cover,
 | 
					 | 
				
			||||||
                alignment: Alignment.topCenter,
 | 
					 | 
				
			||||||
              ),
 | 
					 | 
				
			||||||
            ),
 | 
					 | 
				
			||||||
          const SizedBox(height: 10),
 | 
					 | 
				
			||||||
          Text(
 | 
					 | 
				
			||||||
            'f0cked by: ${widget.details.username}',
 | 
					 | 
				
			||||||
            style: const TextStyle(
 | 
					 | 
				
			||||||
              fontSize: 16,
 | 
					 | 
				
			||||||
              color: Color.fromARGB(255, 255, 255, 255),
 | 
					 | 
				
			||||||
            ),
 | 
					 | 
				
			||||||
          ),
 | 
					 | 
				
			||||||
        ],
 | 
					 | 
				
			||||||
      ),
 | 
					 | 
				
			||||||
    );
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
 | 
				
			|||||||
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
 | 
					# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
 | 
				
			||||||
# In Windows, build-name is used as the major, minor, and patch parts
 | 
					# In Windows, build-name is used as the major, minor, and patch parts
 | 
				
			||||||
# of the product and file versions while build-number is used as the build suffix.
 | 
					# of the product and file versions while build-number is used as the build suffix.
 | 
				
			||||||
version: 1.0.0+1
 | 
					version: 1.0.1+1
 | 
				
			||||||
 | 
					
 | 
				
			||||||
environment:
 | 
					environment:
 | 
				
			||||||
  sdk: ^3.9.0-172.0.dev
 | 
					  sdk: ^3.9.0-172.0.dev
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user