Skip to content

Instantly share code, notes, and snippets.

@frencojobs
Created June 18, 2020 01:18
Show Gist options
  • Save frencojobs/4a11a078e74c31df713ce98afc60c18e to your computer and use it in GitHub Desktop.
Save frencojobs/4a11a078e74c31df713ce98afc60c18e to your computer and use it in GitHub Desktop.
How I make better-looking IconButton replacement.
import 'package:flutter/material.dart';
class ActionButton extends StatelessWidget {
final Function onPressed;
final Icon icon;
ActionButton({
@required this.onPressed,
@required this.icon,
});
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.all(
NavigationToolbar.kMiddleSpacing / 2,
),
child: Material(
clipBehavior: Clip.antiAlias,
shape: CircleBorder(),
color: Colors.transparent,
child: InkWell(
onTap: onPressed,
child: Padding(
padding: const EdgeInsets.all(
NavigationToolbar.kMiddleSpacing / 2,
),
child: icon,
),
),
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment