Skip to content

Commit efc3a4a

Browse files
Merge branch 'main' into profile-page
2 parents 02b618c + 8476ae9 commit efc3a4a

4 files changed

Lines changed: 362 additions & 47 deletions

File tree

farmerapp/lib/pages/subpages/analytics.dart

Lines changed: 122 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -19,59 +19,133 @@ class _AnalyticsPageState extends State<AnalyticsPage> {
1919
@override
2020
Widget build(BuildContext context) {
2121
return Scaffold(
22-
body: Stack(
23-
children: <Widget>[
22+
body: Column(
23+
children: [
24+
const SizedBox(
25+
height: 20,
26+
),
27+
const Text(
28+
'Weekly Analytics',
29+
style: TextStyle(
30+
fontSize: 24,
31+
fontWeight: FontWeight.normal,
32+
),
33+
),
34+
const SizedBox(
35+
height: 10,
36+
),
2437
AspectRatio(
2538
aspectRatio: 1.70,
2639
child: Padding(
2740
padding: const EdgeInsets.only(
28-
right: 18,
29-
left: 12,
41+
right: 0,
42+
left: 0,
3043
top: 24,
3144
bottom: 12,
3245
),
3346
child: LineChart(
3447
showAvg ? avgData() : mainData(),
3548
),
3649
),
50+
// child: AnimatedPositionedDirectional(
51+
// duration: const Duration(milliseconds: 500),
52+
// curve: Curves.easeInOut,
53+
// child: LineChart(
54+
// showAvg ? avgData() : mainData(),
55+
// ),
56+
// ),
57+
),
58+
const SizedBox(
59+
height: 20,
60+
),
61+
const Text(
62+
'Todays Production:',
63+
textAlign: TextAlign.left,
64+
style: TextStyle(
65+
fontSize: 24,
66+
fontWeight: FontWeight.normal,
67+
),
68+
),
69+
const Text(
70+
'1.33k',
71+
textAlign: TextAlign.left,
72+
style: TextStyle(
73+
fontSize: 24,
74+
fontWeight: FontWeight.normal,
75+
color: Color.fromARGB(96, 0, 0, 0),
76+
),
77+
),
78+
const SizedBox(
79+
height: 20,
80+
),
81+
const Text(
82+
'Monthly Production:',
83+
textAlign: TextAlign.left,
84+
style: TextStyle(
85+
fontSize: 24,
86+
fontWeight: FontWeight.normal,
87+
),
88+
),
89+
const Text(
90+
'1.33k',
91+
textAlign: TextAlign.left,
92+
style: TextStyle(
93+
fontSize: 24,
94+
fontWeight: FontWeight.normal,
95+
color: Color.fromARGB(96, 0, 0, 0),
96+
),
3797
),
38-
// SizedBox(
39-
// width: 60,
40-
// height: 34,
41-
// child: TextButton(
42-
// onPressed: () {
43-
// setState(() {
44-
// showAvg = !showAvg;
45-
// });
46-
// },
47-
// child: Text(
48-
// 'avg',
49-
// style: TextStyle(
50-
// fontSize: 12,
51-
// color: showAvg ? Colors.white.withOpacity(0.5) : Colors.blue,
52-
// ),
53-
// ),
54-
// ),
55-
// ),
98+
const SizedBox(
99+
height: 20,
100+
),
101+
const Text(
102+
'Average Daily Production:',
103+
textAlign: TextAlign.left,
104+
style: TextStyle(
105+
fontSize: 24,
106+
fontWeight: FontWeight.normal,
107+
),
108+
),
109+
const Text(
110+
'28.33k',
111+
textAlign: TextAlign.left,
112+
style: TextStyle(
113+
fontSize: 24,
114+
fontWeight: FontWeight.normal,
115+
color: Color.fromARGB(96, 0, 0, 0),
116+
),
117+
)
56118
],
57119
));
58120
}
59121

60122
Widget bottomTitleWidgets(double value, TitleMeta meta) {
61123
const style = TextStyle(
62-
fontWeight: FontWeight.bold,
63-
fontSize: 16,
124+
// fontWeight: FontWeight.bold,
125+
fontSize: 13,
64126
);
65127
Widget text;
66128
switch (value.toInt()) {
129+
case 1:
130+
text = const Text('Mon', style: style);
131+
break;
67132
case 2:
68-
text = const Text('MAR', style: style);
133+
text = const Text('Tue', style: style);
134+
break;
135+
case 3:
136+
text = const Text('Wed', style: style);
137+
break;
138+
case 4:
139+
text = const Text('Thu', style: style);
69140
break;
70141
case 5:
71-
text = const Text('JUN', style: style);
142+
text = const Text('Fri', style: style);
143+
break;
144+
case 6:
145+
text = const Text('Sat', style: style);
72146
break;
73-
case 8:
74-
text = const Text('SEP', style: style);
147+
case 7:
148+
text = const Text('Sun', style: style);
75149
break;
76150
default:
77151
text = const Text('', style: style);
@@ -158,39 +232,42 @@ class _AnalyticsPageState extends State<AnalyticsPage> {
158232
border: Border.all(color: const Color(0xff37434d)),
159233
),
160234
minX: 0,
161-
maxX: 11,
235+
maxX: 8,
162236
minY: 0,
163237
maxY: 6,
164238
lineBarsData: [
165239
LineChartBarData(
166240
spots: const [
167-
FlSpot(0, 3),
168-
FlSpot(2.6, 2),
169-
FlSpot(4.9, 5),
170-
FlSpot(6.8, 3.1),
171-
FlSpot(8, 4),
172-
FlSpot(9.5, 3),
173-
FlSpot(11, 4),
241+
FlSpot(1, 2),
242+
FlSpot(2, 5),
243+
FlSpot(3, 3.1),
244+
FlSpot(4, 4),
245+
FlSpot(5, 3),
246+
FlSpot(6, 4),
247+
FlSpot(7, 3),
174248
],
175249
isCurved: true,
176250
gradient: LinearGradient(
177251
colors: gradientColors,
178252
),
179-
shadow: const Shadow(
180-
color: Color.fromARGB(183, 0, 0, 0),
181-
blurRadius: 8,
182-
),
253+
// shadow: const Shadow(
254+
// color: Color.fromARGB(183, 0, 0, 0),
255+
// blurRadius: 8,
256+
// ),
183257
barWidth: 5,
184258
isStrokeCapRound: true,
185259
dotData: const FlDotData(
186260
show: false,
187261
),
188262
belowBarData: BarAreaData(
189-
show: false, // change to true to show the area below the line
190-
gradient: LinearGradient(
191-
colors: gradientColors
192-
.map((color) => color.withOpacity(0.3))
193-
.toList(),
263+
show: true, // change to true to show the area below the line
264+
gradient: const LinearGradient(
265+
begin: Alignment.topCenter,
266+
end: Alignment.bottomCenter,
267+
// colors: gradientColors
268+
// .map((color) => color.withOpacity(0.3))
269+
// .toList(),
270+
colors: [Color(0xFF50E4FF), Color.fromARGB(0, 255, 255, 255)],
194271
),
195272
),
196273
),
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
import 'package:farmerapp/pages/subpages/articles.dart';
2+
import 'package:flutter/cupertino.dart';
3+
import 'package:flutter/material.dart';
4+
import 'package:get/get.dart';
5+
6+
class ArticlePage extends StatelessWidget {
7+
final ArticleItem article;
8+
final String tag;
9+
const ArticlePage({super.key, required this.article, required this.tag});
10+
11+
@override
12+
Widget build(BuildContext context) {
13+
return Container(
14+
child: Scaffold(
15+
backgroundColor: Colors.white,
16+
body: Stack(
17+
children: [
18+
SingleChildScrollView(
19+
child: Column(
20+
crossAxisAlignment: CrossAxisAlignment.start,
21+
children: [
22+
Hero(
23+
tag: this.tag,
24+
child: Image.network(article.imgUrl),
25+
),
26+
const SizedBox(
27+
height: 10,
28+
),
29+
Padding(
30+
padding: EdgeInsets.symmetric(horizontal: 8.0),
31+
child: Column(
32+
children: [
33+
Text(
34+
article.articleTitle,
35+
style: const TextStyle(
36+
fontSize: 22,
37+
fontWeight: FontWeight.w500,
38+
),
39+
),
40+
const SizedBox(
41+
height: 10,
42+
),
43+
Row(
44+
mainAxisAlignment: MainAxisAlignment.spaceBetween,
45+
children: [
46+
Column(
47+
children: [
48+
Icon(Icons.person),
49+
Text(
50+
article.author,
51+
style: const TextStyle(
52+
fontSize: 12,
53+
),
54+
),
55+
],
56+
),
57+
Column(
58+
children: [
59+
const Icon(Icons.calendar_today),
60+
Text(
61+
article.date,
62+
style: const TextStyle(
63+
fontSize: 12,
64+
),
65+
),
66+
],
67+
)
68+
],
69+
),
70+
const SizedBox(height: 20),
71+
Text(
72+
article.articleDescription,
73+
style: const TextStyle(fontSize: 18.0),
74+
)
75+
],
76+
),
77+
),
78+
],
79+
),
80+
),
81+
Padding(
82+
padding: EdgeInsets.only(top: 30),
83+
child: IconButton(
84+
onPressed: () {
85+
Navigator.pop(context);
86+
},
87+
icon: const Icon(
88+
Icons.arrow_back,
89+
color: Colors.black,
90+
),
91+
),
92+
),
93+
],
94+
),
95+
),
96+
);
97+
}
98+
}

0 commit comments

Comments
 (0)