Skip to content
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

增加alignment字段控制视频排列 #222

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
5 changes: 5 additions & 0 deletions lib/src/chewie_player.dart
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ class ChewieController extends ChangeNotifier {
ChewieController({
this.videoPlayerController,
this.aspectRatio,
this.alignment,
this.autoInitialize = false,
this.autoPlay = false,
this.startAt,
Expand Down Expand Up @@ -233,6 +234,10 @@ class ChewieController extends ChangeNotifier {
///
/// Will fallback to fitting within the space allowed.
final double aspectRatio;

/// video alignment
/// default Alignment.center
final Alignment alignment;

/// The colors to use for controls on iOS. By default, the iOS player uses
/// colors sampled from the original iOS 11 designs.
Expand Down
3 changes: 2 additions & 1 deletion lib/src/player_with_controls.dart
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ class PlayerWithControls extends StatelessWidget {
child: Stack(
children: <Widget>[
chewieController.placeholder ?? Container(),
Center(
Container(
alignment: chewieController.alignment ?? Alignment.center,
child: AspectRatio(
aspectRatio: chewieController.aspectRatio ??
_calculateAspectRatio(context),
Expand Down