Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
4cd223a7
Commit
4cd223a7
authored
Aug 26, 2015
by
Collin Jackson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cancel timer when un-mounting date picker widget
parent
d547103f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
1 deletion
+12
-1
date_picker.dart
packages/flutter/lib/widgets/date_picker.dart
+12
-1
No files found.
packages/flutter/lib/widgets/date_picker.dart
View file @
4cd223a7
...
...
@@ -299,12 +299,16 @@ class MonthPicker extends ScrollableWidgetList {
}
DateTime
_currentDate
;
Timer
_timer
;
void
_updateCurrentDate
()
{
_currentDate
=
new
DateTime
.
now
();
DateTime
tomorrow
=
new
DateTime
(
_currentDate
.
year
,
_currentDate
.
month
,
_currentDate
.
day
+
1
);
Duration
timeUntilTomorrow
=
tomorrow
.
difference
(
_currentDate
);
timeUntilTomorrow
+=
const
Duration
(
seconds:
1
);
// so we don't miss it by rounding
new
Timer
(
timeUntilTomorrow
,
()
{
if
(
_timer
!=
null
)
_timer
.
cancel
();
_timer
=
new
Timer
(
timeUntilTomorrow
,
()
{
setState
(()
{
_updateCurrentDate
();
});
...
...
@@ -332,6 +336,13 @@ class MonthPicker extends ScrollableWidgetList {
}
return
result
;
}
void
didUnmount
()
{
super
.
didUnmount
();
if
(
_timer
!=
null
)
{
_timer
.
cancel
();
}
}
}
// Scrollable list of years to allow picking a year
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment