-
Notifications
You must be signed in to change notification settings - Fork 33
/
Copy pathanalytics_card.dart
116 lines (114 loc) · 4.58 KB
/
analytics_card.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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
import 'package:airqo/src/app/dashboard/models/airquality_response.dart';
import 'package:airqo/src/app/dashboard/widgets/analytics_details.dart';
import 'package:airqo/src/meta/utils/colors.dart';
import 'package:airqo/src/meta/utils/utils.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
class AnalyticsCard extends StatelessWidget {
final Measurement measurement;
const AnalyticsCard(this.measurement);
@override
Widget build(BuildContext context) {
return InkWell(
onTap: () => showBottomSheet(
backgroundColor: Colors.transparent,
context: context,
builder: (context) {
return AnalyticsDetails(
measurement: measurement,
);
}),
child: Container(
color: Theme.of(context).highlightColor,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: const EdgeInsets.only(
left: 16, right: 16, bottom: 4, top: 16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
SvgPicture.asset(Theme.of(context).brightness ==
Brightness.light
? "assets/images/shared/pm_rating_white.svg"
: 'assets/images/shared/pm_rating.svg'),
SizedBox(width: 2),
Text(
" PM2.5",
style: TextStyle(
color: Color(0xff7A7F87),
),
),
],
),
Row(children: [
Text(
measurement.pm25!.value != null
? measurement.pm25!.value!
.toStringAsFixed(2)
: "-",
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 40,
color: AppColors.boldHeadlineColor2),
),
Text(" μg/m3",
style: TextStyle(
fontWeight: FontWeight.w600,
fontSize: 20,
color: AppColors.boldHeadlineColor2))
]),
]),
SizedBox(
child: Center(
child: SvgPicture.asset(
getAirQualityIcon(measurement, measurement.pm25!.value!),
height: 96,
width: 96,
),
),
),
],
),
],
),
),
Divider(
thickness: .5,
color: Theme.of(context).brightness == Brightness.dark
? Colors.black
: Colors.white),
Padding(
padding: const EdgeInsets.only(
left: 16, right: 16, bottom: 16, top: 4),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(measurement.siteDetails!.name ?? "",
style: TextStyle(
fontSize: 28,
fontWeight: FontWeight.w700,
color: AppColors.secondaryHeadlineColor3)),
Text(measurement.healthTips![0].description!,
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.w600,
color: AppColors.secondaryHeadlineColor2))
],
),
),
],
),
),
);
}
}