Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
Navigation App
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
SWP Datenverwaltung Navigation 2023
Navigation App
Commits
fe1a4f91
Commit
fe1a4f91
authored
2 years ago
by
Filip Dalüge
Browse files
Options
Downloads
Patches
Plain Diff
Add loading indicator
parent
7f58a895
Branches
Branches containing commit
No related tags found
2 merge requests
!6
final project merge into main
,
!3
Usability improvements
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/main.dart
+14
-5
14 additions, 5 deletions
lib/main.dart
with
14 additions
and
5 deletions
lib/main.dart
+
14
−
5
View file @
fe1a4f91
...
@@ -8,6 +8,7 @@ import 'widgets/returnDestination.dart';
...
@@ -8,6 +8,7 @@ import 'widgets/returnDestination.dart';
import
'package:geocoding/geocoding.dart'
;
import
'package:geocoding/geocoding.dart'
;
import
'package:geolocator/geolocator.dart'
;
import
'package:geolocator/geolocator.dart'
;
import
'package:http/http.dart'
as
http
;
import
'package:http/http.dart'
as
http
;
import
'dart:async'
;
import
'dart:convert'
;
import
'dart:convert'
;
import
'package:weather_icons/weather_icons.dart'
;
import
'package:weather_icons/weather_icons.dart'
;
import
'config/config.dart'
;
import
'config/config.dart'
;
...
@@ -90,6 +91,7 @@ class _MyHomePageState extends State<MyHomePage> {
...
@@ -90,6 +91,7 @@ class _MyHomePageState extends State<MyHomePage> {
// Weather API
// Weather API
var
_forecastList
=
[];
var
_forecastList
=
[];
bool
_isCollapsed
=
false
;
bool
_isCollapsed
=
false
;
bool
_isLoading
=
false
;
// Format input text.
// Format input text.
String
getFormattedText
(
String
inputText
)
{
String
getFormattedText
(
String
inputText
)
{
...
@@ -164,9 +166,16 @@ class _MyHomePageState extends State<MyHomePage> {
...
@@ -164,9 +166,16 @@ class _MyHomePageState extends State<MyHomePage> {
// -----------Section For Map Operations, Coords, Polyline..----------------
// -----------Section For Map Operations, Coords, Polyline..----------------
// Get shortest path.
// Get shortest path.
void
_getShortestPath
()
async
{
void
_getShortestPath
()
async
{
_getWeather
();
_resetPolyline
();
_resetPolyline
();
_getDirections
();
_isLoading
=
true
;
await
Future
.
wait
<
void
>([
_getWeather
(),
_getDirections
(),
]);
_isLoading
=
false
;
}
}
// Add markers for origin/dest coords.
// Add markers for origin/dest coords.
...
@@ -222,7 +231,7 @@ class _MyHomePageState extends State<MyHomePage> {
...
@@ -222,7 +231,7 @@ class _MyHomePageState extends State<MyHomePage> {
}
}
// Get coords between origin/dest points corresponding to shortest path.
// Get coords between origin/dest points corresponding to shortest path.
void
_getDirections
()
async
{
Future
<
void
>
_getDirections
()
async
{
_resetPolyline
();
_resetPolyline
();
try
{
try
{
var
originlat
=
_originCoordinates
.
latitude
;
var
originlat
=
_originCoordinates
.
latitude
;
...
@@ -682,7 +691,7 @@ class _MyHomePageState extends State<MyHomePage> {
...
@@ -682,7 +691,7 @@ class _MyHomePageState extends State<MyHomePage> {
// ----------Section For Getting Weather Data------------
// ----------Section For Getting Weather Data------------
// Create weather query to the external weather API
// Create weather query to the external weather API
void
_getWeather
()
async
{
Future
<
void
>
_getWeather
()
async
{
_forecastList
=
[];
_forecastList
=
[];
setState
(()
{
setState
(()
{
_forecastList
;
_forecastList
;
...
@@ -1024,7 +1033,7 @@ class _MyHomePageState extends State<MyHomePage> {
...
@@ -1024,7 +1033,7 @@ class _MyHomePageState extends State<MyHomePage> {
itemBuilder:
(
BuildContext
context
,
int
index
)
{
itemBuilder:
(
BuildContext
context
,
int
index
)
{
return
Stack
(
return
Stack
(
children:
[
children:
[
Column
(
_isLoading
?
Center
(
child:
const
CircularProgressIndicator
())
:
Column
(
children:
[
children:
[
Container
(
Container
(
margin:
EdgeInsets
.
only
(
bottom:
15
,
top:
5
),
margin:
EdgeInsets
.
only
(
bottom:
15
,
top:
5
),
...
...
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