Skip to content

Commit 8e25a9e

Browse files
authored
Merge pull request #928 from diegotori/flutter_3.35_upgrade
Flutter 3.35 upgrade
2 parents b8b967b + e5e67ad commit 8e25a9e

16 files changed

+234
-255
lines changed

.github/workflows/ci.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ env:
1717
# refer to https://docs.flutter.dev/development/tools/sdk/releases.
1818
# Note: The version below should be manually updated to the latest second most recent version
1919
# after a new stable version comes out.
20-
# Current minimum is set to Flutter 3.29. Make this the new minimum once the next
20+
# Current minimum is set to Flutter 3.32. Make the next version the new minimum once the next
2121
# stable version is released
22-
FLUTTER_VERSION_MINIMUM_DEFAULT: "3.29.3"
22+
FLUTTER_VERSION_MINIMUM_DEFAULT: "3.32.8"
2323
FLUTTER_VERSION_LATEST_STABLE_CHANNEL_DEFAULT: "3.x"
2424

2525
jobs:
@@ -82,7 +82,7 @@ jobs:
8282
# Only continue on error if this is the job for the MINIMUM Flutter version
8383
# This allows formatting issues to be warnings on older supported versions
8484
# but enforces them on the latest stable or primary development version.
85-
continue-on-error: ${{ matrix.flutter-version == env.FLUTTER_VERSION_MINIMUM }}
85+
continue-on-error: "${{ matrix.flutter-version == env.FLUTTER_VERSION_MINIMUM }}"
8686

8787
- name: 🕵️ Analyze
8888
run: flutter analyze lib
@@ -93,4 +93,4 @@ jobs:
9393
- name: 📁 Upload coverage to Codecov
9494
uses: codecov/codecov-action@v5
9595
# TODO: Remove the below once we have adequate tests for this library.
96-
continue-on-error: true
96+
continue-on-error: "true"

