Toggle navigation
Toggle navigation
This project
Loading...
Sign in
flutter_package
/
modal_bottom_sheet
Go to a project
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
Jaime Blasco
2020-09-17 16:04:20 +0200
Browse Files
Options
Browse Files
Download
Plain Diff
Commit
e95e816bb54c5aaac1654278a15f01c2928f243e
e95e816b
2 parents
b772b47f
8db61767
Merge branch 'master' of
https://github.com/jamesblasco/modal_bottom_sheet
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
2 deletions
lib/src/bottom_sheet.dart
lib/src/bottom_sheet.dart
View file @
e95e816
...
...
@@ -3,7 +3,6 @@
// found in the LICENSE file.
import
'dart:async'
;
import
'package:flutter/cupertino.dart'
;
import
'package:flutter/foundation.dart'
;
import
'package:flutter/gestures.dart'
;
...
...
@@ -300,7 +299,8 @@ class _ModalBottomSheetState extends State<ModalBottomSheet>
// Otherwise the calculate the velocity with a VelocityTracker
if
(
_velocityTracker
==
null
)
{
_velocityTracker
=
VelocityTracker
();
final
pointerKind
=
defaultPointerDeviceKind
(
context
);
_velocityTracker
=
VelocityTracker
(
pointerKind
);
_startTime
=
DateTime
.
now
();
}
DragUpdateDetails
dragDetails
;
...
...
@@ -465,3 +465,23 @@ class _CustomBottomSheetLayout extends SingleChildLayoutDelegate {
return
false
;
}
}
// Checks the device input type as per the OS installed in it
// Mobile platforms will be default to `touch` while desktop will do to `mouse`
// Used with VelocityTracker
// https://github.com/flutter/flutter/pull/64267#issuecomment-694196304
PointerDeviceKind
defaultPointerDeviceKind
(
BuildContext
context
)
{
final
platform
=
Theme
.
of
(
context
)?.
platform
??
defaultTargetPlatform
;
switch
(
platform
)
{
case
TargetPlatform
.
iOS
:
case
TargetPlatform
.
android
:
return
PointerDeviceKind
.
touch
;
case
TargetPlatform
.
linux
:
case
TargetPlatform
.
macOS
:
case
TargetPlatform
.
windows
:
return
PointerDeviceKind
.
mouse
;
case
TargetPlatform
.
fuchsia
:
return
PointerDeviceKind
.
unknown
;
}
return
PointerDeviceKind
.
unknown
;
}
...
...
Please
register
or
login
to post a comment