Skip to content

Commit 821903d

Browse files
Switch wakelock plugin (#210)
* Initial * Constraints
1 parent 0824f3b commit 821903d

File tree

4 files changed

+14
-9
lines changed

4 files changed

+14
-9
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## 0.10.0
4+
5+
* Changed wakelock plugin from `flutter_screen` to `wakelock` due to lack of maintenance of `flutter_screen`.
6+
37
## 0.9.8+1
48
* Require latest flutter stable version
59

lib/src/chewie_player.dart

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import 'package:chewie/src/player_with_controls.dart';
55
import 'package:flutter/material.dart';
66
import 'package:flutter/services.dart';
77
import 'package:flutter/widgets.dart';
8-
import 'package:screen/screen.dart';
98
import 'package:video_player/video_player.dart';
9+
import 'package:wakelock/wakelock.dart';
1010

1111
typedef Widget ChewieRoutePageBuilder(
1212
BuildContext context,
@@ -136,17 +136,16 @@ class ChewieState extends State<Chewie> {
136136
}
137137

138138
if (!widget.controller.allowedScreenSleep) {
139-
Screen.keepOn(true);
139+
Wakelock.enable();
140140
}
141141

142142
await Navigator.of(context, rootNavigator: true).push(route);
143143
_isFullScreen = false;
144144
widget.controller.exitFullScreen();
145145

146-
bool isKeptOn = await Screen.isKeptOn;
147-
if (isKeptOn) {
148-
Screen.keepOn(false);
149-
}
146+
// The wakelock plugins checks whether it needs to perform an action internally,
147+
// so we do not need to check Wakelock.isEnabled.
148+
Wakelock.disable();
150149

151150
SystemChrome.setEnabledSystemUIOverlays(
152151
widget.controller.systemOverlaysAfterFullScreen);

lib/src/cupertino_controls.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,8 @@ class _CupertinoControlsState extends State<CupertinoControls> {
7777
absorbing: _hideStuff,
7878
child: Column(
7979
children: <Widget>[
80-
_buildTopBar(backgroundColor, iconColor, barHeight, buttonPadding),
80+
_buildTopBar(
81+
backgroundColor, iconColor, barHeight, buttonPadding),
8182
_buildHitArea(),
8283
_buildBottomBar(backgroundColor, iconColor, barHeight),
8384
],

pubspec.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: chewie
22
description: A video player for Flutter with Cupertino and Material play controls
3-
version: 0.9.8+1
3+
version: 0.9.8+2
44
homepage: https://github.com/brianegan/chewie
55
authors:
66
- Brian Egan <[email protected]>
@@ -13,7 +13,8 @@ environment:
1313
dependencies:
1414
open_iconic_flutter: ">=0.3.0 <0.4.0"
1515
video_player: ">=0.7.0 <0.11.0"
16-
screen: ">=0.0.4 <0.1.0"
16+
wakelock: ">=0.1.2 <0.2.0"
17+
1718
flutter:
1819
sdk: flutter
1920

0 commit comments

Comments
 (0)