Skip to content

Instantly share code, notes, and snippets.

@JEuler
Last active April 23, 2020 07:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JEuler/74ade58e0b3b1bff5b63c76e70fb8b2a to your computer and use it in GitHub Desktop.
Save JEuler/74ade58e0b3b1bff5b63c76e70fb8b2a to your computer and use it in GitHub Desktop.
Button with a circle shape
import 'package:flutter/material.dart';
/// Button that have a circle shape
class CircleButton extends StatelessWidget {
// ignore: public_member_api_docs
const CircleButton(
{Key key,
this.onTap,
this.child,
this.size,
this.backgroundColor = Colors.white})
: super(key: key);
/// Action to call on Tap
final GestureTapCallback onTap;
/// Icon size
final double size;
/// Widget to show
final Widget child;
/// Color of background
final Color backgroundColor;
@override
Widget build(BuildContext context) {
return InkResponse(
onTap: onTap,
child: Container(
width: size,
height: size,
decoration: BoxDecoration(
color: backgroundColor,
shape: BoxShape.circle,
),
child: child,
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment