Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class SimpleBackButton extends StatelessWidget {
- const SimpleBackButton({
- Key key,
- this.color,
- this.icon,
- this.onPressed,
- }) : super(key: key);
- /// The color to use for the icon.
- ///
- /// Defaults to the [IconThemeData.color] specified in the ambient [IconTheme],
- /// which usually matches the ambient [Theme]'s [ThemeData.iconTheme].
- final Color color;
- final Widget icon;
- final VoidCallback onPressed;
- @override
- Widget build(BuildContext context) {
- assert(debugCheckHasMaterialLocalizations(context));
- return IconButton(
- icon: icon ?? const BackButtonIcon(),
- color: color,
- tooltip: MaterialLocalizations.of(context).backButtonTooltip,
- onPressed: () {
- if (onPressed == null) {
- Navigator.maybePop(context);
- } else {
- onPressed();
- }
- },
- );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement