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.
cloudsolutions-atoms/old_lib/views/widgets/buttons/app_icon_button.dart

52 lines
1.3 KiB
Dart

import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import '../../app_style/colors.dart';
import '../../app_style/sizing.dart';
class AIconButton extends StatelessWidget {
final IconData iconData;
final Color? color;
final Color? backgroundColor;
final VoidCallback? onPressed;
final double? iconSize;
final double buttonSize;
const AIconButton({
Key? key,
required this.iconData,
this.onPressed,
this.color,
this.iconSize,
this.buttonSize = 54,
this.backgroundColor
}) : super(key: key);
@override
Widget build(BuildContext context) {
return SizedBox(
height: buttonSize * AppStyle.getScaleFactor(context),
width: buttonSize * AppStyle.getScaleFactor(context),
child: ElevatedButton(
style: ElevatedButton.styleFrom(
padding: EdgeInsets.zero,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(
(AppStyle.borderRadius - 4) * AppStyle.getScaleFactor(context)
)
),
backgroundColor: backgroundColor ?? AColors.onPrimaryColor,
),
onPressed: onPressed,
child: FaIcon(
iconData,
color: color ?? AColors.primaryColor,
size: iconSize ?? 32,
),
),
);
}
}