import 'package:flutter/material.dart'; class RoundButton extends StatelessWidget { final String? text; final String? img; final Widget? icons; final Color textColor; final Color backgroup; final double fontSize; final double radius; final double? height; final double? width; final FontWeight fontWeight; final EdgeInsetsGeometry? padding; final GestureTapCallback? callback; RoundButton({ Key? key, this.text, this.textColor = Colors.black, this.fontSize = 10, this.backgroup = Colors.white, this.radius = 2, this.img, this.height, this.width, this.icons, this.padding, this.fontWeight = FontWeight.normal, this.callback, }); @override Widget build(BuildContext context) { return GestureDetector( child: Container( padding: padding, width: width, height: height, alignment: Alignment.center, decoration: BoxDecoration( color: backgroup, borderRadius: BorderRadius.circular(radius), ), child: buildText(), ), onTap: this.callback, ); } Widget buildText() { Widget textWidget = Text( text ?? "", overflow: TextOverflow.ellipsis, style: TextStyle( color: textColor, fontSize: fontSize, fontWeight: fontWeight, ), ); if (icons != null) { return Row( mainAxisSize: MainAxisSize.min, children: [ icons!, SizedBox( width: 4, ), textWidget, ], ); } else { return Row( mainAxisSize: MainAxisSize.min, mainAxisAlignment: MainAxisAlignment.center, children: [ textWidget, ], ); } } }