forked from TheAlphamerc/flutter_twitter_clone
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrippleButton.dart
42 lines (40 loc) · 1.07 KB
/
rippleButton.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import 'package:flutter/material.dart';
class RippleButton extends StatelessWidget {
final Widget child;
final Function? onPressed;
final BorderRadius borderRadius;
final Color? splashColor;
const RippleButton(
{Key? key,
required this.child,
this.onPressed,
this.borderRadius = const BorderRadius.all(Radius.circular(0)),
this.splashColor})
: super(key: key);
@override
Widget build(BuildContext context) {
return Stack(
children: <Widget>[
child,
Positioned(
left: 0,
right: 0,
top: 0,
bottom: 0,
child: TextButton(
style: ButtonStyle(
shape: MaterialStateProperty.all(
RoundedRectangleBorder(borderRadius: borderRadius)),
foregroundColor: MaterialStateProperty.all(splashColor),
),
onPressed: () {
if (onPressed != null) {
onPressed!();
}
},
child: Container()),
)
],
);
}
}