123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- import 'package:flutter/material.dart';
- class MyButton extends StatelessWidget {
- final String text;
- final VoidCallback? onTap;
- final Gradient? gradient;
- final double radius;
- final Color? backgroundColor;
- final double? width;
- final double? minWidth;
- final double? height;
- final double? minHeight;
- final double fountSize;
- final Color? fountColor;
- final FontWeight? fontWeight;
- final EdgeInsetsGeometry? padding;
- final EdgeInsetsGeometry? margin;
- final AlignmentGeometry? alignment;
- const MyButton(
- this.text, {
- Key? key,
- this.backgroundColor = const Color(0xFF25A6EE),
- this.gradient,
- this.radius = 100,
- this.width,
- this.minWidth,
- this.height,
- this.minHeight,
- this.onTap,
- this.fountSize = 14,
- this.fountColor = Colors.white,
- this.fontWeight,
- this.margin,
- this.padding = const EdgeInsets.symmetric(vertical: 8, horizontal: 16),
- this.alignment = Alignment.center,
- }) : super(key: key);
- @override
- Widget build(BuildContext context) {
- return GestureDetector(
- onTap: onTap,
- child: Container(
- width: width,
- height: height,
- constraints: BoxConstraints(minWidth: minWidth ?? 0, minHeight: minHeight ?? 0),
- padding: padding,
- margin: margin,
- alignment: alignment,
- decoration: BoxDecoration(
- gradient: gradient,
- borderRadius: BorderRadius.all(Radius.circular(radius)),
- color: backgroundColor,
- ),
- child: Text(
- text,
- style: TextStyle(fontSize: fountSize, color: fountColor, fontWeight: fontWeight),
- ),
- ),
- );
- }
- }
|