Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

null-safety-migration #106

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions example/.flutter-plugins-dependencies
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"flutter_video_compress","path":"/Users/develappsdeveloper/development/felipe/migrations/flutter_video_compress/","dependencies":[]},{"name":"image_picker","path":"/Users/develappsdeveloper/development/flutter/.pub-cache/hosted/pub.dartlang.org/image_picker-0.8.4+4/","dependencies":[]},{"name":"video_player","path":"/Users/develappsdeveloper/development/flutter/.pub-cache/hosted/pub.dartlang.org/video_player-2.2.6/","dependencies":[]}],"android":[{"name":"flutter_plugin_android_lifecycle","path":"/Users/develappsdeveloper/development/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_plugin_android_lifecycle-2.0.4/","dependencies":[]},{"name":"flutter_video_compress","path":"/Users/develappsdeveloper/development/felipe/migrations/flutter_video_compress/","dependencies":[]},{"name":"image_picker","path":"/Users/develappsdeveloper/development/flutter/.pub-cache/hosted/pub.dartlang.org/image_picker-0.8.4+4/","dependencies":["flutter_plugin_android_lifecycle"]},{"name":"video_player","path":"/Users/develappsdeveloper/development/flutter/.pub-cache/hosted/pub.dartlang.org/video_player-2.2.6/","dependencies":[]}],"macos":[],"linux":[],"windows":[],"web":[{"name":"image_picker_for_web","path":"/Users/develappsdeveloper/development/flutter/.pub-cache/hosted/pub.dartlang.org/image_picker_for_web-2.1.4/","dependencies":[]},{"name":"video_player_web","path":"/Users/develappsdeveloper/development/flutter/.pub-cache/hosted/pub.dartlang.org/video_player_web-2.0.4/","dependencies":[]}]},"dependencyGraph":[{"name":"flutter_plugin_android_lifecycle","dependencies":[]},{"name":"flutter_video_compress","dependencies":[]},{"name":"image_picker","dependencies":["flutter_plugin_android_lifecycle","image_picker_for_web"]},{"name":"image_picker_for_web","dependencies":[]},{"name":"video_player","dependencies":["video_player_web"]},{"name":"video_player_web","dependencies":[]}],"date_created":"2021-11-06 13:03:33.632315","version":"2.5.3"}
13 changes: 13 additions & 0 deletions example/ios/Flutter/flutter_export_environment.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/sh
# This is a generated file; do not edit or check into version control.
export "FLUTTER_ROOT=/Users/develappsdeveloper/development/flutter"
export "FLUTTER_APPLICATION_PATH=/Users/develappsdeveloper/development/felipe/migrations/flutter_video_compress/example"
export "COCOAPODS_PARALLEL_CODE_SIGN=true"
export "FLUTTER_TARGET=lib/main.dart"
export "FLUTTER_BUILD_DIR=build"
export "FLUTTER_BUILD_NAME=1.0.0"
export "FLUTTER_BUILD_NUMBER=1"
export "DART_OBFUSCATION=false"
export "TRACK_WIDGET_CREATION=false"
export "TREE_SHAKE_ICONS=false"
export "PACKAGE_CONFIG=.packages"
46 changes: 24 additions & 22 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,22 @@ void main() => runApp(MyApp(title: 'Flutter Video Compress Example'));
class MyApp extends StatefulWidget {
MyApp({this.title});

final String title;
final String? title;

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

class _MyAppState extends State<MyApp> {
final _flutterVideoCompress = FlutterVideoCompress();
Subscription _subscription;
Subscription? _subscription;

Image _thumbnailFileImage;
Image _gifFileImage;
Image? _thumbnailFileImage;
Image? _gifFileImage;

MediaInfo _originalVideoInfo = MediaInfo(path: '');
MediaInfo _compressedVideoInfo = MediaInfo(path: '');
String _taskName;
String? _taskName;
double _progressState = 0;

final _loadingStreamCtrl = StreamController<bool>.broadcast();
Expand All @@ -46,7 +46,7 @@ class _MyAppState extends State<MyApp> {
@override
void dispose() {
super.dispose();
_subscription.unsubscribe();
_subscription?.unsubscribe();
_loadingStreamCtrl.close();
}

Expand Down Expand Up @@ -95,11 +95,11 @@ class _MyAppState extends State<MyApp> {

Widget _buildMaterialWarp(Widget body) {
return MaterialApp(
title: widget.title,
title: widget.title ?? "",
theme: myTheme,
home: Scaffold(
appBar: AppBar(
title: Text(widget.title),
title: Text(widget.title ?? ""),
actions: <Widget>[
IconButton(
onPressed: () async {
Expand All @@ -121,9 +121,9 @@ class _MyAppState extends State<MyApp> {
child: Text(text, style: TextStyle(color: Colors.white)),
color: Colors.grey[800],
onPressed: () async {
final videoFile = await ImagePicker.pickVideo(source: source);
final videoFile = await ImagePicker().pickVideo(source: source);
if (videoFile != null) {
runFlutterVideoCompressMethods(videoFile);
runFlutterVideoCompressMethods(videoFile as File);
}
},
),
Expand All @@ -141,7 +141,7 @@ class _MyAppState extends State<MyApp> {
}

List<Widget> _buildInfoPanel(String title,
{MediaInfo info, Image image, bool isVideoModel = false}) {
{MediaInfo? info, Image? image, bool isVideoModel = false}) {
if (info?.file == null && image == null && !isVideoModel) return [];
return [
if (!isVideoModel || info?.file != null)
Expand All @@ -154,10 +154,10 @@ class _MyAppState extends State<MyApp> {
if (info?.file != null)
Padding(
padding: const EdgeInsets.all(8),
child: Text(_infoConvert(info)),
child: Text(_infoConvert(info!)),
),
if (image != null) image,
if (isVideoModel && info?.file != null) VideoPlayerView(file: info.file)
if (isVideoModel && info?.file != null) VideoPlayerView(file: info!.file!)
];
}

Expand Down Expand Up @@ -253,24 +253,26 @@ class _MyAppState extends State<MyApp> {
class VideoPlayerView extends StatefulWidget {
VideoPlayerView({this.file});

final File file;
final File? file;

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

class _VideoPlayerViewState extends State<VideoPlayerView> {
VideoPlayerController _controller;
late VideoPlayerController _controller;

@override
void initState() {
super.initState();
_controller = VideoPlayerController.file(widget.file)
..initialize().then((_) {
setState(() {});
})
..setVolume(1)
..play();
if (widget.file != null) {
_controller = VideoPlayerController.file(widget.file!)
..initialize().then((_) {
setState(() {});
})
..setVolume(1)
..play();
}
}

@override
Expand All @@ -297,7 +299,7 @@ class _VideoPlayerViewState extends State<VideoPlayerView> {
Stack(
alignment: Alignment.center,
children: <Widget>[
_controller.value.initialized
_controller.value.isInitialized
? AspectRatio(
aspectRatio: _controller.value.aspectRatio,
child: VideoPlayer(_controller),
Expand Down
122 changes: 21 additions & 101 deletions example/lib/my-theme.dart
Original file line number Diff line number Diff line change
Expand Up @@ -81,55 +81,55 @@ final ThemeData myTheme = ThemeData(
),
),
textTheme: TextTheme(
display4: TextStyle(
headline1: TextStyle(
color: Color(0xb3ffffff),
fontSize: 96.0,
fontWeight: FontWeight.w300,
fontStyle: FontStyle.normal,
),
display3: TextStyle(
headline2: TextStyle(
color: Color(0xb3ffffff),
fontSize: 60.0,
fontWeight: FontWeight.w300,
fontStyle: FontStyle.normal,
),
display2: TextStyle(
headline3: TextStyle(
color: Color(0xb3ffffff),
fontSize: 48.0,
fontWeight: FontWeight.w400,
fontStyle: FontStyle.normal,
),
display1: TextStyle(
headline4: TextStyle(
color: Color(0xb3ffffff),
fontSize: 34.0,
fontWeight: FontWeight.w400,
fontStyle: FontStyle.normal,
),
headline: TextStyle(
headline5: TextStyle(
color: Color(0xffffffff),
fontSize: 24.0,
fontWeight: FontWeight.w400,
fontStyle: FontStyle.normal,
),
title: TextStyle(
headline6: TextStyle(
color: Color(0xffffffff),
fontSize: 20.0,
fontWeight: FontWeight.w500,
fontStyle: FontStyle.normal,
),
subhead: TextStyle(
subtitle1: TextStyle(
color: Color(0xffffffff),
fontSize: 16.0,
fontWeight: FontWeight.w400,
fontStyle: FontStyle.normal,
),
body2: TextStyle(
bodyText1: TextStyle(
color: Color(0xffffffff),
fontSize: 14.0,
fontWeight: FontWeight.w400,
fontStyle: FontStyle.normal,
),
body1: TextStyle(
bodyText2: TextStyle(
color: Color(0xffffffff),
fontSize: 16.0,
fontWeight: FontWeight.w400,
Expand All @@ -147,7 +147,7 @@ final ThemeData myTheme = ThemeData(
fontWeight: FontWeight.w500,
fontStyle: FontStyle.normal,
),
subtitle: TextStyle(
subtitle2: TextStyle(
color: Color(0xffffffff),
fontSize: 14.0,
fontWeight: FontWeight.w500,
Expand All @@ -161,55 +161,55 @@ final ThemeData myTheme = ThemeData(
),
),
primaryTextTheme: TextTheme(
display4: TextStyle(
headline1: TextStyle(
color: Color(0xb3ffffff),
fontSize: 96.0,
fontWeight: FontWeight.w300,
fontStyle: FontStyle.normal,
),
display3: TextStyle(
headline2: TextStyle(
color: Color(0xb3ffffff),
fontSize: 60.0,
fontWeight: FontWeight.w300,
fontStyle: FontStyle.normal,
),
display2: TextStyle(
headline3: TextStyle(
color: Color(0xb3ffffff),
fontSize: 48.0,
fontWeight: FontWeight.w400,
fontStyle: FontStyle.normal,
),
display1: TextStyle(
headline4: TextStyle(
color: Color(0xb3ffffff),
fontSize: 34.0,
fontWeight: FontWeight.w400,
fontStyle: FontStyle.normal,
),
headline: TextStyle(
headline5: TextStyle(
color: Color(0xffffffff),
fontSize: 24.0,
fontWeight: FontWeight.w400,
fontStyle: FontStyle.normal,
),
title: TextStyle(
headline6: TextStyle(
color: Color(0xffffffff),
fontSize: 20.0,
fontWeight: FontWeight.w500,
fontStyle: FontStyle.normal,
),
subhead: TextStyle(
subtitle1: TextStyle(
color: Color(0xffffffff),
fontSize: 16.0,
fontWeight: FontWeight.w400,
fontStyle: FontStyle.normal,
),
body2: TextStyle(
bodyText1: TextStyle(
color: Color(0xffffffff),
fontSize: 14.0,
fontWeight: FontWeight.w400,
fontStyle: FontStyle.normal,
),
body1: TextStyle(
bodyText2: TextStyle(
color: Color(0xffffffff),
fontSize: 16.0,
fontWeight: FontWeight.w400,
Expand All @@ -227,7 +227,7 @@ final ThemeData myTheme = ThemeData(
fontWeight: FontWeight.w500,
fontStyle: FontStyle.normal,
),
subtitle: TextStyle(
subtitle2: TextStyle(
color: Color(0xffffffff),
fontSize: 14.0,
fontWeight: FontWeight.w500,
Expand All @@ -240,86 +240,6 @@ final ThemeData myTheme = ThemeData(
fontStyle: FontStyle.normal,
),
),
accentTextTheme: TextTheme(
display4: TextStyle(
color: Color(0x8a000000),
fontSize: 96.0,
fontWeight: FontWeight.w300,
fontStyle: FontStyle.normal,
),
display3: TextStyle(
color: Color(0x8a000000),
fontSize: 60.0,
fontWeight: FontWeight.w300,
fontStyle: FontStyle.normal,
),
display2: TextStyle(
color: Color(0x8a000000),
fontSize: 48.0,
fontWeight: FontWeight.w400,
fontStyle: FontStyle.normal,
),
display1: TextStyle(
color: Color(0x8a000000),
fontSize: 34.0,
fontWeight: FontWeight.w400,
fontStyle: FontStyle.normal,
),
headline: TextStyle(
color: Color(0xdd000000),
fontSize: 24.0,
fontWeight: FontWeight.w400,
fontStyle: FontStyle.normal,
),
title: TextStyle(
color: Color(0xdd000000),
fontSize: 20.0,
fontWeight: FontWeight.w500,
fontStyle: FontStyle.normal,
),
subhead: TextStyle(
color: Color(0xdd000000),
fontSize: 16.0,
fontWeight: FontWeight.w400,
fontStyle: FontStyle.normal,
),
body2: TextStyle(
color: Color(0xdd000000),
fontSize: 14.0,
fontWeight: FontWeight.w400,
fontStyle: FontStyle.normal,
),
body1: TextStyle(
color: Color(0xdd000000),
fontSize: 16.0,
fontWeight: FontWeight.w400,
fontStyle: FontStyle.normal,
),
caption: TextStyle(
color: Color(0x8a000000),
fontSize: 12.0,
fontWeight: FontWeight.w400,
fontStyle: FontStyle.normal,
),
button: TextStyle(
color: Color(0xdd000000),
fontSize: 14.0,
fontWeight: FontWeight.w500,
fontStyle: FontStyle.normal,
),
subtitle: TextStyle(
color: Color(0xff000000),
fontSize: 14.0,
fontWeight: FontWeight.w500,
fontStyle: FontStyle.normal,
),
overline: TextStyle(
color: Color(0xff000000),
fontSize: 10.0,
fontWeight: FontWeight.w400,
fontStyle: FontStyle.normal,
),
),
inputDecorationTheme: InputDecorationTheme(
labelStyle: TextStyle(
color: Color(0xffffffff),
Expand All @@ -346,7 +266,7 @@ final ThemeData myTheme = ThemeData(
fontStyle: FontStyle.normal,
),
errorMaxLines: null,
hasFloatingPlaceholder: true,
floatingLabelBehavior: FloatingLabelBehavior.auto,
isDense: false,
contentPadding:
EdgeInsets.only(top: 12.0, bottom: 12.0, left: 0.0, right: 0.0),
Expand Down
Loading