Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: fluttercommunity/chewie
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: OkunaOrg/chewie
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Can’t automatically merge. Don’t worry, you can still create the pull request.
  • 2 commits
  • 5 files changed
  • 1 contributor

Commits on Sep 3, 2019

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    74a3b18 View commit details
  2. Copy the full SHA
    5851cd6 View commit details
Showing with 21 additions and 16 deletions.
  1. +1 −0 example/lib/auto_rotate.dart
  2. +5 −1 lib/src/chewie_player.dart
  3. +6 −4 lib/src/cupertino_controls.dart
  4. +8 −6 lib/src/material_controls.dart
  5. +1 −5 lib/src/player_with_controls.dart
1 change: 1 addition & 0 deletions example/lib/auto_rotate.dart
Original file line number Diff line number Diff line change
@@ -40,6 +40,7 @@ class _ChewieDemoState extends State<ChewieDemo> {
videoPlayerController: _videoPlayerController1,
aspectRatio: 3 / 2,
autoPlay: true,
showControlsOnInitialize: false,
looping: true,
routePageBuilder: (BuildContext context, Animation<double> animation,
Animation<double> secondAnimation, provider) {
6 changes: 5 additions & 1 deletion lib/src/chewie_player.dart
Original file line number Diff line number Diff line change
@@ -178,6 +178,7 @@ class ChewieController extends ChangeNotifier {
this.materialProgressColors,
this.placeholder,
this.overlay,
this.showControlsOnInitialize = true,
this.showControls = true,
this.customControls,
this.errorBuilder,
@@ -213,7 +214,10 @@ class ChewieController extends ChangeNotifier {
/// Whether or not the video should loop
final bool looping;

/// Whether or not to show the controls
/// Weather or not to show the controls when initializing the widget.
final bool showControlsOnInitialize;

/// Whether or not to show the controls at all
final bool showControls;

/// Defines customised controls. Check [MaterialControls] or
10 changes: 6 additions & 4 deletions lib/src/cupertino_controls.dart
Original file line number Diff line number Diff line change
@@ -424,11 +424,13 @@ class _CupertinoControlsState extends State<CupertinoControls> {
_startHideTimer();
}

_initTimer = Timer(Duration(milliseconds: 200), () {
setState(() {
_hideStuff = false;
if (chewieController.showControlsOnInitialize) {
_initTimer = Timer(Duration(milliseconds: 200), () {
setState(() {
_hideStuff = false;
});
});
});
}
}

void _onExpandCollapse() {
14 changes: 8 additions & 6 deletions lib/src/material_controls.dart
Original file line number Diff line number Diff line change
@@ -21,7 +21,7 @@ class _MaterialControlsState extends State<MaterialControls> {
double _latestVolume;
bool _hideStuff = true;
Timer _hideTimer;
Timer _showTimer;
Timer _initTimer;
Timer _showAfterExpandCollapseTimer;
bool _dragging = false;

@@ -80,7 +80,7 @@ class _MaterialControlsState extends State<MaterialControls> {
void _dispose() {
controller.removeListener(_updateState);
_hideTimer?.cancel();
_showTimer?.cancel();
_initTimer?.cancel();
_showAfterExpandCollapseTimer?.cancel();
}

@@ -286,11 +286,13 @@ class _MaterialControlsState extends State<MaterialControls> {
_startHideTimer();
}

_showTimer = Timer(Duration(milliseconds: 200), () {
setState(() {
_hideStuff = false;
if (chewieController.showControlsOnInitialize) {
_initTimer = Timer(Duration(milliseconds: 200), () {
setState(() {
_hideStuff = false;
});
});
});
}
}

void _onExpandCollapse() {
6 changes: 1 addition & 5 deletions lib/src/player_with_controls.dart
Original file line number Diff line number Diff line change
@@ -17,11 +17,7 @@ class PlayerWithControls extends StatelessWidget {
return Center(
child: Container(
width: MediaQuery.of(context).size.width,
child: AspectRatio(
aspectRatio:
chewieController.aspectRatio ?? _calculateAspectRatio(context),
child: _buildPlayerWithControls(chewieController, context),
),
child: _buildPlayerWithControls(chewieController, context)
),
);
}