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
99a1542f
Commit
99a1542f
authored
11 months ago
by
Sara Savanovic Djordjevic
Browse files
Options
Downloads
Patches
Plain Diff
update: export to share and download buttons
parent
4b6e0dbf
No related branches found
Branches containing commit
No related tags found
1 merge request
!20
Clhp map, fix unit tests
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
app/lib/utils/export_data.dart
+6
-3
6 additions, 3 deletions
app/lib/utils/export_data.dart
app/lib/widgets/main_layout.dart
+36
-16
36 additions, 16 deletions
app/lib/widgets/main_layout.dart
with
42 additions
and
19 deletions
app/lib/utils/export_data.dart
+
6
−
3
View file @
99a1542f
...
...
@@ -11,11 +11,14 @@ Future<void> _exportIceData() async {
final
directory
=
await
getExternalStorageDirectory
();
final
file
=
File
(
'
${directory?.path}
/ice_data_
$selectedLake
.json'
);
// Convert JSON data to string
final
jsonString
=
jsonEncode
(
selectedMeasurements
);
List
<
Map
<
String
,
dynamic
>>
measurementsJSON
=
[];
// Convert every measurement to JSON
for
(
var
element
in
selectedMeasurements
)
{
measurementsJSON
.
add
(
element
.
toJson
());
}
// Write JSON data to file
await
file
.
writeAsString
(
json
String
);
await
file
.
writeAsString
(
measurementsJSON
.
to
String
()
);
}
...
...
This diff is collapsed.
Click to expand it.
app/lib/widgets/main_layout.dart
+
36
−
16
View file @
99a1542f
...
...
@@ -198,21 +198,41 @@ class _MapContainerWidgetState extends State<MapContainerWidget> {
style:
const
TextStyle
(
fontSize:
20
),
),
const
SizedBox
(
height:
contPadding
),
ElevatedButton
(
style:
ButtonStyle
(
backgroundColor:
MaterialStateProperty
.
all
<
Color
>(
Colors
.
white24
),
),
child:
const
Text
(
"Export JSON"
),
onPressed:
()
{
// Export all measurements as JSON
List
<
Map
<
String
,
dynamic
>>
measurementsJSON
=
[];
// Convert every measurement to JSON
for
(
var
element
in
selectedMeasurements
)
{
measurementsJSON
.
add
(
element
.
toJson
());
}
// Export the processed data
Share
.
share
(
selectedMeasurements
.
toString
());
},
)
Column
(
children:
[
ElevatedButton
(
style:
ButtonStyle
(
backgroundColor:
MaterialStateProperty
.
all
<
Color
>(
Colors
.
white24
),
fixedSize:
MaterialStateProperty
.
all
<
Size
>(
const
Size
(
200.0
,
40.0
),
),
),
child:
const
Text
(
"Download as JSON"
),
onPressed:
()
{
// Download all measurements as JSON
showProgressIndicator
(
context
);
},
),
ElevatedButton
(
style:
ButtonStyle
(
backgroundColor:
MaterialStateProperty
.
all
<
Color
>(
Colors
.
white24
),
fixedSize:
MaterialStateProperty
.
all
<
Size
>(
const
Size
(
200.0
,
40.0
),
),
),
child:
const
Text
(
"Share as JSON"
),
onPressed:
()
{
// Export all measurements as JSON
List
<
Map
<
String
,
dynamic
>>
measurementsJSON
=
[];
// Convert every measurement to JSON
for
(
var
element
in
selectedMeasurements
)
{
measurementsJSON
.
add
(
element
.
toJson
());
}
// Export the processed data
Share
.
share
(
measurementsJSON
.
toString
());
},
),
],
),
],
),
),
...
...
@@ -276,7 +296,7 @@ class _MapContainerWidgetState extends State<MapContainerWidget> {
),
],
),
const SizedBox(height: contPadding), // Padding between containers
const SizedBox(height: contPadding
*1.7
), // Padding between containers
Column( // Ice stats container
crossAxisAlignment: CrossAxisAlignment.start,
children: [
...
...
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