You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
PatientApp-KKUMC/lib/widgets/buttons/defaultButton.dart

46 lines
1.4 KiB
Dart

import 'package:flutter/material.dart';
extension WithContainer on Widget {
Widget get insideContainer => Container(color: Colors.white, padding: EdgeInsets.only(top: 16, bottom: 16, right: 21, left: 21), child: this);
}
class DefaultButton extends StatelessWidget {
final String text;
4 years ago
final VoidCallback onPress;
final Color textColor;
final Color color;
4 years ago
final Color disabledColor;
final IconData iconData;
4 years ago
final double fontSize;
DefaultButton(this.text, this.onPress, {this.color, this.disabledColor, this.textColor = Colors.white, this.iconData, this.fontSize});
@override
Widget build(BuildContext context) {
return SizedBox(
height: 43,
width: double.infinity,
child: FlatButton(
4 years ago
onPressed: onPress,
child: Row(
children: [
if (iconData != null) Icon(iconData, color: textColor),
Expanded(
child: Text(
text,
textAlign: TextAlign.center,
4 years ago
style: TextStyle(fontSize: fontSize ?? 16, fontWeight: FontWeight.w600, color: textColor, letterSpacing: -0.48),
),
),
],
),
// color: Color(0xffD02127),
color: color ?? const Color(0xffD02127),
4 years ago
disabledColor: disabledColor,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(6),
),
),
);
}
}