buildButton method
Widget
buildButton({
- BuildContext? context,
- required bool isOkayBtn,
- required String text,
- VoidCallback? onTap,
Implementation
Widget buildButton({
BuildContext? context,
required bool isOkayBtn,
required String text,
VoidCallback? onTap,
}) {
final btnText = Text(
text,
style: defaultTextStyle(isOkayBtn),
);
final okayBtn = MaterialButton(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(15.0),
),
color: options.confirmBtnColor ?? Theme.of(context!).primaryColor,
onPressed: onTap,
child: Center(
child: Padding(
padding: const EdgeInsets.all(7.5),
child: btnText,
),
),
);
final cancelBtn = GestureDetector(
onTap: onTap,
child: Center(
child: btnText,
),
);
return isOkayBtn ? okayBtn : cancelBtn;
}