example/lib/app/app.dart

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,9 @@ class _ChewieDemoState extends State<ChewieDemo> {
111111
autoPlay: true,
112112
zoomAndPan: true,
113113
looping: true,
114-
progressIndicatorDelay:
115-
bufferDelay != null ? Duration(milliseconds: bufferDelay!) : null,
114+
progressIndicatorDelay: bufferDelay != null
115+
? Duration(milliseconds: bufferDelay!)
116+
: null,
116117

117118
additionalOptions: (context) {
118119
return <OptionItem>[
@@ -177,9 +178,12 @@ class _ChewieDemoState extends State<ChewieDemo> {
177178
children: <Widget>[
178179
Expanded(
179180
child: Center(
180-
child: _chewieController != null &&
181+
child:
182+
_chewieController != null &&
181183
_chewieController!
182-
.videoPlayerController.value.isInitialized
184+
.videoPlayerController
185+
.value
186+
.isInitialized
183187
? Chewie(controller: _chewieController!)
184188
: const Column(
185189
mainAxisAlignment: MainAxisAlignment.center,

example/pubspec.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,20 @@ version: 1.0.0
44
publish_to: none
55

66
environment:
7-
sdk: '>=3.6.0 <4.0.0'
8-
flutter: ">=3.27.0"
7+
sdk: '>=3.8.0 <4.0.0'
8+
flutter: ">=3.32.0"
99

1010
dependencies:
1111
chewie:
1212
path: ../
1313
flutter:
1414
sdk: flutter
15-
video_player: ^2.9.3
15+
video_player: ^2.10.0
1616

1717
dev_dependencies:
1818
flutter_test:
1919
sdk: flutter
20-
flutter_lints: ^5.0.0
20+
flutter_lints: ^6.0.0
2121

2222
# For information on the generic Dart part of this file, see the
2323
# following page: https://www.dartlang.org/tools/pub/pubspec

lib/src/center_play_button.dart

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,9 @@ class CenterPlayButton extends StatelessWidget {
3838
child: IconButton(
3939
iconSize: 32,
4040
padding: const EdgeInsets.all(12.0),
41-
icon:
42-
isFinished
43-
? Icon(Icons.replay, color: iconColor)
44-
: AnimatedPlayPause(
45-
color: iconColor,
46-
playing: isPlaying,
47-
),
41+
icon: isFinished
42+
? Icon(Icons.replay, color: iconColor)
43+
: AnimatedPlayPause(color: iconColor, playing: isPlaying),
4844
onPressed: onPressed,
4945
),
5046
),

lib/src/chewie_player.dart

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ class ChewieState extends State<Chewie> {
138138
builder: (context, w) => const PlayerWithControls(),
139139
),
140140
);
141-
141+
142142
if (kIsWeb && !_resumeAppliedInFullScreen) {
143143
_resumeAppliedInFullScreen = true;
144144
WidgetsBinding.instance.addPostFrameCallback((_) async {
@@ -187,8 +187,7 @@ class ChewieState extends State<Chewie> {
187187
rootNavigator: widget.controller.useRootNavigator,
188188
).push(route);
189189

190-
final wasPlaying =
191-
widget.controller.videoPlayerController.value.isPlaying;
190+
final wasPlaying = widget.controller.videoPlayerController.value.isPlaying;
192191

193192
if (kIsWeb) {
194193
await _reInitializeControllers(wasPlaying);
@@ -632,8 +631,8 @@ class ChewieController extends ChangeNotifier {
632631
final bool pauseOnBackgroundTap;
633632

634633
static ChewieController of(BuildContext context) {
635-
final chewieControllerProvider =
636-
context.dependOnInheritedWidgetOfExactType<ChewieControllerProvider>()!;
634+
final chewieControllerProvider = context
635+
.dependOnInheritedWidgetOfExactType<ChewieControllerProvider>()!;
637636

638637
return chewieControllerProvider.controller;
639638
}

lib/src/cupertino/cupertino_controls.dart

Lines changed: 78 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -67,16 +67,16 @@ class _CupertinoControlsState extends State<CupertinoControls>
6767
if (_latestValue.hasError) {
6868
return chewieController.errorBuilder != null
6969
? chewieController.errorBuilder!(
70-
context,
71-
chewieController.videoPlayerController.value.errorDescription!,
72-
)
70+
context,
71+
chewieController.videoPlayerController.value.errorDescription!,
72+
)
7373
: const Center(
74-
child: Icon(
75-
CupertinoIcons.exclamationmark_circle,
76-
color: Colors.white,
77-
size: 42,
78-
),
79-
);
74+
child: Icon(
75+
CupertinoIcons.exclamationmark_circle,
76+
color: Colors.white,
77+
size: 42,
78+
),
79+
);
8080
}
8181

8282
final backgroundColor = widget.backgroundColor;
@@ -172,12 +172,11 @@ class _CupertinoControlsState extends State<CupertinoControls>
172172
context: context,
173173
semanticsDismissible: true,
174174
useRootNavigator: chewieController.useRootNavigator,
175-
builder:
176-
(context) => CupertinoOptionsDialog(
177-
options: options,
178-
cancelButtonText:
179-
chewieController.optionsTranslation?.cancelButtonText,
180-
),
175+
builder: (context) => CupertinoOptionsDialog(
176+
options: options,
177+
cancelButtonText:
178+
chewieController.optionsTranslation?.cancelButtonText,
179+
),
181180
);
182181
if (_latestValue.isPlaying) {
183182
_startHideTimer();
@@ -252,37 +251,32 @@ class _CupertinoControlsState extends State<CupertinoControls>
252251
child: Container(
253252
height: barHeight,
254253
color: backgroundColor,
255-
child:
256-
chewieController.isLive
257-
? Row(
258-
mainAxisAlignment: MainAxisAlignment.spaceBetween,
259-
children: <Widget>[
260-
_buildPlayPause(controller, iconColor, barHeight),
261-
_buildLive(iconColor),
262-
],
263-
)
264-
: Row(
265-
children: <Widget>[
266-
_buildSkipBack(iconColor, barHeight),
267-
_buildPlayPause(controller, iconColor, barHeight),
268-
_buildSkipForward(iconColor, barHeight),
269-
_buildPosition(iconColor),
270-
_buildProgressBar(),
271-
_buildRemaining(iconColor),
272-
_buildSubtitleToggle(iconColor, barHeight),
273-
if (chewieController.allowPlaybackSpeedChanging)
274-
_buildSpeedButton(
275-
controller,
276-
iconColor,
277-
barHeight,
278-
),
279-
if (chewieController.additionalOptions != null &&
280-
chewieController
281-
.additionalOptions!(context)
282-
.isNotEmpty)
283-
_buildOptionsButton(iconColor, barHeight),
284-
],
285-
),
254+
child: chewieController.isLive
255+
? Row(
256+
mainAxisAlignment: MainAxisAlignment.spaceBetween,
257+
children: <Widget>[
258+
_buildPlayPause(controller, iconColor, barHeight),
259+
_buildLive(iconColor),
260+
],
261+
)
262+
: Row(
263+
children: <Widget>[
264+
_buildSkipBack(iconColor, barHeight),
265+
_buildPlayPause(controller, iconColor, barHeight),
266+
_buildSkipForward(iconColor, barHeight),
267+
_buildPosition(iconColor),
268+
_buildProgressBar(),
269+
_buildRemaining(iconColor),
270+
_buildSubtitleToggle(iconColor, barHeight),
271+
if (chewieController.allowPlaybackSpeedChanging)
272+
_buildSpeedButton(controller, iconColor, barHeight),
273+
if (chewieController.additionalOptions != null &&
274+
chewieController
275+
.additionalOptions!(context)
276+
.isNotEmpty)
277+
_buildOptionsButton(iconColor, barHeight),
278+
],
279+
),
286280
),
287281
),
288282
),
@@ -344,24 +338,23 @@ class _CupertinoControlsState extends State<CupertinoControls>
344338
widget.showPlayButton && !_latestValue.isPlaying && !_dragging;
345339

346340
return GestureDetector(
347-
onTap:
348-
_latestValue.isPlaying
349-
? _chewieController?.pauseOnBackgroundTap ?? false
350-
? () {
341+
onTap: _latestValue.isPlaying
342+
? _chewieController?.pauseOnBackgroundTap ?? false
343+
? () {
351344
_playPause();
352345

353346
setState(() {
354347
notifier.hideStuff = true;
355348
});
356349
}
357-
: _cancelAndRestartTimer
358-
: () {
359-
_hideTimer?.cancel();
360-
361-
setState(() {
362-
notifier.hideStuff = false;
363-
});
364-
},
350+
: _cancelAndRestartTimer
351+
: () {
352+
_hideTimer?.cancel();
353+
354+
setState(() {
355+
notifier.hideStuff = false;
356+
});
357+
},
365358
child: CenterPlayButton(
366359
backgroundColor: widget.backgroundColor,
367360
iconColor: widget.iconColor,
@@ -528,11 +521,10 @@ class _CupertinoControlsState extends State<CupertinoControls>
528521
context: context,
529522
semanticsDismissible: true,
530523
useRootNavigator: chewieController.useRootNavigator,
531-
builder:
532-
(context) => _PlaybackSpeedDialog(
533-
speeds: chewieController.playbackSpeeds,
534-
selected: _latestValue.playbackSpeed,
535-
),
524+
builder: (context) => _PlaybackSpeedDialog(
525+
speeds: chewieController.playbackSpeeds,
526+
selected: _latestValue.playbackSpeed,
527+
),
536528
);
537529

538530
if (chosenSpeed != null) {
@@ -552,10 +544,9 @@ class _CupertinoControlsState extends State<CupertinoControls>
552544
margin: const EdgeInsets.only(right: 8.0),
553545
child: Transform(
554546
alignment: Alignment.center,
555-
transform:
556-
Matrix4.skewY(0.0)
557-
..rotateX(math.pi)
558-
..rotateZ(math.pi * 0.8),
547+
transform: Matrix4.skewY(0.0)
548+
..rotateX(math.pi)
549+
..rotateZ(math.pi * 0.8),
559550
child: Icon(Icons.speed, color: iconColor, size: 18.0),
560551
),
561552
),
@@ -733,10 +724,9 @@ class _CupertinoControlsState extends State<CupertinoControls>
733724
}
734725

735726
void _startHideTimer() {
736-
final hideControlsTimer =
737-
chewieController.hideControlsTimer.isNegative
738-
? ChewieController.defaultHideControlsTimer
739-
: chewieController.hideControlsTimer;
727+
final hideControlsTimer = chewieController.hideControlsTimer.isNegative
728+
? ChewieController.defaultHideControlsTimer
729+
: chewieController.hideControlsTimer;
740730
_hideTimer = Timer(hideControlsTimer, () {
741731
setState(() {
742732
notifier.hideStuff = true;
@@ -794,24 +784,23 @@ class _PlaybackSpeedDialog extends StatelessWidget {
794784
final selectedColor = CupertinoTheme.of(context).primaryColor;
795785

796786
return CupertinoActionSheet(
797-
actions:
798-
_speeds
799-
.map(
800-
(e) => CupertinoActionSheetAction(
801-
onPressed: () {
802-
Navigator.of(context).pop(e);
803-
},
804-
child: Row(
805-
mainAxisAlignment: MainAxisAlignment.center,
806-
children: [
807-
if (e == _selected)
808-
Icon(Icons.check, size: 20.0, color: selectedColor),
809-
Text(e.toString()),
810-
],
811-
),
812-
),
813-
)
814-
.toList(),
787+
actions: _speeds
788+
.map(
789+
(e) => CupertinoActionSheetAction(
790+
onPressed: () {
791+
Navigator.of(context).pop(e);
792+
},
793+
child: Row(
794+
mainAxisAlignment: MainAxisAlignment.center,
795+
children: [
796+
if (e == _selected)
797+
Icon(Icons.check, size: 20.0, color: selectedColor),
798+
Text(e.toString()),
799+
],
800+
),
801+
),
802+
)
803+
.toList(),
815804
);
816805
}
817806
}

lib/src/cupertino/widgets/cupertino_options_dialog.dart

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,14 @@ class _CupertinoOptionsDialogState extends State<CupertinoOptionsDialog> {
2121
Widget build(BuildContext context) {
2222
return SafeArea(
2323
child: CupertinoActionSheet(
24-
actions:
25-
widget.options
26-
.map(
27-
(option) => CupertinoActionSheetAction(
28-
onPressed: () => option.onTap(context),
29-
child: Text(option.title),
30-
),
31-
)
32-
.toList(),
24+
actions: widget.options
25+
.map(
26+
(option) => CupertinoActionSheetAction(
27+
onPressed: () => option.onTap(context),
28+
child: Text(option.title),
29+
),
30+
)
31+
.toList(),
3332
cancelButton: CupertinoActionSheetAction(
3433
onPressed: () => Navigator.pop(context),
3534
isDestructiveAction: true,

0 commit comments

Comments
 (0)