-
Notifications
You must be signed in to change notification settings - Fork 66
/
Copy pathmap_button.dart
79 lines (74 loc) · 2.4 KB
/
map_button.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
75
76
77
78
79
import 'package:flutter/material.dart';
import 'package:flutter_challenge_googlemaps/helper/ui_helper.dart';
class MapButton extends StatelessWidget {
final double currentSearchPercent;
final double currentExplorePercent;
final double bottom;
final double offsetX;
final double width;
final double height;
final IconData icon;
final Color iconColor;
final bool isRight;
final Gradient gradient;
const MapButton(
{Key? key,
required this.currentSearchPercent,
required this.currentExplorePercent,
required this.bottom,
required this.offsetX,
required this.width,
required this.height,
required this.icon,
required this.iconColor,
this.isRight = true,
required this.gradient})
: assert(currentExplorePercent != null),
assert(currentExplorePercent != null),
assert(bottom != null),
assert(offsetX != null),
assert(width != null),
assert(height != null),
assert(icon != null),
super(key: key);
@override
Widget build(BuildContext context) {
return Positioned(
bottom: realH(bottom),
left: !isRight
? realW(offsetX * (currentExplorePercent + currentSearchPercent))
: null,
right: isRight
? realW(offsetX * (currentExplorePercent + currentSearchPercent))
: null,
child: Opacity(
opacity: 1 - (currentSearchPercent + currentExplorePercent),
child: Container(
width: realW(width),
height: realH(height),
alignment: Alignment.centerLeft,
padding: EdgeInsets.only(left: realW(17)),
child: Icon(
icon,
size: realW(34),
color: iconColor ?? Colors.black,
),
decoration: BoxDecoration(
color: gradient == null ? Colors.white : null,
gradient: gradient,
borderRadius: isRight
? BorderRadius.only(
bottomLeft: Radius.circular(realW(36)),
topLeft: Radius.circular(realW(36)))
: BorderRadius.only(
bottomRight: Radius.circular(realW(36)),
topRight: Radius.circular(realW(36))),
boxShadow: [
BoxShadow(
color: Color.fromRGBO(0, 0, 0, 0.3), blurRadius: realW(36)),
]),
),
),
);
}
}