Button constructor
Button({
- Key? key,
- required BuildContext context,
- required String title,
- required void action(),
- Color? color = const Color.fromRGBO(255, 165, 40, 1),
- bool isLoading = false,
Implementation
Button({
super.key,
required this.context,
required this.title,
required this.action,
this.color = const Color.fromRGBO(255, 165, 40, 1),
this.isLoading = false
}) : super(
onTap: (){
if(!isLoading){
action();
}
},
child: Container(
padding: const EdgeInsets.all(15),
width: Utils.width(context),
decoration: BoxDecoration(
color: isLoading ? Colors.grey : color,
borderRadius: BorderRadius.circular(5)
),
child: Center(
child: (isLoading) ?
const SizedBox(
height: 15,
width: 15,
child: CircularProgressIndicator(
strokeWidth: 3,
color: Colors.white,
)
) :
Text(
title,
style: const TextStyle(
color: Colors.white,
fontWeight: FontWeight.w700
),
),
)
),
);