| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- import 'package:flutter/material.dart';
- class MyElevatedButton extends StatelessWidget {
- final BorderRadiusGeometry? borderRadius;
- final double? width;
- final double height;
- final Gradient gradient;
- final VoidCallback? onPressed;
- final Widget child;
- const MyElevatedButton({
- super.key,
- required this.onPressed,
- required this.child,
- this.borderRadius,
- this.width,
- this.height = 44.0,
- this.gradient = const LinearGradient(colors: [Colors.cyan, Colors.indigo]),
- });
- @override
- Widget build(BuildContext context) {
- final borderRadius = this.borderRadius ?? BorderRadius.circular(0);
- return Container(
- width: width,
- height: height,
- decoration: BoxDecoration(
- gradient: gradient,
- borderRadius: borderRadius,
- boxShadow: const [
- BoxShadow(
- color: Colors.black,
- //spreadRadius: 10,
- //blurRadius: 2,
- ),
- ],
- ),
- child: ElevatedButton(
- onPressed: onPressed,
- style: ElevatedButton.styleFrom(
- backgroundColor: Colors.transparent,
- shadowColor: Colors.transparent,
- shape: RoundedRectangleBorder(borderRadius: borderRadius),
- ),
- child: child,
- ),
- );
- }
- }
|