Line data Source code
1 : import 'package:flutter/material.dart';
2 :
3 : class CircleImageButton extends StatelessWidget {
4 : final Color backgroundColor;
5 : final Color splashColor;
6 : final num radius;
7 : final String image;
8 : final BoxShadow shadow;
9 6 : const CircleImageButton({
10 : Key key,
11 : this.backgroundColor = Colors.blue,
12 : this.splashColor,
13 : this.radius = 20.0,
14 : this.shadow,
15 : @required this.image,
16 6 : }) : super(key: key);
17 :
18 6 : @override
19 : Widget build(BuildContext context) {
20 6 : return Container(
21 6 : decoration: BoxDecoration(
22 : shape: BoxShape.circle,
23 : color: Colors.transparent,
24 6 : border: Border.all(
25 : color: Colors.white,
26 : width: 3.0,
27 : ),
28 6 : boxShadow: [
29 6 : shadow ??
30 0 : BoxShadow(
31 0 : color: Colors.black.withOpacity(0.1),
32 : spreadRadius: 5,
33 : blurRadius: 9,
34 0 : offset: Offset(0, 3), // changes position of shadow
35 : ),
36 : ],
37 : ),
38 6 : child: ClipOval(
39 6 : child: Material(
40 6 : color: backgroundColor,
41 6 : child: SizedBox(
42 12 : width: radius * 2,
43 12 : height: radius * 2,
44 12 : child: Image.asset(image),
45 : ),
46 : ),
47 : ),
48 : );
49 : }
50 : }
|