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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SWP Datenverwaltung Navigation 2023
Navigation App
Commits
e13629cc
Commit
e13629cc
authored
Mar 30, 2023
by
alper-savas
Browse files
Options
Downloads
Patches
Plain Diff
Add date range info
parent
79ff9e29
No related branches found
No related tags found
1 merge request
!6
final project merge into main
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/main.dart
+295
-246
295 additions, 246 deletions
lib/main.dart
with
295 additions
and
246 deletions
lib/main.dart
+
295
−
246
View file @
e13629cc
...
...
@@ -74,6 +74,7 @@ class _MyHomePageState extends State<MyHomePage> {
// Set<Polyline> _polyline = {};
String
_totalDuration
=
''
;
String
_totalDistance
=
''
;
String
_totalDaysFormatted
=
''
;
// Variables for calendar and weather filter
DateTimeRange
_dateRange
=
DateTimeRange
(
...
...
@@ -230,12 +231,12 @@ class _MyHomePageState extends State<MyHomePage> {
var
coordinates
=
_data
[
'route'
];
int
duration
=
_data
[
'duration'
];
int
distance
=
_data
[
'distance'
];
//TODO include day
int
daysAfterToday
=
_data
[
'days_after_today'
];
// Format duration
and
distance
// Format duration
,
distance
and day
_totalDuration
=
getTotalDuration
(
duration
);
_totalDistance
=
getTotalDistance
(
distance
);
_totalDaysFormatted
=
getTotalDays
(
daysAfterToday
);
// Draw polyline
drawPolyline
(
coordinates
);
...
...
@@ -255,6 +256,7 @@ class _MyHomePageState extends State<MyHomePage> {
setState
(()
{
_totalDuration
;
_totalDistance
;
_totalDaysFormatted
;
_polyline
;
});
}
catch
(
e
)
{
...
...
@@ -285,6 +287,13 @@ class _MyHomePageState extends State<MyHomePage> {
return
'
$distanceInKm
km'
;
}
String
getTotalDays
(
int
daysAfterToday
)
{
String
currentDate
=
convertDateFormat
(
DateTime
.
now
());
String
lastDate
=
convertDateFormat
(
DateTime
.
now
()
.
add
(
Duration
(
days:
daysAfterToday
)));
return
"
$currentDate
-
$lastDate
"
;
}
List
<
String
>
getForbidden
()
{
List
<
String
>
forbidden
=
[];
for
(
var
option
in
_selectedOptions
)
{
...
...
@@ -996,8 +1005,8 @@ class _MyHomePageState extends State<MyHomePage> {
color:
Color
.
fromRGBO
(
53
,
56
,
63
,
1
),
borderRadius:
BorderRadius
.
all
(
Radius
.
circular
(
25
))),
padding:
EdgeInsets
.
only
(
bottom:
15
,
top:
15
,
left:
20
),
padding:
EdgeInsets
.
only
(
bottom:
15
,
top:
15
,
left:
20
),
child:
Row
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
...
...
@@ -1047,7 +1056,8 @@ class _MyHomePageState extends State<MyHomePage> {
padding:
EdgeInsets
.
only
(
right:
8
),
child:
Icon
(
WeatherIcons
.
cloudy
,
color:
Theme
.
of
(
context
)
.
accentColor
,
color:
Theme
.
of
(
context
)
.
accentColor
,
size:
18
,
),
),
...
...
@@ -1057,8 +1067,8 @@ class _MyHomePageState extends State<MyHomePage> {
letterSpacing:
0.6
,
fontSize:
21
,
fontWeight:
FontWeight
.
w500
,
color:
Theme
.
of
(
context
)
.
accentColor
),
color:
Theme
.
of
(
context
)
.
accentColor
),
),
],
),
...
...
@@ -1101,7 +1111,8 @@ class _MyHomePageState extends State<MyHomePage> {
shape:
MaterialStateProperty
.
all
<
RoundedRectangleBorder
>(
RoundedRectangleBorder
(
borderRadius:
BorderRadius
.
circular
(
20
),
borderRadius:
BorderRadius
.
circular
(
20
),
),
),
),
...
...
@@ -1129,7 +1140,8 @@ class _MyHomePageState extends State<MyHomePage> {
EdgeInsets
.
only
(
right:
5
,
top:
2
),
child:
Icon
(
Icons
.
access_time_filled_outlined
,
color:
Theme
.
of
(
context
)
.
accentColor
,
color:
Theme
.
of
(
context
)
.
accentColor
,
size:
20
,
),
),
...
...
@@ -1139,16 +1151,16 @@ class _MyHomePageState extends State<MyHomePage> {
letterSpacing:
0.6
,
fontSize:
21
,
fontWeight:
FontWeight
.
w500
,
color:
Theme
.
of
(
context
)
.
accentColor
),
color:
Theme
.
of
(
context
)
.
accentColor
),
),
Text
(
_totalDuration
,
style:
TextStyle
(
fontSize:
20
,
fontWeight:
FontWeight
.
w400
,
color:
Theme
.
of
(
context
)
.
accentColor
),
color:
Theme
.
of
(
context
)
.
accentColor
),
),
],
),
...
...
@@ -1164,7 +1176,8 @@ class _MyHomePageState extends State<MyHomePage> {
EdgeInsets
.
only
(
right:
5
,
top:
2
),
child:
Icon
(
Icons
.
directions_car_rounded
,
color:
Theme
.
of
(
context
)
.
accentColor
,
color:
Theme
.
of
(
context
)
.
accentColor
,
size:
20
,
),
),
...
...
@@ -1174,19 +1187,55 @@ class _MyHomePageState extends State<MyHomePage> {
letterSpacing:
0.6
,
fontSize:
21
,
fontWeight:
FontWeight
.
w500
,
color:
Theme
.
of
(
context
)
.
accentColor
),
color:
Theme
.
of
(
context
)
.
accentColor
),
),
Text
(
_totalDistance
,
style:
TextStyle
(
fontSize:
20
,
fontWeight:
FontWeight
.
w400
,
color:
Theme
.
of
(
context
)
.
accentColor
),
),
],
),
SizedBox
(
height:
15
,
),
Row
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
Container
(
padding:
EdgeInsets
.
only
(
right:
5
,
top:
2
),
child:
Icon
(
Icons
.
date_range
,
color:
Theme
.
of
(
context
)
.
accentColor
),
Theme
.
of
(
context
)
.
accentColor
,
size:
20
,
),
),
Text
(
'Date Range: '
,
style:
TextStyle
(
letterSpacing:
0.6
,
fontSize:
21
,
fontWeight:
FontWeight
.
w500
,
color:
Theme
.
of
(
context
)
.
accentColor
),
),
Text
(
_totalDaysFormatted
,
style:
TextStyle
(
fontSize:
20
,
fontWeight:
FontWeight
.
w400
,
color:
Theme
.
of
(
context
)
.
accentColor
),
),
],
)
),
],
),
),
...
...
@@ -1222,8 +1271,8 @@ class _MyHomePageState extends State<MyHomePage> {
letterSpacing:
0.6
,
fontSize:
21
,
fontWeight:
FontWeight
.
w500
,
color:
Theme
.
of
(
context
)
.
accentColor
),
color:
Theme
.
of
(
context
)
.
accentColor
),
),
),
]),
...
...
@@ -1242,8 +1291,8 @@ class _MyHomePageState extends State<MyHomePage> {
right:
6
,
left:
12
),
child:
Icon
(
Icons
.
check_rounded
,
color:
Theme
.
of
(
context
)
.
accentColor
,
color:
Theme
.
of
(
context
)
.
accentColor
,
size:
20
,
),
),
...
...
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