You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ansu_ui/lib/buttons/as_material_button.dart

76 lines
1.6 KiB

import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
4 years ago
import 'package:ansu_ui/styles/as_colors.dart';
import 'package:ansu_ui/extension/num_extension.dart';
///ASMaterialButton
///
///default value:
///
///height = 46.w
///
///radius = 5.radius
///
///padding = 0.edge
class ASMaterialButton extends StatelessWidget {
final VoidCallback? onPressed;
final double? height;
final Widget? icon;
final double? radius;
final Widget child;
final EdgeInsets? padding;
final Color? color;
const ASMaterialButton({
Key? key,
this.onPressed,
this.height,
this.icon,
required this.child,
this.radius,
this.padding,
this.color,
}) : super(key: key);
ASMaterialButton.dropdown({
Key? key,
this.onPressed,
this.height,
required this.child,
this.radius,
this.padding,
this.color,
}) : icon = Icon(
CupertinoIcons.chevron_down,
size: 16.w,
color: kTextSubColor,
),
super(key: key);
@override
Widget build(BuildContext context) {
return MaterialButton(
color: color,
onPressed: onPressed,
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
padding: padding ?? 0.edge,
minWidth: 0,
height: height ?? 46.w,
child: icon == null
? child
: Row(
children: [
child,
4.wb,
icon!,
],
),
shape: RoundedRectangleBorder(
borderRadius: (radius ?? 5).radius,
),
elevation: 0,
);
}
}