Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
PROG2900
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Sara Savanovic Djordjevic
PROG2900
Commits
6e8b8a9f
Commit
6e8b8a9f
authored
1 year ago
by
Sara Savanovic Djordjevic
Browse files
Options
Downloads
Patches
Plain Diff
update: move chart widgets to separate files
parent
9dd2a309
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
app/lib/pages/widgets/map_widget.dart
+2
-98
2 additions, 98 deletions
app/lib/pages/widgets/map_widget.dart
app/lib/pages/widgets/stat_charts.dart
+102
-0
102 additions, 0 deletions
app/lib/pages/widgets/stat_charts.dart
with
104 additions
and
98 deletions
app/lib/pages/widgets/map_widget.dart
+
2
−
98
View file @
6e8b8a9f
...
...
@@ -5,6 +5,7 @@ import 'package:flutter_map/flutter_map.dart';
import
'package:latlong2/latlong.dart'
;
import
'package:fl_chart/fl_chart.dart'
;
import
'quick_view_chart.dart'
;
import
'stat_charts.dart'
;
class
MapContainerWidget
extends
StatefulWidget
{
final
List
<
MarkerTemplate
>
markerList
;
...
...
@@ -148,104 +149,7 @@ class _MapContainerWidgetState extends State<MapContainerWidget> {
style:
regTextStyle
,
),
const
SizedBox
(
height:
contPadding
),
SizedBox
(
width:
screenWidth
*
boxWidth
-
contPadding
*
2
,
height:
200
,
child:
LineChart
(
LineChartData
(
backgroundColor:
lightBlue
,
titlesData:
FlTitlesData
(
leftTitles:
SideTitles
(
showTitles:
true
),
bottomTitles:
SideTitles
(
showTitles:
true
),
),
borderData:
FlBorderData
(
show:
true
,
),
minX:
0
,
maxX:
4
,
minY:
0
,
maxY:
50
,
lineBarsData:
[
LineChartBarData
(
spots:
chartData
,
isCurved:
true
,
colors:
[
barBlue
],
),
],
),
),
),
const
SizedBox
(
height:
contPadding
),
SizedBox
(
width:
screenWidth
*
boxWidth
-
contPadding
*
2
,
height:
160
,
child:
BarChart
(
BarChartData
(
alignment:
BarChartAlignment
.
spaceAround
,
maxY:
20
,
barTouchData:
BarTouchData
(
enabled:
false
),
titlesData:
FlTitlesData
(
bottomTitles:
SideTitles
(
showTitles:
true
,
getTextStyles:
(
value
)
=
>
chartTextStyle
,
margin:
10
,
getTitles:
(
value
)
{
switch
(
value
.
toInt
())
{
case
0
:
return
'Placeholder1'
;
case
1
:
return
'Placeholder2'
;
case
2
:
return
'Placeholder3'
;
default
:
return
''
;
}
},
),
leftTitles:
SideTitles
(
showTitles:
true
,
getTextStyles:
(
value
)
=
>
chartTextStyle
,
margin:
10
,
reservedSize:
30
,
interval:
5
,
),
),
borderData:
FlBorderData
(
show:
true
,
border:
Border
.
all
(
color:
Colors
.
white
,
width:
1
),
),
barGroups:
[
BarChartGroupData
(
x:
0
,
barRods:
[
BarChartRodData
(
y:
15
,
// Bar height
width:
barWidth
,
// Bar width
),
],
),
BarChartGroupData
(
x:
1
,
barRods:
[
BarChartRodData
(
y:
10
,
width:
barWidth
,
),
],
),
BarChartGroupData
(
x:
2
,
barRods:
[
BarChartRodData
(
y:
18
,
width:
barWidth
,
),
],
),
],
),
)
)
const
StatCharts
(),
],
),
),
...
...
This diff is collapsed.
Click to expand it.
app/lib/pages/widgets/stat_charts.dart
0 → 100644
+
102
−
0
View file @
6e8b8a9f
import
'package:flutter/material.dart'
;
import
'package:fl_chart/fl_chart.dart'
;
class
StatCharts
extends
StatelessWidget
{
const
StatCharts
({
Key
?
key
})
:
super
(
key:
key
);
@override
Widget
build
(
BuildContext
context
)
{
return
Column
(
children:
[
LineChart
(
LineChartData
(
backgroundColor:
Colors
.
lightBlue
,
titlesData:
FlTitlesData
(
leftTitles:
SideTitles
(
showTitles:
true
),
bottomTitles:
SideTitles
(
showTitles:
true
),
),
borderData:
FlBorderData
(
show:
true
),
minX:
0
,
maxX:
4
,
minY:
0
,
maxY:
50
,
lineBarsData:
[
LineChartBarData
(
spots:
[
FlSpot
(
0
,
10
),
FlSpot
(
1
,
20
),
FlSpot
(
2
,
30
),
FlSpot
(
3
,
40
),
],
isCurved:
true
,
colors:
[
Colors
.
blue
],
),
],
),
),
const
SizedBox
(
height:
20
),
// Add appropriate padding between charts
SizedBox
(
width:
MediaQuery
.
of
(
context
)
.
size
.
width
*
0.8
,
// Adjust width as needed
height:
160
,
// Adjust height as needed
child:
BarChart
(
BarChartData
(
alignment:
BarChartAlignment
.
spaceAround
,
maxY:
20
,
barTouchData:
BarTouchData
(
enabled:
false
),
titlesData:
FlTitlesData
(
bottomTitles:
SideTitles
(
showTitles:
true
,
getTextStyles:
(
value
)
=
>
const
TextStyle
(
color:
Colors
.
black
),
margin:
10
,
getTitles:
(
value
)
{
switch
(
value
.
toInt
())
{
case
0
:
return
'Placeholder1'
;
case
1
:
return
'Placeholder2'
;
case
2
:
return
'Placeholder3'
;
default
:
return
''
;
}
},
),
leftTitles:
SideTitles
(
showTitles:
true
,
getTextStyles:
(
value
)
=
>
const
TextStyle
(
color:
Colors
.
black
),
margin:
10
,
reservedSize:
30
,
interval:
5
,
),
),
borderData:
FlBorderData
(
show:
true
,
border:
Border
.
all
(
color:
Colors
.
white
,
width:
1
),
),
barGroups:
[
BarChartGroupData
(
x:
0
,
barRods:
[
BarChartRodData
(
y:
15
,
width:
10
),
// Example width
],
),
BarChartGroupData
(
x:
1
,
barRods:
[
BarChartRodData
(
y:
10
,
width:
10
),
// Example width
],
),
BarChartGroupData
(
x:
2
,
barRods:
[
BarChartRodData
(
y:
18
,
width:
10
),
// Example width
],
),
],
),
),
),
],
);
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment