Files
holobooth/lib/share/widgets/video_dialog.dart
Alejandro Santiago cb6741cc8e chore: bump Flutter and Dart SDK to latest versions (#438)
<!--
  Thanks for contributing!

Provide a description of your changes below and a general summary in the
title

Please look at the following checklist to ensure that your PR can be
accepted quickly:
-->

## Description

Changes:
- Bump min dart SDK to 2.19.0
- Bump Flutter version to 3.7.12
- Used Very Good Analysis 4.0.0
- Corrected new analyzer issues
- Dart format

## Type of Change

<!--- Put an `x` in all the boxes that apply: -->

- [ ]  New feature (non-breaking change which adds functionality)
- [ ] 🛠️ Bug fix (non-breaking change which fixes an issue)
- [ ]  Breaking change (fix or feature that would cause existing
functionality to change)
- [ ] 🧹 Code refactor
- [ ]  Build configuration change
- [ ] 📝 Documentation
- [X] 🗑️ Chore
2023-06-27 15:57:39 -07:00

65 lines
1.6 KiB
Dart

import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:holobooth/convert/convert.dart';
import 'package:holobooth/share/share.dart';
import 'package:holobooth_ui/holobooth_ui.dart';
class VideoDialogLauncher extends StatelessWidget {
const VideoDialogLauncher({
required this.convertBloc,
super.key,
});
final ConvertBloc convertBloc;
@override
Widget build(BuildContext context) {
return BlocBuilder<ConvertBloc, ConvertState>(
bloc: convertBloc,
builder: (_, state) {
if (state.status == ConvertStatus.videoCreated) {
return VideoDialog(videoPath: state.videoPath);
}
return const Center(
child: SizedBox.square(
dimension: 96,
child: CircularProgressIndicator(
color: HoloBoothColors.convertLoading,
),
),
);
},
);
}
}
class VideoDialog extends StatefulWidget {
const VideoDialog({required this.videoPath, super.key});
final String videoPath;
@override
State<VideoDialog> createState() => _VideoDialogState();
}
class _VideoDialogState extends State<VideoDialog> {
bool videoInitialized = false;
@override
Widget build(BuildContext context) {
return AnimatedScale(
scale: videoInitialized ? 1 : 0,
duration: const Duration(milliseconds: 400),
child: VideoPlayerView(
url: widget.videoPath,
onInitialized: () {
setState(() {
videoInitialized = true;
});
},
),
);
}
}