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.
50 lines
1.3 KiB
Dart
50 lines
1.3 KiB
Dart
|
3 years ago
|
import 'package:test_sa/views/app_style/colors.dart';
|
||
|
|
import 'package:test_sa/views/app_style/sizing.dart';
|
||
|
|
import 'package:flutter/material.dart';
|
||
|
|
import 'package:font_awesome_flutter/font_awesome_flutter.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,
|
||
|
|
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,
|
||
|
|
),
|
||
|
|
),
|
||
|
|
);
|
||
|
|
}
|
||
|
|
}
|