/
email_fab.dart
74 lines (65 loc) · 2.12 KB
/
email_fab.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
import 'package:flutter/material.dart';
class EmailFAB extends StatelessWidget {
const EmailFAB({
Key key,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return FloatingActionButton(
backgroundColor:
Theme.of(context).brightness == Brightness.dark ? null : Colors.white,
// child: ShaderMask(
// shaderCallback: (Rect bounds) {
// return RadialGradient(
// center: Alignment.center,
// radius: 1.0,
// colors: <Color>[
// Colors.yellowAccent,
// Colors.blueAccent,
// Colors.redAccent,
// Colors.greenAccent,
// ],
// tileMode: TileMode.mirror,
// ).createShader(bounds);
// },
// child: Icon(Icons.add, size: 40.0),
// ),
child: CustomPaint(
child: Container(),
foregroundPainter: FloatingPainter(),
),
onPressed: () {},
);
}
}
class FloatingPainter extends CustomPainter {
@override
void paint(Canvas canvas, Size size) {
Paint amberPaint = Paint()
..color = Colors.amber
..strokeWidth = 5;
Paint greenPaint = Paint()
..color = Colors.green
..strokeWidth = 5;
Paint bluePaint = Paint()
..color = Colors.blue
..strokeWidth = 5;
Paint redPaint = Paint()
..color = Colors.red
..strokeWidth = 5;
canvas.drawLine(Offset(size.width * 0.27, size.height * 0.5),
Offset(size.width * 0.5, size.height * 0.5), amberPaint);
canvas.drawLine(
Offset(size.width * 0.5, size.height * 0.5),
Offset(size.width * 0.5, size.height - (size.height * 0.27)),
greenPaint);
canvas.drawLine(Offset(size.width * 0.5, size.height * 0.5),
Offset(size.width - (size.width * 0.27), size.height * 0.5), bluePaint);
canvas.drawLine(Offset(size.width * 0.5, size.height * 0.5),
Offset(size.width * 0.5, size.height * 0.27), redPaint);
}
@override
bool shouldRepaint(FloatingPainter oldDelegate) => false;
@override
bool shouldRebuildSemantics(FloatingPainter oldDelegate) => false;
}