-
Notifications
You must be signed in to change notification settings - Fork 998
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #703 from GyanendroKh/master
Adding Seek buttons for Android
- Loading branch information
Showing
3 changed files
with
138 additions
and
7 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import 'package:flutter/material.dart'; | ||
|
||
class CenterSeekButton extends StatelessWidget { | ||
const CenterSeekButton({ | ||
Key? key, | ||
required this.iconData, | ||
required this.backgroundColor, | ||
this.iconColor, | ||
required this.show, | ||
this.fadeDuration = const Duration(milliseconds: 300), | ||
this.iconSize = 26, | ||
this.onPressed, | ||
}) : super(key: key); | ||
|
||
final IconData iconData; | ||
final Color backgroundColor; | ||
final Color? iconColor; | ||
final bool show; | ||
final VoidCallback? onPressed; | ||
final Duration fadeDuration; | ||
final double iconSize; | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return ColoredBox( | ||
color: Colors.transparent, | ||
child: Center( | ||
child: UnconstrainedBox( | ||
child: AnimatedOpacity( | ||
opacity: show ? 1.0 : 0.0, | ||
duration: fadeDuration, | ||
child: DecoratedBox( | ||
decoration: BoxDecoration( | ||
color: 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: iconSize, | ||
padding: const EdgeInsets.all(8.0), | ||
icon: Icon(iconData, color: iconColor), | ||
onPressed: onPressed, | ||
), | ||
), | ||
), | ||
), | ||
), | ||
); | ||
} | ||
} |
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