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.
38 lines
1.3 KiB
Dart
38 lines
1.3 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
import '../../app_style/colors.dart';
|
|
import '../../app_style/sizing.dart';
|
|
|
|
class AButton extends StatelessWidget {
|
|
final String text;
|
|
final Color color;
|
|
final EdgeInsets? padding;
|
|
|
|
final TextStyle? textStyle;
|
|
final VoidCallback? onPressed;
|
|
|
|
const AButton({Key? key, this.color = AColors.primaryColor, required this.text, this.padding, this.onPressed, this.textStyle}) : super(key: key);
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return SizedBox(
|
|
width: MediaQuery.of(context).size.width,
|
|
child: ElevatedButton(
|
|
style: ElevatedButton.styleFrom(
|
|
elevation: 0,
|
|
foregroundColor: color.computeLuminance() > 0.5 ? AColors.black : Colors.white,
|
|
backgroundColor: color,
|
|
padding: padding ?? const EdgeInsets.symmetric(vertical: 12),
|
|
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(AppStyle.getBorderRadius(context))),
|
|
),
|
|
onPressed: onPressed,
|
|
child: Text(
|
|
text ?? "",
|
|
style: textStyle ?? Theme.of(context).textTheme.subtitle2?.copyWith(color: AColors.white, fontSize: 14,fontWeight: FontWeight.w600),
|
|
textScaleFactor: AppStyle.getScaleFactor(context),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|