Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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
1 change: 1 addition & 0 deletions example/lib/app/app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ class _ChewieDemoState extends State<ChewieDemo> {
videoPlayerController: _videoPlayerController1,
autoPlay: true,
looping: true,
// showSubtitle: true,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of commenting it out, expand the example app so that there's a button or something similar that toggles subtitles.

progressIndicatorDelay:
bufferDelay != null ? Duration(milliseconds: bufferDelay!) : null,

Expand Down
6 changes: 6 additions & 0 deletions lib/src/chewie_player.dart
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@ class ChewieController extends ChangeNotifier {
this.zoomAndPan = false,
this.maxScale = 2.5,
this.subtitle,
this.showSubtitle = false,
this.subtitleBuilder,
this.customControls,
this.errorBuilder,
Expand Down Expand Up @@ -313,6 +314,7 @@ class ChewieController extends ChangeNotifier {
bool? zoomAndPan,
double? maxScale,
Subtitles? subtitle,
bool? showSubtitle,
Widget Function(BuildContext, dynamic)? subtitleBuilder,
Widget? customControls,
Widget Function(BuildContext, String)? errorBuilder,
Expand Down Expand Up @@ -361,6 +363,7 @@ class ChewieController extends ChangeNotifier {
additionalOptions: additionalOptions ?? this.additionalOptions,
showControls: showControls ?? this.showControls,
subtitle: subtitle ?? this.subtitle,
showSubtitle: showSubtitle ?? this.showSubtitle,
subtitleBuilder: subtitleBuilder ?? this.subtitleBuilder,
customControls: customControls ?? this.customControls,
errorBuilder: errorBuilder ?? this.errorBuilder,
Expand Down Expand Up @@ -422,6 +425,9 @@ class ChewieController extends ChangeNotifier {
/// Add a List of Subtitles here in `Subtitles.subtitle`
Subtitles? subtitle;

/// Option to disable subtitle by default
Copy link
Collaborator

@diegotori diegotori Jul 2, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replace the documentation with:

/// 
/// Whether to display subtitles.
///
/// By default, this is set to `false`, which hides them.
/// 

bool showSubtitle;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make this final.


/// The controller for the video you want to play
final VideoPlayerController videoPlayerController;

Expand Down
4 changes: 3 additions & 1 deletion lib/src/cupertino/cupertino_controls.dart
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,9 @@ class _CupertinoControlsState extends State<CupertinoControls>
0.0,
notifier.hideStuff ? barHeight * 0.8 : 0.0,
),
child: _buildSubtitles(chewieController.subtitle!),
child: chewieController.showSubtitle
? _buildSubtitles(chewieController.subtitle!)
: const SizedBox(),
),
_buildBottomBar(backgroundColor, iconColor, barHeight),
],
Expand Down
5 changes: 3 additions & 2 deletions lib/src/material/material_controls.dart
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,9 @@ class _MaterialControlsState extends State<MaterialControls>
0.0,
notifier.hideStuff ? barHeight * 0.8 : 0.0,
),
child:
_buildSubtitles(context, chewieController.subtitle!),
child: chewieController.showSubtitle
? _buildSubtitles(context, chewieController.subtitle!)
: const SizedBox(),
),
_buildBottomBar(context),
],
Expand Down
5 changes: 3 additions & 2 deletions lib/src/material/material_desktop_controls.dart
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,9 @@ class _MaterialDesktopControlsState extends State<MaterialDesktopControls>
0.0,
notifier.hideStuff ? barHeight * 0.8 : 0.0,
),
child:
_buildSubtitles(context, chewieController.subtitle!),
child: chewieController.showSubtitle
? _buildSubtitles(context, chewieController.subtitle!)
: Container(),
),
_buildBottomBar(context),
],
Expand Down