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.
56 lines
1.4 KiB
56 lines
1.4 KiB
3 years ago
|
import 'package:flutter/cupertino.dart';
|
||
|
import 'package:flutter/material.dart';
|
||
|
|
||
|
class RaisedGradientButton extends StatelessWidget {
|
||
|
final Widget child;
|
||
|
final Gradient gradient;
|
||
|
final double width;
|
||
|
final double height;
|
||
|
final Function onPressed;
|
||
|
|
||
|
const RaisedGradientButton({
|
||
|
Key key,
|
||
|
@required this.child,
|
||
|
this.gradient,
|
||
|
this.width = double.infinity,
|
||
|
this.height = 50.0,
|
||
|
this.onPressed,
|
||
|
}) : super(key: key);
|
||
|
|
||
|
@override
|
||
|
Widget build(BuildContext context) {
|
||
|
return ClipRRect(
|
||
|
borderRadius: BorderRadius.only(
|
||
|
topLeft: Radius.circular(30.0),
|
||
|
topRight: Radius.circular(30.0),
|
||
|
bottomLeft: Radius.circular(30),
|
||
|
bottomRight: Radius.circular(30),
|
||
|
),
|
||
|
child: Container(
|
||
|
width: width,
|
||
|
height: 40.0,
|
||
|
decoration: BoxDecoration(gradient: gradient, boxShadow: [
|
||
|
BoxShadow(
|
||
|
color: Colors.grey[500],
|
||
|
offset: Offset(0.0, 1.5),
|
||
|
blurRadius: 1.5,
|
||
|
),
|
||
|
]),
|
||
|
child: Material(
|
||
|
shape: RoundedRectangleBorder(
|
||
|
borderRadius: BorderRadius.all(
|
||
|
Radius.circular(25.0),
|
||
|
),
|
||
|
),
|
||
|
color: Colors.transparent,
|
||
|
child: InkWell(
|
||
|
onTap: onPressed,
|
||
|
child: Center(
|
||
|
child: child,
|
||
|
)),
|
||
|
),
|
||
|
),
|
||
|
);
|
||
|
}
|
||
|
}
|