-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Added seek forward and rewind buttons #717
Open
punit1111
wants to merge
7
commits into
fluttercommunity:master
Choose a base branch
from
punit1111:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+197
−33
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
ac80825
Added seek forward and rewind buttons
punitDT e34033c
Update seek_rewind_button.dart
punit1111 a847292
Merge branch 'fluttercommunity:master' into master
punit1111 70a5875
code refactor
punitDT ab57910
Merge branch 'fluttercommunity:master' into master
punit1111 ca7a04f
fixed changes
punitDT e9daf6b
hide seek buttons for cupertino controls
punitDT File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
import 'package:flutter/material.dart'; | ||
|
||
import 'center_play_button.dart'; | ||
import 'seek_control_button.dart'; | ||
|
||
class HitAreaControls extends StatelessWidget { | ||
const HitAreaControls({ | ||
Key? key, | ||
required this.onTapPlay, | ||
required this.onPressedPlay, | ||
required this.backgroundColor, | ||
required this.iconColor, | ||
required this.isFinished, | ||
required this.isPlaying, | ||
required this.showPlayButton, | ||
required this.showSeekButton, | ||
this.seekRewind, | ||
this.seekForward, | ||
}) : super(key: key); | ||
|
||
final VoidCallback onTapPlay; | ||
final VoidCallback onPressedPlay; | ||
final VoidCallback? seekRewind; | ||
final VoidCallback? seekForward; | ||
final Color backgroundColor; | ||
final Color iconColor; | ||
final bool isFinished; | ||
final bool isPlaying; | ||
final bool showPlayButton; | ||
final bool showSeekButton; | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Row( | ||
mainAxisAlignment: MainAxisAlignment.center, | ||
children: [ | ||
showSeekButton | ||
? SeekControlButton( | ||
backgroundColor: backgroundColor, | ||
iconColor: iconColor, | ||
onPressed: seekRewind, | ||
onDoublePressed: seekRewind, | ||
icon: Icons.fast_rewind, | ||
) | ||
: const SizedBox.shrink(), | ||
GestureDetector( | ||
onTap: onTapPlay, | ||
child: CenterPlayButton( | ||
backgroundColor: backgroundColor, | ||
iconColor: iconColor, | ||
isFinished: isFinished, | ||
isPlaying: isPlaying, | ||
show: showPlayButton, | ||
onPressed: onPressedPlay, | ||
), | ||
), | ||
showSeekButton | ||
? SeekControlButton( | ||
backgroundColor: backgroundColor, | ||
iconColor: iconColor, | ||
onPressed: seekForward, | ||
onDoublePressed: seekForward, | ||
icon: Icons.fast_forward, | ||
) | ||
: const SizedBox.shrink(), | ||
], | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import 'package:flutter/material.dart'; | ||
|
||
class SeekControlButton extends StatefulWidget { | ||
const SeekControlButton({ | ||
Key? key, | ||
required this.backgroundColor, | ||
required this.iconColor, | ||
required this.icon, | ||
this.onPressed, | ||
this.onDoublePressed, | ||
}) : super(key: key); | ||
|
||
final Color backgroundColor; | ||
final Color iconColor; | ||
final VoidCallback? onPressed; | ||
final VoidCallback? onDoublePressed; | ||
final IconData icon; | ||
|
||
@override | ||
State<SeekControlButton> createState() => _SeekControlButtonState(); | ||
} | ||
|
||
class _SeekControlButtonState extends State<SeekControlButton> { | ||
@override | ||
void initState() { | ||
super.initState(); | ||
} | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Expanded( | ||
child: GestureDetector( | ||
onDoubleTap: widget.onDoublePressed, | ||
child: ColoredBox( | ||
color: Colors.transparent, | ||
child: Center( | ||
child: DecoratedBox( | ||
decoration: BoxDecoration( | ||
color: widget.backgroundColor, | ||
shape: BoxShape.circle, | ||
), | ||
// Always set the iconSize on the IconButton, not on the Icon itself: | ||
// https://github.com/flutter/flutter/issues/52980 | ||
child: IconButton( | ||
iconSize: 32, | ||
padding: const EdgeInsets.all(12.0), | ||
icon: Icon(widget.icon, color: widget.iconColor), | ||
onPressed: widget.onPressed, | ||
), | ||
), | ||
), | ||
), | ||
), | ||
); | ||
} | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cupertino controls already have the seek-forward and rewind buttons in the seek bar (i.e. the ones that rewind and fast-forward by 15 seconds).
As a result, this change should only apply to Material based widgets.
Do this for the other new widgets added in this PR, since they should only apply to Material.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello @diegotori
requested changes done please review
Thank you