From b7d2442ae9402ab8809f5abcd70a2d94e9bab78a Mon Sep 17 00:00:00 2001 From: Diego Tori Date: Thu, 13 Mar 2025 12:44:01 -0400 Subject: [PATCH 1/2] Added support for Flutter 3.29 while maintaining minimum support for 3.27. --- .github/workflows/ci.yml | 2 +- example/lib/app/app.dart | 97 ++++++++++++++++++++-------------------- example/lib/main.dart | 4 +- example/pubspec.yaml | 8 ++-- lib/chewie.dart | 4 +- pubspec.yaml | 12 ++--- 6 files changed, 62 insertions(+), 65 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c41375da9..9f29d8253 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -31,7 +31,7 @@ jobs: # refer to https://docs.flutter.dev/development/tools/sdk/releases. # Note: The version below should be manually updated to the latest second most recent version # after a new stable version comes out. - - "3.24.5" + - "3.27.4" - "3.x" steps: - name: 📚 Git Checkout diff --git a/example/lib/app/app.dart b/example/lib/app/app.dart index 59a2467f0..607881679 100644 --- a/example/lib/app/app.dart +++ b/example/lib/app/app.dart @@ -6,10 +6,7 @@ import 'package:flutter/material.dart'; import 'package:video_player/video_player.dart'; class ChewieDemo extends StatefulWidget { - const ChewieDemo({ - super.key, - this.title = 'Chewie Demo', - }); + const ChewieDemo({super.key, this.title = 'Chewie Demo'}); final String title; @@ -47,13 +44,15 @@ class _ChewieDemoState extends State { ]; Future initializePlayer() async { - _videoPlayerController1 = - VideoPlayerController.networkUrl(Uri.parse(srcs[currPlayIndex])); - _videoPlayerController2 = - VideoPlayerController.networkUrl(Uri.parse(srcs[currPlayIndex])); + _videoPlayerController1 = VideoPlayerController.networkUrl( + Uri.parse(srcs[currPlayIndex]), + ); + _videoPlayerController2 = VideoPlayerController.networkUrl( + Uri.parse(srcs[currPlayIndex]), + ); await Future.wait([ _videoPlayerController1.initialize(), - _videoPlayerController2.initialize() + _videoPlayerController2.initialize(), ]); _createChewieController(); setState(() {}); @@ -93,7 +92,7 @@ class _ChewieDemoState extends State { TextSpan( text: 'subtitles', style: TextStyle(color: Colors.blue, fontSize: 18), - ) + ), ], ), ), @@ -127,17 +126,17 @@ class _ChewieDemoState extends State { }, subtitle: Subtitles(subtitles), showSubtitles: true, - subtitleBuilder: (context, dynamic subtitle) => Container( - padding: const EdgeInsets.all(10.0), - child: subtitle is InlineSpan - ? RichText( - text: subtitle, - ) - : Text( - subtitle.toString(), - style: const TextStyle(color: Colors.black), - ), - ), + subtitleBuilder: + (context, dynamic subtitle) => Container( + padding: const EdgeInsets.all(10.0), + child: + subtitle is InlineSpan + ? RichText(text: subtitle) + : Text( + subtitle.toString(), + style: const TextStyle(color: Colors.black), + ), + ), hideControlsTimer: const Duration(seconds: 1), @@ -176,27 +175,26 @@ class _ChewieDemoState extends State { platform: _platform ?? Theme.of(context).platform, ), home: Scaffold( - appBar: AppBar( - title: Text(widget.title), - ), + appBar: AppBar(title: Text(widget.title)), body: Column( children: [ Expanded( child: Center( - child: _chewieController != null && - _chewieController! - .videoPlayerController.value.isInitialized - ? Chewie( - controller: _chewieController!, - ) - : const Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - CircularProgressIndicator(), - SizedBox(height: 20), - Text('Loading'), - ], - ), + child: + _chewieController != null && + _chewieController! + .videoPlayerController + .value + .isInitialized + ? Chewie(controller: _chewieController!) + : const Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + CircularProgressIndicator(), + SizedBox(height: 20), + Text('Loading'), + ], + ), ), ), TextButton( @@ -261,7 +259,7 @@ class _ChewieDemoState extends State { child: Text("Portrait Video"), ), ), - ) + ), ], ), Row( @@ -291,7 +289,7 @@ class _ChewieDemoState extends State { child: Text("iOS controls"), ), ), - ) + ), ], ), Row( @@ -324,7 +322,7 @@ class _ChewieDemoState extends State { } }, ), - ) + ), ], ), ), @@ -369,14 +367,15 @@ class _DelaySliderState extends State { ), trailing: IconButton( icon: const Icon(Icons.save), - onPressed: saved - ? null - : () { - widget.onSave(delay); - setState(() { - saved = true; - }); - }, + onPressed: + saved + ? null + : () { + widget.onSave(delay); + setState(() { + saved = true; + }); + }, ), ); } diff --git a/example/lib/main.dart b/example/lib/main.dart index 000c2d096..496728a63 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -2,7 +2,5 @@ import 'package:chewie_example/app/app.dart'; import 'package:flutter/material.dart'; void main() { - runApp( - const ChewieDemo(), - ); + runApp(const ChewieDemo()); } diff --git a/example/pubspec.yaml b/example/pubspec.yaml index 62354546e..95fc86e72 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -4,20 +4,20 @@ version: 1.0.0 publish_to: none environment: - sdk: '>=3.3.0 <4.0.0' - flutter: ">=3.19.0" + sdk: '>=3.7.0 <4.0.0' + flutter: ">=3.29.0" dependencies: chewie: path: ../ flutter: sdk: flutter + video_player: ^2.9.3 - video_player: ^2.9.1 dev_dependencies: flutter_test: sdk: flutter - flutter_lints: ^4.0.0 + flutter_lints: ^5.0.0 # For information on the generic Dart part of this file, see the # following page: https://www.dartlang.org/tools/pub/pubspec diff --git a/lib/chewie.dart b/lib/chewie.dart index 549955a49..7061505ad 100644 --- a/lib/chewie.dart +++ b/lib/chewie.dart @@ -1,9 +1,9 @@ -library chewie; +library; export 'src/chewie_player.dart'; export 'src/chewie_progress_colors.dart'; export 'src/cupertino/cupertino_controls.dart'; export 'src/material/material_controls.dart'; -export 'src/material/material_progress_bar.dart'; export 'src/material/material_desktop_controls.dart'; +export 'src/material/material_progress_bar.dart'; export 'src/models/index.dart'; diff --git a/pubspec.yaml b/pubspec.yaml index fbeb748c4..6ffa60de2 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -4,21 +4,21 @@ version: 1.10.0 homepage: https://github.com/fluttercommunity/chewie environment: - sdk: '>=3.5.0 <4.0.0' - flutter: ">=3.24.0" + sdk: '>=3.6.0 <4.0.0' + flutter: ">=3.27.0" dependencies: - cupertino_icons: ^1.0.5 + cupertino_icons: ^1.0.8 flutter: sdk: flutter provider: ^6.1.2 - video_player: ^2.9.1 - wakelock_plus: ^1.2.8 + video_player: ^2.9.3 + wakelock_plus: ^1.2.10 dev_dependencies: flutter_test: sdk: flutter - flutter_lints: ^4.0.0 + flutter_lints: ^5.0.0 flutter: uses-material-design: true From d172b64ce690d285263eafca87d8a1fa7ff6b689 Mon Sep 17 00:00:00 2001 From: Diego Tori Date: Thu, 13 Mar 2025 12:48:07 -0400 Subject: [PATCH 2/2] Reverted Flutter 3.29 minimum on the example app due to CI conflicts. --- example/lib/app/app.dart | 64 ++++++++++++++++++---------------------- example/pubspec.yaml | 4 +-- 2 files changed, 31 insertions(+), 37 deletions(-) diff --git a/example/lib/app/app.dart b/example/lib/app/app.dart index 607881679..5e555c9e3 100644 --- a/example/lib/app/app.dart +++ b/example/lib/app/app.dart @@ -126,17 +126,15 @@ class _ChewieDemoState extends State { }, subtitle: Subtitles(subtitles), showSubtitles: true, - subtitleBuilder: - (context, dynamic subtitle) => Container( - padding: const EdgeInsets.all(10.0), - child: - subtitle is InlineSpan - ? RichText(text: subtitle) - : Text( - subtitle.toString(), - style: const TextStyle(color: Colors.black), - ), - ), + subtitleBuilder: (context, dynamic subtitle) => Container( + padding: const EdgeInsets.all(10.0), + child: subtitle is InlineSpan + ? RichText(text: subtitle) + : Text( + subtitle.toString(), + style: const TextStyle(color: Colors.black), + ), + ), hideControlsTimer: const Duration(seconds: 1), @@ -180,21 +178,18 @@ class _ChewieDemoState extends State { children: [ Expanded( child: Center( - child: - _chewieController != null && - _chewieController! - .videoPlayerController - .value - .isInitialized - ? Chewie(controller: _chewieController!) - : const Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - CircularProgressIndicator(), - SizedBox(height: 20), - Text('Loading'), - ], - ), + child: _chewieController != null && + _chewieController! + .videoPlayerController.value.isInitialized + ? Chewie(controller: _chewieController!) + : const Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + CircularProgressIndicator(), + SizedBox(height: 20), + Text('Loading'), + ], + ), ), ), TextButton( @@ -367,15 +362,14 @@ class _DelaySliderState extends State { ), trailing: IconButton( icon: const Icon(Icons.save), - onPressed: - saved - ? null - : () { - widget.onSave(delay); - setState(() { - saved = true; - }); - }, + onPressed: saved + ? null + : () { + widget.onSave(delay); + setState(() { + saved = true; + }); + }, ), ); } diff --git a/example/pubspec.yaml b/example/pubspec.yaml index 95fc86e72..be412fe2a 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -4,8 +4,8 @@ version: 1.0.0 publish_to: none environment: - sdk: '>=3.7.0 <4.0.0' - flutter: ">=3.29.0" + sdk: '>=3.6.0 <4.0.0' + flutter: ">=3.27.0" dependencies: chewie: