button static method
Implementation
static Widget button(
{String? title,
IconData? icon,
Color? iconColor,
bool waiting = false,
onPress,
Widget? titleWidget,
required context}) {
return ElevatedButton(
style: ElevatedButton.styleFrom(
padding: const EdgeInsets.all(5.0),
side: BorderSide(
width: 1, // the thickness
color: Theme.of(context)
.colorScheme
.primary // the color of the border
)),
onPressed: !waiting ? onPress : null,
child: titleWidget ??
Row(
mainAxisSize: MainAxisSize.min,
children: [
if (icon != null && !waiting)
Icon(
icon,
size: 20,
color: iconColor,
),
if (waiting)
const Padding(
padding: EdgeInsets.only(right: 3.0),
child: SizedBox(
width: 15,
height: 15,
child: CircularProgressIndicator()),
),
if (title != null)
Row(
mainAxisSize: MainAxisSize.min,
children: [
const SizedBox(
width: 5,
),
Text(title),
],
),
],
));
}