-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add YaruRoundIconButton and get rid of IconButtons (#146)
* YaruRoundToggleButton: replace icon button * RoundButtons: adapt to material 3 * Ger rid of icon buttons in yaru_widgets
- Loading branch information
1 parent
2773458
commit 621ac1e
Showing
5 changed files
with
76 additions
and
29 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
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,46 @@ | ||
import 'package:flutter/material.dart'; | ||
|
||
class YaruRoundIconButton extends StatelessWidget { | ||
const YaruRoundIconButton({ | ||
super.key, | ||
this.backgroundColor, | ||
this.onTap, | ||
this.tooltip, | ||
required this.child, | ||
this.size = 40, | ||
}); | ||
|
||
/// The [Color] used for the round background. | ||
final Color? backgroundColor; | ||
|
||
/// Optional onTap callback to select the button | ||
final Function()? onTap; | ||
|
||
/// String shown in the [Tooltip] | ||
final String? tooltip; | ||
|
||
/// | ||
final Widget child; | ||
|
||
final double size; | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Tooltip( | ||
message: tooltip ?? '', | ||
child: SizedBox( | ||
height: size, | ||
width: size, | ||
child: Material( | ||
color: backgroundColor, | ||
borderRadius: BorderRadius.circular(size / 2), | ||
child: InkWell( | ||
borderRadius: BorderRadius.circular(size / 2), | ||
onTap: onTap, | ||
child: child, | ||
), | ||
), | ||
), | ||
); | ||
} | ||
} |
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