Skip to content

Commit d2aa99f

Browse files
authored
Merge branch 'master' into master
2 parents ad329f1 + 6daf1fa commit d2aa99f

15 files changed

+152
-84
lines changed

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
## 1.2.3
2+
3+
* ⬆️ Update 'provider' to 6.0.1
4+
- fixes [#568](https://github.com/brianegan/chewie/issues/568)
5+
* ⬆️ Update 'video_player' to 2.2.7
6+
* ⬆️ Update 'wakelock' to 0.5.6
7+
* ⬆️ Update 'lint' to 1.7.2
8+
* ⬆️ Update roadmap
9+
* 🛠️ Fix lint problems
10+
* 💡 Add very_good_analysis package
11+
* 💡 Add analysis_options.yaml for example app
12+
113
## 1.2.2
214

315
* 🛠️ Fix Incorrect use of ParentDataWidget.

analysis_options.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@ include: package:lint/analysis_options_package.yaml
33
analyzer:
44
strong-mode:
55
implicit-dynamic: false
6+
exclude:
7+
- lib/generated_plugin_registrant.dart
68

79
linter:
810
rules:
911
close_sinks: true
1012
sort_constructors_first: true
11-
13+
sort_pub_dependencies: false

example/analysis_options.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
include: package:lint/analysis_options_package.yaml
2+
3+
analyzer:
4+
strong-mode:
5+
implicit-dynamic: false
6+
exclude:
7+
- lib/generated_plugin_registrant.dart
8+
9+
linter:
10+
rules:
11+
close_sinks: true
12+
sort_constructors_first: true

example/lib/app/app.dart

Lines changed: 29 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1+
import 'package:chewie/chewie.dart';
12
import 'package:chewie_example/app/theme.dart';
23
import 'package:flutter/material.dart';
3-
import 'package:chewie/chewie.dart';
4-
import 'package:flutter/cupertino.dart';
5-
4+
// ignore: depend_on_referenced_packages
65
import 'package:video_player/video_player.dart';
76

87
class ChewieDemo extends StatefulWidget {
@@ -78,31 +77,33 @@ class _ChewieDemoState extends State<ChewieDemo> {
7877
index: 0,
7978
start: Duration.zero,
8079
end: const Duration(seconds: 10),
81-
text: const TextSpan(children: [
82-
TextSpan(
83-
text: 'Hello',
84-
style: TextStyle(color: Colors.red, fontSize: 22),
85-
),
86-
TextSpan(
87-
text: ' from ',
88-
style: TextStyle(color: Colors.green, fontSize: 20),
89-
),
90-
TextSpan(
91-
text: 'subtitles',
92-
style: TextStyle(color: Colors.blue, fontSize: 18),
93-
)
94-
]),
80+
text: const TextSpan(
81+
children: [
82+
TextSpan(
83+
text: 'Hello',
84+
style: TextStyle(color: Colors.red, fontSize: 22),
85+
),
86+
TextSpan(
87+
text: ' from ',
88+
style: TextStyle(color: Colors.green, fontSize: 20),
89+
),
90+
TextSpan(
91+
text: 'subtitles',
92+
style: TextStyle(color: Colors.blue, fontSize: 18),
93+
)
94+
],
95+
),
9596
),
9697
Subtitle(
97-
index: 0,
98-
start: const Duration(seconds: 10),
99-
end: const Duration(seconds: 20),
100-
text: 'Whats up? :)'
101-
// text: const TextSpan(
102-
// text: 'Whats up? :)',
103-
// style: TextStyle(color: Colors.amber, fontSize: 22, fontStyle: FontStyle.italic),
104-
// ),
105-
),
98+
index: 0,
99+
start: const Duration(seconds: 10),
100+
end: const Duration(seconds: 20),
101+
text: 'Whats up? :)',
102+
// text: const TextSpan(
103+
// text: 'Whats up? :)',
104+
// style: TextStyle(color: Colors.amber, fontSize: 22, fontStyle: FontStyle.italic),
105+
// ),
106+
),
106107
];
107108

