Skip to content

Switch wakelock plugin #210

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 31, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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).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