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

Adding options for full width and padding for text container #82

Open
wants to merge 3 commits into
base: main
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
2 changes: 1 addition & 1 deletion example/.flutter-plugins-dependencies
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"video_player_avfoundation","path":"/Users/jorandob/.pub-cache/hosted/pub.dev/video_player_avfoundation-2.3.4/","native_build":true,"dependencies":[]},{"name":"wakelock","path":"/Users/jorandob/.pub-cache/hosted/pub.dev/wakelock-0.6.1+2/","native_build":true,"dependencies":[]}],"android":[{"name":"video_player_android","path":"/Users/jorandob/.pub-cache/hosted/pub.dev/video_player_android-2.3.4/","native_build":true,"dependencies":[]},{"name":"wakelock","path":"/Users/jorandob/.pub-cache/hosted/pub.dev/wakelock-0.6.1+2/","native_build":true,"dependencies":[]}],"macos":[{"name":"wakelock_macos","path":"/Users/jorandob/.pub-cache/hosted/pub.dev/wakelock_macos-0.4.0/","native_build":true,"dependencies":[]}],"linux":[],"windows":[],"web":[{"name":"video_player_web","path":"/Users/jorandob/.pub-cache/hosted/pub.dev/video_player_web-2.0.10/","dependencies":[]},{"name":"wakelock_web","path":"/Users/jorandob/.pub-cache/hosted/pub.dev/wakelock_web-0.4.0/","dependencies":[]}]},"dependencyGraph":[{"name":"video_player","dependencies":["video_player_android","video_player_avfoundation","video_player_web"]},{"name":"video_player_android","dependencies":[]},{"name":"video_player_avfoundation","dependencies":[]},{"name":"video_player_web","dependencies":[]},{"name":"wakelock","dependencies":["wakelock_macos","wakelock_web"]},{"name":"wakelock_macos","dependencies":[]},{"name":"wakelock_web","dependencies":[]}],"date_created":"2023-09-30 16:01:29.270889","version":"3.13.0"}
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"video_player_avfoundation","path":"/Users/marekchojecki/.pub-cache/hosted/pub.dev/video_player_avfoundation-2.3.4/","native_build":true,"dependencies":[]},{"name":"wakelock","path":"/Users/marekchojecki/.pub-cache/hosted/pub.dev/wakelock-0.6.1+2/","native_build":true,"dependencies":[]}],"android":[{"name":"video_player_android","path":"/Users/marekchojecki/.pub-cache/hosted/pub.dev/video_player_android-2.3.4/","native_build":true,"dependencies":[]},{"name":"wakelock","path":"/Users/marekchojecki/.pub-cache/hosted/pub.dev/wakelock-0.6.1+2/","native_build":true,"dependencies":[]}],"macos":[{"name":"wakelock_macos","path":"/Users/marekchojecki/.pub-cache/hosted/pub.dev/wakelock_macos-0.4.0/","native_build":true,"dependencies":[]}],"linux":[],"windows":[],"web":[{"name":"video_player_web","path":"/Users/marekchojecki/.pub-cache/hosted/pub.dev/video_player_web-2.0.10/","dependencies":[]},{"name":"wakelock_web","path":"/Users/marekchojecki/.pub-cache/hosted/pub.dev/wakelock_web-0.4.0/","dependencies":[]}]},"dependencyGraph":[{"name":"video_player","dependencies":["video_player_android","video_player_avfoundation","video_player_web"]},{"name":"video_player_android","dependencies":[]},{"name":"video_player_avfoundation","dependencies":[]},{"name":"video_player_web","dependencies":[]},{"name":"wakelock","dependencies":["wakelock_macos","wakelock_web"]},{"name":"wakelock_macos","dependencies":[]},{"name":"wakelock_web","dependencies":[]}],"date_created":"2023-10-31 11:01:33.658902","version":"3.13.7"}
2 changes: 1 addition & 1 deletion example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ packages:
path: ".."
relative: true
source: path
version: "2.1.1"
version: "2.2.0"
term_glyph:
dependency: transitive
description:
Expand Down
8 changes: 8 additions & 0 deletions lib/subtitle_text_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,13 @@ class SubtitleTextView extends StatelessWidget {
required this.subtitleStyle,
super.key,
this.backgroundColor,
this.fullWidth = false,
this.padding,
});
final SubtitleStyle subtitleStyle;
final Color? backgroundColor;
final bool fullWidth;
final double? padding;

TextStyle get _textStyle {
return subtitleStyle.hasBorder
Expand Down Expand Up @@ -47,6 +51,10 @@ class SubtitleTextView extends StatelessWidget {
children: <Widget>[
Center(
child: Container(
padding: padding != null
? EdgeInsets.all(padding!)
: EdgeInsets.zero,
width: fullWidth ? double.infinity : null,
color: backgroundColor,
child: _TextContent(
text: state.subtitle!.text,
Expand Down
6 changes: 6 additions & 0 deletions lib/subtitle_wrapper.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,16 @@ class SubtitleWrapper extends StatelessWidget {
super.key,
this.subtitleStyle = const SubtitleStyle(),
this.backgroundColor,
this.fullWidth = false,
this.padding,
});
final Widget videoChild;
final SubtitleController subtitleController;
final VideoPlayerController videoPlayerController;
final SubtitleStyle subtitleStyle;
final Color? backgroundColor;
final bool fullWidth;
final double? padding;

@override
Widget build(BuildContext context) {
Expand Down Expand Up @@ -45,6 +49,8 @@ class SubtitleWrapper extends StatelessWidget {
child: SubtitleTextView(
subtitleStyle: subtitleStyle,
backgroundColor: backgroundColor,
fullWidth: fullWidth,
padding: padding,
),
),
)
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: subtitle_wrapper_package
description: A Subtitle Wrapper package, this subtitle wrapper package displays subtitles for a video player.
version: 2.2.0
version: 2.2.1
homepage: https://github.com/Joran-Dob/flutter_subtitle_wrapper

environment:
Expand Down