108109
_chewieController = ChewieController(
@@ -200,7 +201,7 @@ class _ChewieDemoState extends State<ChewieDemo> {
200201
onPressed: () {
201202
setState(() {
202203
_videoPlayerController1.pause();
203-
_videoPlayerController1.seekTo(const Duration());
204+
_videoPlayerController1.seekTo(Duration.zero);
204205
_createChewieController();
205206
});
206207
},
@@ -215,7 +216,7 @@ class _ChewieDemoState extends State<ChewieDemo> {
215216
onPressed: () {
216217
setState(() {
217218
_videoPlayerController2.pause();
218-
_videoPlayerController2.seekTo(const Duration());
219+
_videoPlayerController2.seekTo(Duration.zero);
219220
_chewieController = _chewieController!.copyWith(
220221
videoPlayerController: _videoPlayerController2,
221222
autoPlay: true,

example/lib/app/theme.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ import 'package:flutter/material.dart';
44
class AppTheme {
55
static final light = ThemeData(
66
brightness: Brightness.light,
7-
accentColor: Colors.red,
7+
colorScheme: const ColorScheme.dark(secondary: Colors.red),
88
disabledColor: Colors.grey.shade400,
99
visualDensity: VisualDensity.adaptivePlatformDensity,
1010
);
1111

1212
static final dark = ThemeData(
1313
brightness: Brightness.dark,
14-
accentColor: Colors.red,
14+
colorScheme: const ColorScheme.dark(secondary: Colors.red),
1515
disabledColor: Colors.grey.shade400,
1616
visualDensity: VisualDensity.adaptivePlatformDensity,
1717
);

example/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ dependencies:
1515
dev_dependencies:
1616
flutter_test:
1717
sdk: flutter
18-
lint: ^1.3.0
18+
lint: ^1.7.2
1919

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

lib/src/center_play_button.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ class CenterPlayButton extends StatelessWidget {
1515
final Color backgroundColor;
1616
final Color? iconColor;
1717
final bool show;
18-
final bool isPlaying, isFinished;
18+
final bool isPlaying;
19+
final bool isFinished;
1920
final VoidCallback? onPressed;
2021

2122
@override

lib/src/chewie_player.dart

Lines changed: 37 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,14 @@ import 'dart:async';
22

33
import 'package:chewie/src/chewie_progress_colors.dart';
44
import 'package:chewie/src/material/models/options_translation.dart';
5+
import 'package:chewie/src/models/subtitle_model.dart';
56
import 'package:chewie/src/notifiers/player_notifier.dart';
67
import 'package:chewie/src/player_with_controls.dart';
78
import 'package:flutter/material.dart';
89
import 'package:flutter/services.dart';
9-
import 'package:flutter/widgets.dart';
1010
import 'package:provider/provider.dart';
1111
import 'package:video_player/video_player.dart';
1212
import 'package:wakelock/wakelock.dart';
13-
import 'package:chewie/src/models/subtitle_model.dart';
1413

1514
import 'material/models/option_item.dart';
1615

@@ -137,10 +136,18 @@ class ChewieState extends State<Chewie> {
137136

138137
if (widget.controller.routePageBuilder == null) {
139138
return _defaultRoutePageBuilder(
140-
context, animation, secondaryAnimation, controllerProvider);
139+
context,
140+
animation,
141+
secondaryAnimation,
142+
controllerProvider,
143+
);
141144
}
142145
return widget.controller.routePageBuilder!(
143-
context, animation, secondaryAnimation, controllerProvider);
146+
context,
147+
animation,
148+
secondaryAnimation,
149+
controllerProvider,
150+
);
144151
}
145152

146153
Future<dynamic> _pushFullScreenWidget(BuildContext context) async {
@@ -162,10 +169,13 @@ class ChewieState extends State<Chewie> {
162169
// so we do not need to check Wakelock.isEnabled.
163170
Wakelock.disable();
164171

165-
SystemChrome.setEnabledSystemUIOverlays(
166-
widget.controller.systemOverlaysAfterFullScreen);
172+
SystemChrome.setEnabledSystemUIMode(
173+
SystemUiMode.manual,
174+
overlays: widget.controller.systemOverlaysAfterFullScreen,
175+
);
167176
SystemChrome.setPreferredOrientations(
168-
widget.controller.deviceOrientationsAfterFullScreen);
177+
widget.controller.deviceOrientationsAfterFullScreen,
178+
);
169179
}
170180

171181
void onEnterFullScreen() {
@@ -175,17 +185,20 @@ class ChewieState extends State<Chewie> {
175185

176186
if (widget.controller.systemOverlaysOnEnterFullScreen != null) {
177187
/// Optional user preferred settings
178-
SystemChrome.setEnabledSystemUIOverlays(
179-
widget.controller.systemOverlaysOnEnterFullScreen!);
188+
SystemChrome.setEnabledSystemUIMode(
189+
SystemUiMode.manual,
190+
overlays: widget.controller.systemOverlaysOnEnterFullScreen,
191+
);
180192
} else {
181193
/// Default behavior
182-
SystemChrome.setEnabledSystemUIOverlays([]);
194+
SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual, overlays: []);
183195
}
184196

185197
if (widget.controller.deviceOrientationsOnEnterFullScreen != null) {
186198
/// Optional user preferred settings
187199
SystemChrome.setPreferredOrientations(
188-
widget.controller.deviceOrientationsOnEnterFullScreen!);
200+
widget.controller.deviceOrientationsOnEnterFullScreen!,
201+
);
189202
} else {
190203
final isLandscapeVideo = videoWidth > videoHeight;
191204
final isPortraitVideo = videoWidth < videoHeight;
@@ -259,8 +272,10 @@ class ChewieController extends ChangeNotifier {
259272
this.systemOverlaysAfterFullScreen = SystemUiOverlay.values,
260273
this.deviceOrientationsAfterFullScreen = DeviceOrientation.values,
261274
this.routePageBuilder,
262-
}) : assert(playbackSpeeds.every((speed) => speed > 0),
263-
'The playbackSpeeds values must all be greater than 0') {
275+
}) : assert(
276+
playbackSpeeds.every((speed) => speed > 0),
277+
'The playbackSpeeds values must all be greater than 0',
278+
) {
264279
_initialize();
265280
}
266281

@@ -296,8 +311,12 @@ class ChewieController extends ChangeNotifier {
296311
List<DeviceOrientation>? deviceOrientationsOnEnterFullScreen,
297312
List<SystemUiOverlay>? systemOverlaysAfterFullScreen,
298313
List<DeviceOrientation>? deviceOrientationsAfterFullScreen,
299-
Widget Function(BuildContext, Animation<double>, Animation<double>,
300-
_ChewieControllerProvider)?
314+
Widget Function(
315+
BuildContext,
316+
Animation<double>,
317+
Animation<double>,
318+
_ChewieControllerProvider,
319+
)?
301320
routePageBuilder,
302321
}) {
303322
return ChewieController(
@@ -365,7 +384,9 @@ class ChewieController extends ChangeNotifier {
365384
/// you'll build. If you want to hide the chewieOptions, just leave them
366385
/// out from your Widget.
367386
final Future<void> Function(
368-
BuildContext context, List<OptionItem> chewieOptions)? optionsBuilder;
387+
BuildContext context,
388+
List<OptionItem> chewieOptions,
389+
)? optionsBuilder;
369390

370391
/// Add your own additional options on top of chewie options
371392
final List<OptionItem> Function(BuildContext context)? additionalOptions;

lib/src/cupertino/cupertino_controls.dart

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,12 @@ import 'package:chewie/src/chewie_player.dart';
88
import 'package:chewie/src/chewie_progress_colors.dart';
99
import 'package:chewie/src/cupertino/cupertino_progress_bar.dart';
1010
import 'package:chewie/src/helpers/utils.dart';
11+
import 'package:chewie/src/models/subtitle_model.dart';
1112
import 'package:chewie/src/notifiers/index.dart';
1213
import 'package:flutter/cupertino.dart';
13-
import 'package:flutter/foundation.dart';
1414
import 'package:flutter/material.dart';
1515
import 'package:provider/provider.dart';
1616
import 'package:video_player/video_player.dart';
17-
import 'package:chewie/src/models/subtitle_model.dart';
1817

1918
class CupertinoControls extends StatefulWidget {
2019
const CupertinoControls({
@@ -97,12 +96,18 @@ class _CupertinoControlsState extends State<CupertinoControls>
9796
mainAxisAlignment: MainAxisAlignment.spaceBetween,
9897
children: <Widget>[
9998
_buildTopBar(
100-
backgroundColor, iconColor, barHeight, buttonPadding),
99+
backgroundColor,
100+
iconColor,
101+
barHeight,
102+
buttonPadding,
103+
),
101104
const Spacer(),
102105
if (_subtitleOn)
103106
Transform.translate(
104107
offset: Offset(
105-
0.0, notifier.hideStuff ? barHeight * 0.8 : 0.0),
108+
0.0,
109+
notifier.hideStuff ? barHeight * 0.8 : 0.0,
110+
),
106111
child: _buildSubtitles(chewieController.subtitle!),
107112
),
108113
_buildBottomBar(backgroundColor, iconColor, barHeight),
@@ -166,8 +171,9 @@ class _CupertinoControlsState extends State<CupertinoControls>
166171
child: Container(
167172
padding: const EdgeInsets.all(5),
168173
decoration: BoxDecoration(
169-
color: const Color(0x96000000),
170-
borderRadius: BorderRadius.circular(10.0)),
174+
color: const Color(0x96000000),
175+
borderRadius: BorderRadius.circular(10.0),
176+
),
171177
child: Text(
172178
currentSubtitle.first!.text.toString(),
173179
style: const TextStyle(
@@ -540,11 +546,20 @@ class _CupertinoControlsState extends State<CupertinoControls>
540546
children: <Widget>[
541547
if (chewieController.allowFullScreen)
542548
_buildExpandButton(
543-
backgroundColor, iconColor, barHeight, buttonPadding),
549+
backgroundColor,
550+
iconColor,
551+
barHeight,
552+
buttonPadding,
553+
),
544554
const Spacer(),
545555
if (chewieController.allowMuting)
546-
_buildMuteButton(controller, backgroundColor, iconColor, barHeight,
547-
buttonPadding),
556+
_buildMuteButton(
557+
controller,
558+
backgroundColor,
559+
iconColor,
560+
barHeight,
561+
buttonPadding,
562+
),
548563
],
549564
),
550565
);
@@ -661,7 +676,7 @@ class _CupertinoControlsState extends State<CupertinoControls>
661676
});
662677
} else {
663678
if (isFinished) {
664-
controller.seekTo(const Duration());
679+
controller.seekTo(Duration.zero);
665680
}
666681
controller.play();
667682
}
@@ -671,7 +686,7 @@ class _CupertinoControlsState extends State<CupertinoControls>
671686

672687
void _skipBack() {
673688
_cancelAndRestartTimer();
674-
final beginning = const Duration().inMilliseconds;
689+
final beginning = Duration.zero.inMilliseconds;
675690
final skip =
676691
(_latestValue.position - const Duration(seconds: 15)).inMilliseconds;
677692
controller.seekTo(Duration(milliseconds: math.max(skip, beginning)));

0 commit comments

Comments
 (0)