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/lib/views/widgets/buttons/app_icon_button.dart

37 lines
1.3 KiB
Dart

3 years ago
import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:test_sa/views/app_style/colors.dart';
import 'package:test_sa/views/app_style/sizing.dart';
3 years ago
class AIconButton extends StatelessWidget {
3 years ago
final IconData iconData;
final Color color;
final Color backgroundColor;
final VoidCallback onPressed;
final double iconSize;
final double buttonSize;
const AIconButton({Key key, this.iconData, this.onPressed, this.color, this.iconSize, this.buttonSize = 54, this.backgroundColor}) : super(key: key);
3 years ago
@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,
3 years ago
),
onPressed: onPressed,
child: FaIcon(
iconData,
color: color ?? AColors.primaryColor,
size: iconSize ?? 32,
),
),
);
}
}