Skip to content

Commit

Permalink
Switch wakelock plugin (fluttercommunity#210)
Browse files Browse the repository at this point in the history
* Initial

* Constraints
  • Loading branch information
creativecreatorormaybenot authored and brianegan committed Oct 31, 2019
1 parent 0824f3b commit 821903d
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 9 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 0.10.0

* Changed wakelock plugin from `flutter_screen` to `wakelock` due to lack of maintenance of `flutter_screen`.

## 0.9.8+1
* Require latest flutter stable version

Expand Down
11 changes: 5 additions & 6 deletions lib/src/chewie_player.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import 'package:chewie/src/player_with_controls.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter/widgets.dart';
import 'package:screen/screen.dart';
import 'package:video_player/video_player.dart';
import 'package:wakelock/wakelock.dart';

typedef Widget ChewieRoutePageBuilder(
BuildContext context,
Expand Down Expand Up @@ -136,17 +136,16 @@ class ChewieState extends State<Chewie> {
}

if (!widget.controller.allowedScreenSleep) {
Screen.keepOn(true);
Wakelock.enable();
}

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

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

SystemChrome.setEnabledSystemUIOverlays(
widget.controller.systemOverlaysAfterFullScreen);
Expand Down
3 changes: 2 additions & 1 deletion lib/src/cupertino_controls.dart
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ class _CupertinoControlsState extends State<CupertinoControls> {
absorbing: _hideStuff,
child: Column(
children: <Widget>[
_buildTopBar(backgroundColor, iconColor, barHeight, buttonPadding),
_buildTopBar(
backgroundColor, iconColor, barHeight, buttonPadding),
_buildHitArea(),
_buildBottomBar(backgroundColor, iconColor, barHeight),
],
Expand Down
5 changes: 3 additions & 2 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: chewie
description: A video player for Flutter with Cupertino and Material play controls
version: 0.9.8+1
version: 0.9.8+2
homepage: https://github.com/brianegan/chewie
authors:
- Brian Egan <[email protected]>
Expand All @@ -13,7 +13,8 @@ environment:
dependencies:
open_iconic_flutter: ">=0.3.0 <0.4.0"
video_player: ">=0.7.0 <0.11.0"
screen: ">=0.0.4 <0.1.0"
wakelock: ">=0.1.2 <0.2.0"

flutter:
sdk: flutter

Expand Down

0 comments on commit 821903d

Please sign in to comment.