|
|
|
@ -4,6 +4,9 @@ import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:recook/constants/constants.dart';
|
|
|
|
|
import 'package:recook/widgets/custom_app_bar.dart';
|
|
|
|
|
import 'package:recook/widgets/recook_back_button.dart';
|
|
|
|
|
import 'package:video_trimmer/trim_editor.dart';
|
|
|
|
|
import 'package:video_trimmer/video_trimmer.dart';
|
|
|
|
|
import 'package:video_trimmer/video_viewer.dart';
|
|
|
|
|
|
|
|
|
|
class CropVideoPage extends StatefulWidget {
|
|
|
|
|
final File file;
|
|
|
|
@ -14,9 +17,22 @@ class CropVideoPage extends StatefulWidget {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class _CropVideoPageState extends State<CropVideoPage> {
|
|
|
|
|
Trimmer _trimmer = Trimmer();
|
|
|
|
|
|
|
|
|
|
double _startValue = 0.0;
|
|
|
|
|
double _endValue = 0.0;
|
|
|
|
|
|
|
|
|
|
bool _isPlaying = false;
|
|
|
|
|
|
|
|
|
|
bool _loading = true;
|
|
|
|
|
@override
|
|
|
|
|
void initState() {
|
|
|
|
|
super.initState();
|
|
|
|
|
_trimmer.loadVideo(videoFile: widget.file).then((_) {
|
|
|
|
|
setState(() {
|
|
|
|
|
_loading = false;
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
@ -24,6 +40,7 @@ class _CropVideoPageState extends State<CropVideoPage> {
|
|
|
|
|
return Scaffold(
|
|
|
|
|
backgroundColor: Color(0xFF232323),
|
|
|
|
|
appBar: CustomAppBar(
|
|
|
|
|
elevation: 0,
|
|
|
|
|
appBackground: Color(0xFF232323),
|
|
|
|
|
leading: RecookBackButton(white: true),
|
|
|
|
|
actions: [
|
|
|
|
@ -44,6 +61,34 @@ class _CropVideoPageState extends State<CropVideoPage> {
|
|
|
|
|
SizedBox(width: rSize(15)),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
body: _loading
|
|
|
|
|
? Center(child: CircularProgressIndicator())
|
|
|
|
|
: Column(
|
|
|
|
|
children: [
|
|
|
|
|
Expanded(
|
|
|
|
|
child: VideoViewer(),
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
margin: EdgeInsets.only(bottom: rSize(35)),
|
|
|
|
|
child: TrimEditor(
|
|
|
|
|
viewerWidth: MediaQuery.of(context).size.width,
|
|
|
|
|
fit: BoxFit.cover,
|
|
|
|
|
viewerHeight: rSize(68),
|
|
|
|
|
onChangeStart: (value) {
|
|
|
|
|
_startValue = value;
|
|
|
|
|
},
|
|
|
|
|
onChangeEnd: (value) {
|
|
|
|
|
_endValue = value;
|
|
|
|
|
},
|
|
|
|
|
onChangePlaybackState: (value) {
|
|
|
|
|
setState(() {
|
|
|
|
|
_isPlaying = value;
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|