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
6d135e45
Commit
6d135e45
authored
Feb 22, 2017
by
Chris Bracken
Committed by
GitHub
Feb 22, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Eliminate extraneous bool in DatePicker haptic feedback (#8337)
parent
c8f8d001
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
17 deletions
+14
-17
date_picker.dart
packages/flutter/lib/src/material/date_picker.dart
+14
-17
No files found.
packages/flutter/lib/src/material/date_picker.dart
View file @
6d135e45
...
...
@@ -591,8 +591,6 @@ class _DatePickerDialog extends StatefulWidget {
}
class
_DatePickerDialogState
extends
State
<
_DatePickerDialog
>
{
bool
_vibrate
=
false
;
@override
void
initState
()
{
super
.
initState
();
...
...
@@ -603,17 +601,26 @@ class _DatePickerDialogState extends State<_DatePickerDialog> {
_DatePickerMode
_mode
=
_DatePickerMode
.
day
;
GlobalKey
_pickerKey
=
new
GlobalKey
();
void
_vibrate
()
{
switch
(
Theme
.
of
(
context
).
platform
)
{
case
TargetPlatform
.
android
:
case
TargetPlatform
.
fuchsia
:
HapticFeedback
.
vibrate
();
break
;
case
TargetPlatform
.
iOS
:
break
;
}
}
void
_handleModeChanged
(
_DatePickerMode
mode
)
{
if
(
_vibrate
)
HapticFeedback
.
vibrate
();
_vibrate
();
setState
(()
{
_mode
=
mode
;
});
}
void
_handleYearChanged
(
DateTime
value
)
{
if
(
_vibrate
)
HapticFeedback
.
vibrate
();
_vibrate
();
setState
(()
{
_mode
=
_DatePickerMode
.
day
;
_selectedDate
=
value
;
...
...
@@ -621,8 +628,7 @@ class _DatePickerDialogState extends State<_DatePickerDialog> {
}
void
_handleDayChanged
(
DateTime
value
)
{
if
(
_vibrate
)
HapticFeedback
.
vibrate
();
_vibrate
();
setState
(()
{
_selectedDate
=
value
;
});
...
...
@@ -662,15 +668,6 @@ class _DatePickerDialogState extends State<_DatePickerDialog> {
@override
Widget
build
(
BuildContext
context
)
{
switch
(
Theme
.
of
(
context
).
platform
)
{
case
TargetPlatform
.
android
:
case
TargetPlatform
.
fuchsia
:
_vibrate
=
true
;
break
;
case
TargetPlatform
.
iOS
:
_vibrate
=
false
;
break
;
}
Widget
picker
=
new
Flexible
(
child:
new
SizedBox
(
height:
_kMaxDayPickerHeight
,
...
...
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