Aidra Connect 10.0.2+16
Aidra Connect Mobile Application
Loading...
Searching...
No Matches
cartoon_tracker.dart
Go to the documentation of this file.
1import 'package:flutter/material.dart';
2import 'package:flutter_screenutil/flutter_screenutil.dart';
3import 'package:flutter_svg/svg.dart';
4
5class CarbonTrackerCard extends StatelessWidget {
6 final double currentCO2;
7 final double targetCO2;
8 final int points;
9 final double progress;
10
12 super.key,
13 required this.currentCO2,
14 required this.targetCO2,
15 required this.points,
16 required this.progress,
17 });
18
19 @override
20 Widget build(BuildContext context) {
21 return Container(
22 decoration: BoxDecoration(
23 borderRadius: BorderRadius.circular(16),
24 gradient: LinearGradient(
25 colors: [
26 Theme.of(context).colorScheme.primary,
27 Theme.of(context).colorScheme.secondary,
28 ],
29 ),
30 ),
31 child: Padding(
32 padding: const EdgeInsets.all(20.0),
33 child: Column(
34 crossAxisAlignment: CrossAxisAlignment.start,
35 mainAxisSize: MainAxisSize.min,
36 children: [
37 Row(
38 mainAxisAlignment: MainAxisAlignment.spaceBetween,
39 children: [
40 Row(
41 children: [
42 SvgPicture.asset('assets/svgs/leaf.svg'),
43 SizedBox(width: 8.sp),
44 Text(
45 'You reached\n1/4 leaf',
46 style: Theme.of(context).textTheme.bodySmall?.copyWith(
47 color: Theme.of(context).colorScheme.onPrimary,
48 fontSize: 8.sp,
49 ),
50 ),
51 ],
52 ),
53 Text(
54 '$points point',
55 style: Theme.of(context).textTheme.bodySmall?.copyWith(
56 color: Theme.of(context).colorScheme.onPrimary,
57 ),
58 ),
59 ],
60 ),
61 SizedBox(height: 20.sp),
62 Column(
63 crossAxisAlignment: CrossAxisAlignment.center,
64 children: [
65 Text(
66 currentCO2.toString(),
67 style: Theme.of(context).textTheme.displayLarge?.copyWith(
68 color: Theme.of(context).colorScheme.onPrimary,
69 ),
70 ),
71 Opacity(
72 opacity: 0.7,
73 child: Text(
74 'kg of CO₂',
75 style: Theme.of(context).textTheme.bodySmall?.copyWith(
76 color: Theme.of(context).colorScheme.onPrimary,
77 ),
78 ),
79 ),
80 SizedBox(height: 13.sp),
81 LinearProgressIndicator(
82 minHeight: 5,
85 Theme.of(context).colorScheme.onPrimary.withOpacity(0.11),
86 valueColor: AlwaysStoppedAnimation<Color>(
87 Theme.of(context).colorScheme.onPrimary,
88 ),
89 ),
90 SizedBox(height: 12.sp),
91 Opacity(
92 opacity: 0.7,
93 child: Text(
94 'Your target: ${targetCO2.toStringAsFixed(2)} kg',
95 style: Theme.of(context).textTheme.bodySmall?.copyWith(
96 color: Theme.of(context).colorScheme.onPrimary,
97 ),
98 ),
99 ),
100 ],
101 ),
102 ],
103 ),
104 ),
105 );
106 }
107}
const CarbonTrackerCard({ super.key, required this.currentCO2, required this.targetCO2, required this.points, required this.progress, })
final double currentCO2
final Widget child
override Widget build(BuildContext context)
final double progress
final double targetCO2
final Color backgroundColor