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
c44603db
Commit
c44603db
authored
1 year ago
by
Sara Savanovic Djordjevic
Browse files
Options
Downloads
Patches
Plain Diff
update: tile selection in map widget, partial implementation
parent
47ba192c
No related branches found
Branches containing commit
No related tags found
1 merge request
!7
Clhp map
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
app/lib/pages/widgets/cloropleth_map.dart
+4
-2
4 additions, 2 deletions
app/lib/pages/widgets/cloropleth_map.dart
app/lib/pages/widgets/map_widget.dart
+13
-2
13 additions, 2 deletions
app/lib/pages/widgets/map_widget.dart
with
17 additions
and
4 deletions
app/lib/pages/widgets/cloropleth_map.dart
+
4
−
2
View file @
c44603db
...
...
@@ -21,11 +21,13 @@ class IceThicknessModel {
class
ChoroplethMap
extends
StatefulWidget
{
const
ChoroplethMap
({
Key
?
key
,
required
this
.
relation
,
required
this
.
measurements
required
this
.
measurements
,
required
this
.
onSelectionChanged
,
})
:
super
(
key:
key
);
final
Uint8List
relation
;
final
List
<
Measurement
>
measurements
;
final
void
Function
(
int
selectedIndex
)
onSelectionChanged
;
// Callback function
@override
_ChoroplethMapState
createState
()
=
>
_ChoroplethMapState
();
...
...
@@ -84,7 +86,7 @@ class _ChoroplethMapState extends State<ChoroplethMap> {
iceThicknessList
[
i
]
.
color
=
i
==
index
?
Colors
.
red
:
iceThicknessList
[
i
]
.
savedColor
;
}
});
print
(
"Selection triggered"
);
widget
.
onSelectionChanged
(
selectedIndex
);
},
selectionSettings:
MapSelectionSettings
(
color:
Colors
.
orange
,
...
...
This diff is collapsed.
Click to expand it.
app/lib/pages/widgets/map_widget.dart
+
13
−
2
View file @
c44603db
...
...
@@ -28,6 +28,7 @@ class MapContainerWidget extends StatefulWidget {
class
_MapContainerWidgetState
extends
State
<
MapContainerWidget
>
{
Measurement
?
selectedMarker
;
// Containing data for selected marker
int
selectedMarkerIndex
=
0
;
bool
isMinimized
=
true
;
// Quick view box state tacker
bool
satLayer
=
false
;
// Satellite layer visibility tracker
bool
isTapped
=
false
;
// Button tap state tracker
...
...
@@ -53,10 +54,17 @@ class _MapContainerWidgetState extends State<MapContainerWidget> {
}
}
// Tile selection handler
void
handleSelection
(
int
index
)
{
setState
(()
{
selectedMarkerIndex
=
index
;
});
}
@override
Widget
build
(
BuildContext
context
)
{
// Initialise selectedMarker to first element in markerList
selectedMarker
??=
widget
.
markerList
[
0
];
selectedMarker
??=
widget
.
markerList
[
selectedMarkerIndex
];
checkAndSetLastUpdate
();
...
...
@@ -154,7 +162,10 @@ class _MapContainerWidgetState extends State<MapContainerWidget> {
height: screenWidth * boxHeight,
child: Padding(
padding: const EdgeInsets.all(15.0), // Padding around map
child: ChoroplethMap(relation: widget.relation, measurements: widget.markerList,),
child: ChoroplethMap(
relation: widget.relation,
measurements: widget.markerList,
onSelectionChanged: handleSelection,),
),
),
Positioned( // Quick view box layered over map
...
...
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