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
322eb81a
Unverified
Commit
322eb81a
authored
May 03, 2018
by
Chris Bracken
Committed by
GitHub
May 03, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert longPress/Tap and Gallery changes (#17269)
Revert longPress/Tap and Gallery changes
parent
40ddf010
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
92 additions
and
383 deletions
+92
-383
demos.dart
examples/flutter_gallery/lib/gallery/demos.dart
+71
-63
home.dart
examples/flutter_gallery/lib/gallery/home.dart
+13
-20
transitions_perf_test.dart
...es/flutter_gallery/test_driver/transitions_perf_test.dart
+6
-6
feedback.dart
packages/flutter/lib/src/material/feedback.dart
+0
-4
toggleable.dart
packages/flutter/lib/src/material/toggleable.dart
+0
-1
object.dart
packages/flutter/lib/src/rendering/object.dart
+0
-19
semantics_event.dart
packages/flutter/lib/src/semantics/semantics_event.dart
+1
-27
semantics_service.dart
packages/flutter/lib/src/semantics/semantics_service.dart
+1
-2
checkbox_test.dart
packages/flutter/test/material/checkbox_test.dart
+0
-41
feedback_test.dart
packages/flutter/test/material/feedback_test.dart
+0
-69
radio_test.dart
packages/flutter/test/material/radio_test.dart
+0
-36
switch_test.dart
packages/flutter/test/material/switch_test.dart
+0
-46
tooltip_test.dart
packages/flutter/test/material/tooltip_test.dart
+0
-49
No files found.
examples/flutter_gallery/lib/gallery/demos.dart
View file @
322eb81a
...
@@ -153,41 +153,17 @@ List<GalleryDemo> _buildGalleryDemos() {
...
@@ -153,41 +153,17 @@ List<GalleryDemo> _buildGalleryDemos() {
routeName:
BottomNavigationDemo
.
routeName
,
routeName:
BottomNavigationDemo
.
routeName
,
buildRoute:
(
BuildContext
context
)
=>
new
BottomNavigationDemo
(),
buildRoute:
(
BuildContext
context
)
=>
new
BottomNavigationDemo
(),
),
),
new
GalleryDemo
(
title:
'Bottom sheet: Modal'
,
subtitle:
'A dismissable bottom sheet'
,
icon:
GalleryIcons
.
bottom_sheets
,
category:
_kMaterialComponents
,
routeName:
ModalBottomSheetDemo
.
routeName
,
buildRoute:
(
BuildContext
context
)
=>
new
ModalBottomSheetDemo
(),
),
new
GalleryDemo
(
title:
'Bottom sheet: Persistent'
,
subtitle:
'A bottom sheet that sticks around'
,
icon:
GalleryIcons
.
bottom_sheet_persistent
,
category:
_kMaterialComponents
,
routeName:
PersistentBottomSheetDemo
.
routeName
,
buildRoute:
(
BuildContext
context
)
=>
new
PersistentBottomSheetDemo
(),
),
new
GalleryDemo
(
new
GalleryDemo
(
title:
'Buttons'
,
title:
'Buttons'
,
subtitle:
'
Flat, raised, dropdown, and more
'
,
subtitle:
'
All kinds: flat, raised, dropdown, icon, etc
'
,
icon:
GalleryIcons
.
generic_buttons
,
icon:
GalleryIcons
.
generic_buttons
,
category:
_kMaterialComponents
,
category:
_kMaterialComponents
,
routeName:
ButtonsDemo
.
routeName
,
routeName:
ButtonsDemo
.
routeName
,
buildRoute:
(
BuildContext
context
)
=>
new
ButtonsDemo
(),
buildRoute:
(
BuildContext
context
)
=>
new
ButtonsDemo
(),
),
),
new
GalleryDemo
(
title:
'Buttons: Floating Action Button'
,
subtitle:
'FAB with transitions'
,
icon:
GalleryIcons
.
buttons
,
category:
_kMaterialComponents
,
routeName:
TabsFabDemo
.
routeName
,
buildRoute:
(
BuildContext
context
)
=>
new
TabsFabDemo
(),
),
new
GalleryDemo
(
new
GalleryDemo
(
title:
'Cards'
,
title:
'Cards'
,
subtitle:
'
Baseline cards with rounded corners
'
,
subtitle:
'
Material with rounded corners and a drop shadow
'
,
icon:
GalleryIcons
.
cards
,
icon:
GalleryIcons
.
cards
,
category:
_kMaterialComponents
,
category:
_kMaterialComponents
,
routeName:
CardsDemo
.
routeName
,
routeName:
CardsDemo
.
routeName
,
...
@@ -195,7 +171,7 @@ List<GalleryDemo> _buildGalleryDemos() {
...
@@ -195,7 +171,7 @@ List<GalleryDemo> _buildGalleryDemos() {
),
),
new
GalleryDemo
(
new
GalleryDemo
(
title:
'Chips'
,
title:
'Chips'
,
subtitle:
'Label
ed with delete buttons and avatars
'
,
subtitle:
'Label
with an optional delete button and avatar
'
,
icon:
GalleryIcons
.
chips
,
icon:
GalleryIcons
.
chips
,
category:
_kMaterialComponents
,
category:
_kMaterialComponents
,
routeName:
ChipDemo
.
routeName
,
routeName:
ChipDemo
.
routeName
,
...
@@ -210,16 +186,32 @@ List<GalleryDemo> _buildGalleryDemos() {
...
@@ -210,16 +186,32 @@ List<GalleryDemo> _buildGalleryDemos() {
buildRoute:
(
BuildContext
context
)
=>
new
DataTableDemo
(),
buildRoute:
(
BuildContext
context
)
=>
new
DataTableDemo
(),
),
),
new
GalleryDemo
(
new
GalleryDemo
(
title:
'Dialogs'
,
title:
'Date and time pickers'
,
subtitle:
'Simple, alert, and fullscreen'
,
subtitle:
'Date and time selection widgets'
,
icon:
GalleryIcons
.
event
,
category:
_kMaterialComponents
,
routeName:
DateAndTimePickerDemo
.
routeName
,
buildRoute:
(
BuildContext
context
)
=>
new
DateAndTimePickerDemo
(),
),
new
GalleryDemo
(
title:
'Dialog'
,
subtitle:
'All kinds: simple, alert, fullscreen, etc'
,
icon:
GalleryIcons
.
dialogs
,
icon:
GalleryIcons
.
dialogs
,
category:
_kMaterialComponents
,
category:
_kMaterialComponents
,
routeName:
DialogDemo
.
routeName
,
routeName:
DialogDemo
.
routeName
,
buildRoute:
(
BuildContext
context
)
=>
new
DialogDemo
(),
buildRoute:
(
BuildContext
context
)
=>
new
DialogDemo
(),
),
),
new
GalleryDemo
(
title:
'Drawer'
,
subtitle:
'Navigation drawer with a standard header'
,
icon:
GalleryIcons
.
menu
,
category:
_kMaterialComponents
,
routeName:
DrawerDemo
.
routeName
,
buildRoute:
(
BuildContext
context
)
=>
new
DrawerDemo
(),
),
new
GalleryDemo
(
new
GalleryDemo
(
title:
'Expand/collapse list control'
,
title:
'Expand/collapse list control'
,
subtitle:
'
A list with one sub-list level
'
,
subtitle:
'
List with one level of sublists
'
,
icon:
GalleryIcons
.
expand_all
,
icon:
GalleryIcons
.
expand_all
,
category:
_kMaterialComponents
,
category:
_kMaterialComponents
,
routeName:
TwoLevelListDemo
.
routeName
,
routeName:
TwoLevelListDemo
.
routeName
,
...
@@ -233,6 +225,14 @@ List<GalleryDemo> _buildGalleryDemos() {
...
@@ -233,6 +225,14 @@ List<GalleryDemo> _buildGalleryDemos() {
routeName:
ExpansionPanelsDemo
.
routeName
,
routeName:
ExpansionPanelsDemo
.
routeName
,
buildRoute:
(
BuildContext
context
)
=>
new
ExpansionPanelsDemo
(),
buildRoute:
(
BuildContext
context
)
=>
new
ExpansionPanelsDemo
(),
),
),
new
GalleryDemo
(
title:
'Floating action button'
,
subtitle:
'Action buttons with transitions'
,
icon:
GalleryIcons
.
buttons
,
category:
_kMaterialComponents
,
routeName:
TabsFabDemo
.
routeName
,
buildRoute:
(
BuildContext
context
)
=>
new
TabsFabDemo
(),
),
new
GalleryDemo
(
new
GalleryDemo
(
title:
'Grid'
,
title:
'Grid'
,
subtitle:
'Row and column layout'
,
subtitle:
'Row and column layout'
,
...
@@ -243,28 +243,28 @@ List<GalleryDemo> _buildGalleryDemos() {
...
@@ -243,28 +243,28 @@ List<GalleryDemo> _buildGalleryDemos() {
),
),
new
GalleryDemo
(
new
GalleryDemo
(
title:
'Icons'
,
title:
'Icons'
,
subtitle:
'Enabled and disabled icons with opacity'
,
subtitle:
'Enabled and disabled icons with
varying
opacity'
,
icon:
GalleryIcons
.
sentiment_very_satisfied
,
icon:
GalleryIcons
.
sentiment_very_satisfied
,
category:
_kMaterialComponents
,
category:
_kMaterialComponents
,
routeName:
IconsDemo
.
routeName
,
routeName:
IconsDemo
.
routeName
,
buildRoute:
(
BuildContext
context
)
=>
new
IconsDemo
(),
buildRoute:
(
BuildContext
context
)
=>
new
IconsDemo
(),
),
),
new
GalleryDemo
(
new
GalleryDemo
(
title:
'Lists'
,
title:
'Leave-behind list items'
,
subtitle:
'Scrolling list layouts'
,
icon:
GalleryIcons
.
list_alt
,
category:
_kMaterialComponents
,
routeName:
ListDemo
.
routeName
,
buildRoute:
(
BuildContext
context
)
=>
const
ListDemo
(),
),
new
GalleryDemo
(
title:
'Lists: leave-behind list items'
,
subtitle:
'List items with hidden actions'
,
subtitle:
'List items with hidden actions'
,
icon:
GalleryIcons
.
lists_leave_behind
,
icon:
GalleryIcons
.
lists_leave_behind
,
category:
_kMaterialComponents
,
category:
_kMaterialComponents
,
routeName:
LeaveBehindDemo
.
routeName
,
routeName:
LeaveBehindDemo
.
routeName
,
buildRoute:
(
BuildContext
context
)
=>
const
LeaveBehindDemo
(),
buildRoute:
(
BuildContext
context
)
=>
const
LeaveBehindDemo
(),
),
),
new
GalleryDemo
(
title:
'List'
,
subtitle:
'Layout variations for scrollable lists'
,
icon:
GalleryIcons
.
list_alt
,
category:
_kMaterialComponents
,
routeName:
ListDemo
.
routeName
,
buildRoute:
(
BuildContext
context
)
=>
const
ListDemo
(),
),
new
GalleryDemo
(
new
GalleryDemo
(
title:
'Menus'
,
title:
'Menus'
,
subtitle:
'Menu buttons and simple menus'
,
subtitle:
'Menu buttons and simple menus'
,
...
@@ -274,15 +274,15 @@ List<GalleryDemo> _buildGalleryDemos() {
...
@@ -274,15 +274,15 @@ List<GalleryDemo> _buildGalleryDemos() {
buildRoute:
(
BuildContext
context
)
=>
const
MenuDemo
(),
buildRoute:
(
BuildContext
context
)
=>
const
MenuDemo
(),
),
),
new
GalleryDemo
(
new
GalleryDemo
(
title:
'
Navigation drawer
'
,
title:
'
Modal bottom sheet
'
,
subtitle:
'
Navigation drawer with standard header
'
,
subtitle:
'
Modal sheet that slides up from the bottom
'
,
icon:
GalleryIcons
.
menu
,
icon:
GalleryIcons
.
bottom_sheets
,
category:
_kMaterialComponents
,
category:
_kMaterialComponents
,
routeName:
Drawer
Demo
.
routeName
,
routeName:
ModalBottomSheet
Demo
.
routeName
,
buildRoute:
(
BuildContext
context
)
=>
new
Drawer
Demo
(),
buildRoute:
(
BuildContext
context
)
=>
new
ModalBottomSheet
Demo
(),
),
),
new
GalleryDemo
(
new
GalleryDemo
(
title:
'Pag
ination
'
,
title:
'Pag
e selector
'
,
subtitle:
'PageView with indicator'
,
subtitle:
'PageView with indicator'
,
icon:
GalleryIcons
.
page_control
,
icon:
GalleryIcons
.
page_control
,
category:
_kMaterialComponents
,
category:
_kMaterialComponents
,
...
@@ -290,16 +290,16 @@ List<GalleryDemo> _buildGalleryDemos() {
...
@@ -290,16 +290,16 @@ List<GalleryDemo> _buildGalleryDemos() {
buildRoute:
(
BuildContext
context
)
=>
new
PageSelectorDemo
(),
buildRoute:
(
BuildContext
context
)
=>
new
PageSelectorDemo
(),
),
),
new
GalleryDemo
(
new
GalleryDemo
(
title:
'P
ickers
'
,
title:
'P
ersistent bottom sheet
'
,
subtitle:
'
Date and time selection widgets
'
,
subtitle:
'
Sheet that slides up from the bottom
'
,
icon:
GalleryIcons
.
ev
ent
,
icon:
GalleryIcons
.
bottom_sheet_persist
ent
,
category:
_kMaterialComponents
,
category:
_kMaterialComponents
,
routeName:
DateAndTimePicker
Demo
.
routeName
,
routeName:
PersistentBottomSheet
Demo
.
routeName
,
buildRoute:
(
BuildContext
context
)
=>
new
DateAndTimePicker
Demo
(),
buildRoute:
(
BuildContext
context
)
=>
new
PersistentBottomSheet
Demo
(),
),
),
new
GalleryDemo
(
new
GalleryDemo
(
title:
'Progress indicators'
,
title:
'Progress indicators'
,
subtitle:
'
Linear, circular, indeterminate
'
,
subtitle:
'
All kinds: linear, circular, indeterminate, etc
'
,
icon:
GalleryIcons
.
progress_activity
,
icon:
GalleryIcons
.
progress_activity
,
category:
_kMaterialComponents
,
category:
_kMaterialComponents
,
routeName:
ProgressIndicatorDemo
.
routeName
,
routeName:
ProgressIndicatorDemo
.
routeName
,
...
@@ -313,6 +313,14 @@ List<GalleryDemo> _buildGalleryDemos() {
...
@@ -313,6 +313,14 @@ List<GalleryDemo> _buildGalleryDemos() {
routeName:
OverscrollDemo
.
routeName
,
routeName:
OverscrollDemo
.
routeName
,
buildRoute:
(
BuildContext
context
)
=>
const
OverscrollDemo
(),
buildRoute:
(
BuildContext
context
)
=>
const
OverscrollDemo
(),
),
),
new
GalleryDemo
(
title:
'Scrollable tabs'
,
subtitle:
'Tab bar that scrolls'
,
category:
_kMaterialComponents
,
icon:
GalleryIcons
.
tabs
,
routeName:
ScrollableTabsDemo
.
routeName
,
buildRoute:
(
BuildContext
context
)
=>
new
ScrollableTabsDemo
(),
),
new
GalleryDemo
(
new
GalleryDemo
(
title:
'Selection controls'
,
title:
'Selection controls'
,
subtitle:
'Checkboxes, radio buttons, and switches'
,
subtitle:
'Checkboxes, radio buttons, and switches'
,
...
@@ -323,7 +331,7 @@ List<GalleryDemo> _buildGalleryDemos() {
...
@@ -323,7 +331,7 @@ List<GalleryDemo> _buildGalleryDemos() {
),
),
new
GalleryDemo
(
new
GalleryDemo
(
title:
'Sliders'
,
title:
'Sliders'
,
subtitle:
'Widgets
for selecting a value by swiping
'
,
subtitle:
'Widgets
that select a value by dragging the slider thumb
'
,
icon:
GalleryIcons
.
sliders
,
icon:
GalleryIcons
.
sliders
,
category:
_kMaterialComponents
,
category:
_kMaterialComponents
,
routeName:
SliderDemo
.
routeName
,
routeName:
SliderDemo
.
routeName
,
...
@@ -331,7 +339,7 @@ List<GalleryDemo> _buildGalleryDemos() {
...
@@ -331,7 +339,7 @@ List<GalleryDemo> _buildGalleryDemos() {
),
),
new
GalleryDemo
(
new
GalleryDemo
(
title:
'Snackbar'
,
title:
'Snackbar'
,
subtitle:
'Temporary messag
ing
'
,
subtitle:
'Temporary messag
e that appears at the bottom
'
,
icon:
GalleryIcons
.
snackbar
,
icon:
GalleryIcons
.
snackbar
,
category:
_kMaterialComponents
,
category:
_kMaterialComponents
,
routeName:
SnackBarDemo
.
routeName
,
routeName:
SnackBarDemo
.
routeName
,
...
@@ -345,14 +353,6 @@ List<GalleryDemo> _buildGalleryDemos() {
...
@@ -345,14 +353,6 @@ List<GalleryDemo> _buildGalleryDemos() {
routeName:
TabsDemo
.
routeName
,
routeName:
TabsDemo
.
routeName
,
buildRoute:
(
BuildContext
context
)
=>
new
TabsDemo
(),
buildRoute:
(
BuildContext
context
)
=>
new
TabsDemo
(),
),
),
new
GalleryDemo
(
title:
'Tabs: Scrolling'
,
subtitle:
'Tab bar that scrolls'
,
category:
_kMaterialComponents
,
icon:
GalleryIcons
.
tabs
,
routeName:
ScrollableTabsDemo
.
routeName
,
buildRoute:
(
BuildContext
context
)
=>
new
ScrollableTabsDemo
(),
),
new
GalleryDemo
(
new
GalleryDemo
(
title:
'Text fields'
,
title:
'Text fields'
,
subtitle:
'Single line of editable text and numbers'
,
subtitle:
'Single line of editable text and numbers'
,
...
@@ -363,7 +363,7 @@ List<GalleryDemo> _buildGalleryDemos() {
...
@@ -363,7 +363,7 @@ List<GalleryDemo> _buildGalleryDemos() {
),
),
new
GalleryDemo
(
new
GalleryDemo
(
title:
'Tooltips'
,
title:
'Tooltips'
,
subtitle:
'Short message displayed
on
long-press'
,
subtitle:
'Short message displayed
after a
long-press'
,
icon:
GalleryIcons
.
tooltip
,
icon:
GalleryIcons
.
tooltip
,
category:
_kMaterialComponents
,
category:
_kMaterialComponents
,
routeName:
TooltipDemo
.
routeName
,
routeName:
TooltipDemo
.
routeName
,
...
@@ -373,6 +373,7 @@ List<GalleryDemo> _buildGalleryDemos() {
...
@@ -373,6 +373,7 @@ List<GalleryDemo> _buildGalleryDemos() {
// Cupertino Components
// Cupertino Components
new
GalleryDemo
(
new
GalleryDemo
(
title:
'Activity Indicator'
,
title:
'Activity Indicator'
,
subtitle:
'Cupertino styled activity indicator'
,
icon:
GalleryIcons
.
cupertino_progress
,
icon:
GalleryIcons
.
cupertino_progress
,
category:
_kCupertinoComponents
,
category:
_kCupertinoComponents
,
routeName:
CupertinoProgressIndicatorDemo
.
routeName
,
routeName:
CupertinoProgressIndicatorDemo
.
routeName
,
...
@@ -380,6 +381,7 @@ List<GalleryDemo> _buildGalleryDemos() {
...
@@ -380,6 +381,7 @@ List<GalleryDemo> _buildGalleryDemos() {
),
),
new
GalleryDemo
(
new
GalleryDemo
(
title:
'Buttons'
,
title:
'Buttons'
,
subtitle:
'Cupertino styled buttons'
,
icon:
GalleryIcons
.
generic_buttons
,
icon:
GalleryIcons
.
generic_buttons
,
category:
_kCupertinoComponents
,
category:
_kCupertinoComponents
,
routeName:
CupertinoButtonsDemo
.
routeName
,
routeName:
CupertinoButtonsDemo
.
routeName
,
...
@@ -387,6 +389,7 @@ List<GalleryDemo> _buildGalleryDemos() {
...
@@ -387,6 +389,7 @@ List<GalleryDemo> _buildGalleryDemos() {
),
),
new
GalleryDemo
(
new
GalleryDemo
(
title:
'Dialogs'
,
title:
'Dialogs'
,
subtitle:
'Cupertino styled dialogs'
,
icon:
GalleryIcons
.
dialogs
,
icon:
GalleryIcons
.
dialogs
,
category:
_kCupertinoComponents
,
category:
_kCupertinoComponents
,
routeName:
CupertinoDialogDemo
.
routeName
,
routeName:
CupertinoDialogDemo
.
routeName
,
...
@@ -394,6 +397,7 @@ List<GalleryDemo> _buildGalleryDemos() {
...
@@ -394,6 +397,7 @@ List<GalleryDemo> _buildGalleryDemos() {
),
),
new
GalleryDemo
(
new
GalleryDemo
(
title:
'Navigation'
,
title:
'Navigation'
,
subtitle:
'Cupertino styled navigation patterns'
,
icon:
GalleryIcons
.
bottom_navigation
,
icon:
GalleryIcons
.
bottom_navigation
,
category:
_kCupertinoComponents
,
category:
_kCupertinoComponents
,
routeName:
CupertinoNavigationDemo
.
routeName
,
routeName:
CupertinoNavigationDemo
.
routeName
,
...
@@ -401,6 +405,7 @@ List<GalleryDemo> _buildGalleryDemos() {
...
@@ -401,6 +405,7 @@ List<GalleryDemo> _buildGalleryDemos() {
),
),
new
GalleryDemo
(
new
GalleryDemo
(
title:
'Pickers'
,
title:
'Pickers'
,
subtitle:
'Cupertino styled pickers'
,
icon:
GalleryIcons
.
event
,
icon:
GalleryIcons
.
event
,
category:
_kCupertinoComponents
,
category:
_kCupertinoComponents
,
routeName:
CupertinoPickerDemo
.
routeName
,
routeName:
CupertinoPickerDemo
.
routeName
,
...
@@ -408,6 +413,7 @@ List<GalleryDemo> _buildGalleryDemos() {
...
@@ -408,6 +413,7 @@ List<GalleryDemo> _buildGalleryDemos() {
),
),
new
GalleryDemo
(
new
GalleryDemo
(
title:
'Pull to refresh'
,
title:
'Pull to refresh'
,
subtitle:
'Cupertino styled refresh controls'
,
icon:
GalleryIcons
.
cupertino_pull_to_refresh
,
icon:
GalleryIcons
.
cupertino_pull_to_refresh
,
category:
_kCupertinoComponents
,
category:
_kCupertinoComponents
,
routeName:
CupertinoRefreshControlDemo
.
routeName
,
routeName:
CupertinoRefreshControlDemo
.
routeName
,
...
@@ -415,6 +421,7 @@ List<GalleryDemo> _buildGalleryDemos() {
...
@@ -415,6 +421,7 @@ List<GalleryDemo> _buildGalleryDemos() {
),
),
new
GalleryDemo
(
new
GalleryDemo
(
title:
'Sliders'
,
title:
'Sliders'
,
subtitle:
'Cupertino styled sliders'
,
icon:
GalleryIcons
.
sliders
,
icon:
GalleryIcons
.
sliders
,
category:
_kCupertinoComponents
,
category:
_kCupertinoComponents
,
routeName:
CupertinoSliderDemo
.
routeName
,
routeName:
CupertinoSliderDemo
.
routeName
,
...
@@ -422,6 +429,7 @@ List<GalleryDemo> _buildGalleryDemos() {
...
@@ -422,6 +429,7 @@ List<GalleryDemo> _buildGalleryDemos() {
),
),
new
GalleryDemo
(
new
GalleryDemo
(
title:
'Switches'
,
title:
'Switches'
,
subtitle:
'Cupertino styled switches'
,
icon:
GalleryIcons
.
cupertino_switch
,
icon:
GalleryIcons
.
cupertino_switch
,
category:
_kCupertinoComponents
,
category:
_kCupertinoComponents
,
routeName:
CupertinoSwitchDemo
.
routeName
,
routeName:
CupertinoSwitchDemo
.
routeName
,
...
...
examples/flutter_gallery/lib/gallery/home.dart
View file @
322eb81a
...
@@ -177,25 +177,6 @@ class _DemoItem extends StatelessWidget {
...
@@ -177,25 +177,6 @@ class _DemoItem extends StatelessWidget {
final
bool
isDark
=
theme
.
brightness
==
Brightness
.
dark
;
final
bool
isDark
=
theme
.
brightness
==
Brightness
.
dark
;
final
double
textScaleFactor
=
MediaQuery
.
of
(
context
)?.
textScaleFactor
??
1.0
;
final
double
textScaleFactor
=
MediaQuery
.
of
(
context
)?.
textScaleFactor
??
1.0
;
final
List
<
Widget
>
titleChildren
=
<
Widget
>[
new
Text
(
demo
.
title
,
style:
theme
.
textTheme
.
subhead
.
copyWith
(
color:
isDark
?
Colors
.
white
:
const
Color
(
0xFF202124
),
),
),
];
if
(
demo
.
subtitle
!=
null
)
{
titleChildren
.
add
(
new
Text
(
demo
.
subtitle
,
style:
theme
.
textTheme
.
body1
.
copyWith
(
color:
isDark
?
Colors
.
white
:
const
Color
(
0xFF60646B
)
),
),
);
}
return
new
RawMaterialButton
(
return
new
RawMaterialButton
(
padding:
EdgeInsets
.
zero
,
padding:
EdgeInsets
.
zero
,
splashColor:
theme
.
primaryColor
.
withOpacity
(
0.12
),
splashColor:
theme
.
primaryColor
.
withOpacity
(
0.12
),
...
@@ -221,7 +202,19 @@ class _DemoItem extends StatelessWidget {
...
@@ -221,7 +202,19 @@ class _DemoItem extends StatelessWidget {
child:
new
Column
(
child:
new
Column
(
mainAxisAlignment:
MainAxisAlignment
.
center
,
mainAxisAlignment:
MainAxisAlignment
.
center
,
crossAxisAlignment:
CrossAxisAlignment
.
stretch
,
crossAxisAlignment:
CrossAxisAlignment
.
stretch
,
children:
titleChildren
,
children:
<
Widget
>[
new
Text
(
demo
.
title
,
style:
theme
.
textTheme
.
subhead
.
copyWith
(
color:
isDark
?
Colors
.
white
:
const
Color
(
0xFF202124
),
),
),
new
Text
(
demo
.
subtitle
,
style:
theme
.
textTheme
.
body1
.
copyWith
(
color:
isDark
?
Colors
.
white
:
const
Color
(
0xFF60646B
)),
),
],
),
),
),
),
const
SizedBox
(
width:
44.0
),
const
SizedBox
(
width:
44.0
),
...
...
examples/flutter_gallery/test_driver/transitions_perf_test.dart
View file @
322eb81a
...
@@ -21,8 +21,8 @@ const FileSystem _fs = const LocalFileSystem();
...
@@ -21,8 +21,8 @@ const FileSystem _fs = const LocalFileSystem();
// --trace-startup, as we do in this test, the VM stores trace events in an
// --trace-startup, as we do in this test, the VM stores trace events in an
// endless buffer instead of a ring buffer.
// endless buffer instead of a ring buffer.
//
//
// These names must match GalleryItem titles from
kAllGalleryDemo
s
// These names must match GalleryItem titles from
kAllGalleryItem
s
// in examples/flutter_gallery/lib/gallery
/demos
.dart
// in examples/flutter_gallery/lib/gallery
.item
.dart
const
List
<
String
>
kProfiledDemos
=
const
<
String
>[
const
List
<
String
>
kProfiledDemos
=
const
<
String
>[
'Shrine'
,
'Shrine'
,
'Contact profile'
,
'Contact profile'
,
...
@@ -31,14 +31,14 @@ const List<String> kProfiledDemos = const <String>[
...
@@ -31,14 +31,14 @@ const List<String> kProfiledDemos = const <String>[
'Buttons'
,
'Buttons'
,
'Cards'
,
'Cards'
,
'Chips'
,
'Chips'
,
'
P
ickers'
,
'
Date and time p
ickers'
,
'Dialog
s
'
,
'Dialog'
,
];
];
// Demos that will be backed out of within FlutterDriver.runUnsynchronized();
// Demos that will be backed out of within FlutterDriver.runUnsynchronized();
//
//
// These names must match GalleryItem titles from
kAllGalleryDemo
s
// These names must match GalleryItem titles from
kAllGalleryItem
s
// in examples/flutter_gallery/lib/gallery
/demos
.dart
// in examples/flutter_gallery/lib/gallery
.item
.dart
const
List
<
String
>
kUnsynchronizedDemos
=
const
<
String
>[
const
List
<
String
>
kUnsynchronizedDemos
=
const
<
String
>[
'Progress indicators'
,
'Progress indicators'
,
'Activity Indicator'
,
'Activity Indicator'
,
...
...
packages/flutter/lib/src/material/feedback.dart
View file @
322eb81a
...
@@ -4,8 +4,6 @@
...
@@ -4,8 +4,6 @@
import
'dart:async'
;
import
'dart:async'
;
import
'package:flutter/rendering.dart'
;
import
'package:flutter/semantics.dart'
;
import
'package:flutter/services.dart'
;
import
'package:flutter/services.dart'
;
import
'package:flutter/widgets.dart'
;
import
'package:flutter/widgets.dart'
;
...
@@ -88,7 +86,6 @@ class Feedback {
...
@@ -88,7 +86,6 @@ class Feedback {
/// * [wrapForTap] to trigger platform-specific feedback before executing a
/// * [wrapForTap] to trigger platform-specific feedback before executing a
/// [GestureTapCallback].
/// [GestureTapCallback].
static
Future
<
Null
>
forTap
(
BuildContext
context
)
async
{
static
Future
<
Null
>
forTap
(
BuildContext
context
)
async
{
context
.
findRenderObject
().
sendSemanticsEvent
(
const
TapSemanticEvent
());
switch
(
_platform
(
context
))
{
switch
(
_platform
(
context
))
{
case
TargetPlatform
.
android
:
case
TargetPlatform
.
android
:
case
TargetPlatform
.
fuchsia
:
case
TargetPlatform
.
fuchsia
:
...
@@ -127,7 +124,6 @@ class Feedback {
...
@@ -127,7 +124,6 @@ class Feedback {
/// * [wrapForLongPress] to trigger platform-specific feedback before
/// * [wrapForLongPress] to trigger platform-specific feedback before
/// executing a [GestureLongPressCallback].
/// executing a [GestureLongPressCallback].
static
Future
<
Null
>
forLongPress
(
BuildContext
context
)
{
static
Future
<
Null
>
forLongPress
(
BuildContext
context
)
{
context
.
findRenderObject
().
sendSemanticsEvent
(
const
LongPressSemanticsEvent
());
switch
(
_platform
(
context
))
{
switch
(
_platform
(
context
))
{
case
TargetPlatform
.
android
:
case
TargetPlatform
.
android
:
case
TargetPlatform
.
fuchsia
:
case
TargetPlatform
.
fuchsia
:
...
...
packages/flutter/lib/src/material/toggleable.dart
View file @
322eb81a
...
@@ -285,7 +285,6 @@ abstract class RenderToggleable extends RenderConstrainedBox {
...
@@ -285,7 +285,6 @@ abstract class RenderToggleable extends RenderConstrainedBox {
onChanged
(
false
);
onChanged
(
false
);
break
;
break
;
}
}
sendSemanticsEvent
(
const
TapSemanticEvent
());
}
}
void
_handleTapUp
(
TapUpDetails
details
)
{
void
_handleTapUp
(
TapUpDetails
details
)
{
...
...
packages/flutter/lib/src/rendering/object.dart
View file @
322eb81a
...
@@ -2165,25 +2165,6 @@ abstract class RenderObject extends AbstractNode with DiagnosticableTreeMixin im
...
@@ -2165,25 +2165,6 @@ abstract class RenderObject extends AbstractNode with DiagnosticableTreeMixin im
// Nothing to do by default.
// Nothing to do by default.
}
}
/// Sends a [SemanticsEvent] associated with this render object's [SemanticsNode].
///
/// If this render object has no semantics information, the first parent
/// render object with a non-null semantic node is used.
///
/// If semantics are disabled, no events are dispatched.
///
/// See [SemanticsNode.sendEvent] for a full description of the behavior.
void
sendSemanticsEvent
(
SemanticsEvent
semanticsEvent
)
{
if
(
owner
.
semanticsOwner
==
null
)
return
;
if
(
_semantics
!=
null
)
{
_semantics
.
sendEvent
(
semanticsEvent
);
}
else
if
(
parent
!=
null
)
{
final
RenderObject
renderParent
=
parent
;
renderParent
.
sendSemanticsEvent
(
semanticsEvent
);
}
}
// Use [_semanticsConfiguration] to access.
// Use [_semanticsConfiguration] to access.
SemanticsConfiguration
_cachedSemanticsConfiguration
;
SemanticsConfiguration
_cachedSemanticsConfiguration
;
...
...
packages/flutter/lib/src/semantics/semantics_event.dart
View file @
322eb81a
...
@@ -90,7 +90,7 @@ class AnnounceSemanticsEvent extends SemanticsEvent {
...
@@ -90,7 +90,7 @@ class AnnounceSemanticsEvent extends SemanticsEvent {
}
}
/// An event for a semantic announcement of a tooltip.
/// An event for a semantic announcement of a tooltip.
///
///
/// This is only used by Android to announce tooltip values.
/// This is only used by Android to announce tooltip values.
class
TooltipSemanticsEvent
extends
SemanticsEvent
{
class
TooltipSemanticsEvent
extends
SemanticsEvent
{
...
@@ -107,29 +107,3 @@ class TooltipSemanticsEvent extends SemanticsEvent {
...
@@ -107,29 +107,3 @@ class TooltipSemanticsEvent extends SemanticsEvent {
};
};
}
}
}
}
/// An event which triggers long press semantic feedback.
///
/// Currently only honored on Android. Triggers a long-press specific sound
/// when TalkBack is enabled.
class
LongPressSemanticsEvent
extends
SemanticsEvent
{
/// Constructs an event that triggers a long-press semantic feedback by the platform.
const
LongPressSemanticsEvent
()
:
super
(
'longPress'
);
@override
Map
<
String
,
dynamic
>
getDataMap
()
=>
const
<
String
,
dynamic
>{};
}
/// An event which triggers tap semantic feedback.
///
/// Currently only honored on Android. Triggers a tap specific sound when
/// TalkBack is enabled.
class
TapSemanticEvent
extends
SemanticsEvent
{
/// Constructs an event that triggers a long-press semantic feedback by the platform.
const
TapSemanticEvent
()
:
super
(
'tap'
);
@override
Map
<
String
,
dynamic
>
getDataMap
()
=>
const
<
String
,
dynamic
>{};
}
packages/flutter/lib/src/semantics/semantics_service.dart
View file @
322eb81a
...
@@ -34,8 +34,7 @@ class SemanticsService {
...
@@ -34,8 +34,7 @@ class SemanticsService {
/// Sends a semantic announcement of a tooltip.
/// Sends a semantic announcement of a tooltip.
///
///
/// Currently only honored on Android. The contents of [message] will be
/// This is only used by Android.
/// read by TalkBack.
static
Future
<
Null
>
tooltip
(
String
message
)
async
{
static
Future
<
Null
>
tooltip
(
String
message
)
async
{
final
TooltipSemanticsEvent
event
=
new
TooltipSemanticsEvent
(
message
);
final
TooltipSemanticsEvent
event
=
new
TooltipSemanticsEvent
(
message
);
await
SystemChannels
.
accessibility
.
send
(
event
.
toMap
());
await
SystemChannels
.
accessibility
.
send
(
event
.
toMap
());
...
...
packages/flutter/test/material/checkbox_test.dart
View file @
322eb81a
...
@@ -5,7 +5,6 @@
...
@@ -5,7 +5,6 @@
import
'dart:ui'
;
import
'dart:ui'
;
import
'package:flutter/rendering.dart'
;
import
'package:flutter/rendering.dart'
;
import
'package:flutter/services.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter/material.dart'
;
...
@@ -186,44 +185,4 @@ void main() {
...
@@ -186,44 +185,4 @@ void main() {
await
tester
.
pumpAndSettle
();
await
tester
.
pumpAndSettle
();
expect
(
checkBoxValue
,
null
);
expect
(
checkBoxValue
,
null
);
});
});
testWidgets
(
'has semantic events'
,
(
WidgetTester
tester
)
async
{
dynamic
semanticEvent
;
bool
checkboxValue
=
false
;
SystemChannels
.
accessibility
.
setMockMessageHandler
((
dynamic
message
)
{
semanticEvent
=
message
;
});
final
SemanticsTester
semanticsTester
=
new
SemanticsTester
(
tester
);
await
tester
.
pumpWidget
(
new
Material
(
child:
new
StatefulBuilder
(
builder:
(
BuildContext
context
,
StateSetter
setState
)
{
return
new
Checkbox
(
value:
checkboxValue
,
onChanged:
(
bool
value
)
{
setState
(()
{
checkboxValue
=
value
;
});
},
);
},
),
),
);
await
tester
.
tap
(
find
.
byType
(
Checkbox
));
final
RenderObject
object
=
tester
.
firstRenderObject
(
find
.
byType
(
Checkbox
));
expect
(
checkboxValue
,
true
);
expect
(
semanticEvent
,
<
String
,
dynamic
>{
'type'
:
'tap'
,
'nodeId'
:
object
.
debugSemantics
.
id
,
'data'
:
<
String
,
dynamic
>{},
});
expect
(
object
.
debugSemantics
.
getSemanticsData
().
hasAction
(
SemanticsAction
.
tap
),
true
);
SystemChannels
.
accessibility
.
setMockMessageHandler
(
null
);
semanticsTester
.
dispose
();
});
}
}
packages/flutter/test/material/feedback_test.dart
View file @
322eb81a
import
'dart:ui'
;
// Copyright 2017 The Chromium Authors. All rights reserved.
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// found in the LICENSE file.
import
'package:flutter/material.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter/rendering.dart'
;
import
'package:flutter/services.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
import
'../widgets/semantics_tester.dart'
;
import
'feedback_tester.dart'
;
import
'feedback_tester.dart'
;
void
main
(
)
{
void
main
(
)
{
...
@@ -26,23 +21,8 @@ void main () {
...
@@ -26,23 +21,8 @@ void main () {
});
});
group
(
'Feedback on Android'
,
()
{
group
(
'Feedback on Android'
,
()
{
List
<
Map
<
String
,
Object
>>
semanticEvents
;
setUp
(()
{
semanticEvents
=
<
Map
<
String
,
Object
>>[];
SystemChannels
.
accessibility
.
setMockMessageHandler
((
dynamic
message
)
{
final
Map
<
dynamic
,
dynamic
>
typedMessage
=
message
;
semanticEvents
.
add
(
typedMessage
.
cast
<
String
,
Object
>());
});
});
tearDown
(()
{
SystemChannels
.
accessibility
.
setMockMessageHandler
(
null
);
});
testWidgets
(
'forTap'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'forTap'
,
(
WidgetTester
tester
)
async
{
final
SemanticsTester
semanticsTester
=
new
SemanticsTester
(
tester
);
await
tester
.
pumpWidget
(
new
TestWidget
(
await
tester
.
pumpWidget
(
new
TestWidget
(
tapHandler:
(
BuildContext
context
)
{
tapHandler:
(
BuildContext
context
)
{
return
()
=>
Feedback
.
forTap
(
context
);
return
()
=>
Feedback
.
forTap
(
context
);
...
@@ -51,27 +31,14 @@ void main () {
...
@@ -51,27 +31,14 @@ void main () {
await
tester
.
pumpAndSettle
(
kWaitDuration
);
await
tester
.
pumpAndSettle
(
kWaitDuration
);
expect
(
feedback
.
hapticCount
,
0
);
expect
(
feedback
.
hapticCount
,
0
);
expect
(
feedback
.
clickSoundCount
,
0
);
expect
(
feedback
.
clickSoundCount
,
0
);
expect
(
semanticEvents
,
isEmpty
);
await
tester
.
tap
(
find
.
text
(
'X'
));
await
tester
.
tap
(
find
.
text
(
'X'
));
await
tester
.
pumpAndSettle
(
kWaitDuration
);
await
tester
.
pumpAndSettle
(
kWaitDuration
);
final
RenderObject
object
=
tester
.
firstRenderObject
(
find
.
byType
(
GestureDetector
));
expect
(
feedback
.
hapticCount
,
0
);
expect
(
feedback
.
hapticCount
,
0
);
expect
(
feedback
.
clickSoundCount
,
1
);
expect
(
feedback
.
clickSoundCount
,
1
);
expect
(
semanticEvents
.
single
,
<
String
,
dynamic
>{
'type'
:
'tap'
,
'nodeId'
:
object
.
debugSemantics
.
id
,
'data'
:
<
String
,
dynamic
>{},
});
expect
(
object
.
debugSemantics
.
getSemanticsData
().
hasAction
(
SemanticsAction
.
tap
),
true
);
semanticsTester
.
dispose
();
});
});
testWidgets
(
'forTap Wrapper'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'forTap Wrapper'
,
(
WidgetTester
tester
)
async
{
final
SemanticsTester
semanticsTester
=
new
SemanticsTester
(
tester
);
int
callbackCount
=
0
;
int
callbackCount
=
0
;
final
VoidCallback
callback
=
()
{
final
VoidCallback
callback
=
()
{
callbackCount
++;
callbackCount
++;
...
@@ -82,7 +49,6 @@ void main () {
...
@@ -82,7 +49,6 @@ void main () {
return
Feedback
.
wrapForTap
(
callback
,
context
);
return
Feedback
.
wrapForTap
(
callback
,
context
);
},
},
));
));
await
tester
.
pumpAndSettle
(
kWaitDuration
);
await
tester
.
pumpAndSettle
(
kWaitDuration
);
expect
(
feedback
.
hapticCount
,
0
);
expect
(
feedback
.
hapticCount
,
0
);
expect
(
feedback
.
clickSoundCount
,
0
);
expect
(
feedback
.
clickSoundCount
,
0
);
...
@@ -90,24 +56,12 @@ void main () {
...
@@ -90,24 +56,12 @@ void main () {
await
tester
.
tap
(
find
.
text
(
'X'
));
await
tester
.
tap
(
find
.
text
(
'X'
));
await
tester
.
pumpAndSettle
(
kWaitDuration
);
await
tester
.
pumpAndSettle
(
kWaitDuration
);
final
RenderObject
object
=
tester
.
firstRenderObject
(
find
.
byType
(
GestureDetector
));
expect
(
feedback
.
hapticCount
,
0
);
expect
(
feedback
.
hapticCount
,
0
);
expect
(
feedback
.
clickSoundCount
,
1
);
expect
(
feedback
.
clickSoundCount
,
1
);
expect
(
callbackCount
,
1
);
expect
(
callbackCount
,
1
);
expect
(
semanticEvents
.
single
,
<
String
,
dynamic
>{
'type'
:
'tap'
,
'nodeId'
:
object
.
debugSemantics
.
id
,
'data'
:
<
String
,
dynamic
>{},
});
expect
(
object
.
debugSemantics
.
getSemanticsData
().
hasAction
(
SemanticsAction
.
tap
),
true
);
semanticsTester
.
dispose
();
});
});
testWidgets
(
'forLongPress'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'forLongPress'
,
(
WidgetTester
tester
)
async
{
final
SemanticsTester
semanticsTester
=
new
SemanticsTester
(
tester
);
await
tester
.
pumpWidget
(
new
TestWidget
(
await
tester
.
pumpWidget
(
new
TestWidget
(
longPressHandler:
(
BuildContext
context
)
{
longPressHandler:
(
BuildContext
context
)
{
return
()
=>
Feedback
.
forLongPress
(
context
);
return
()
=>
Feedback
.
forLongPress
(
context
);
...
@@ -119,23 +73,11 @@ void main () {
...
@@ -119,23 +73,11 @@ void main () {
await
tester
.
longPress
(
find
.
text
(
'X'
));
await
tester
.
longPress
(
find
.
text
(
'X'
));
await
tester
.
pumpAndSettle
(
kWaitDuration
);
await
tester
.
pumpAndSettle
(
kWaitDuration
);
final
RenderObject
object
=
tester
.
firstRenderObject
(
find
.
byType
(
GestureDetector
));
expect
(
feedback
.
hapticCount
,
1
);
expect
(
feedback
.
hapticCount
,
1
);
expect
(
feedback
.
clickSoundCount
,
0
);
expect
(
feedback
.
clickSoundCount
,
0
);
expect
(
semanticEvents
.
single
,
<
String
,
dynamic
>{
'type'
:
'longPress'
,
'nodeId'
:
object
.
debugSemantics
.
id
,
'data'
:
<
String
,
dynamic
>{},
});
expect
(
object
.
debugSemantics
.
getSemanticsData
().
hasAction
(
SemanticsAction
.
longPress
),
true
);
semanticsTester
.
dispose
();
});
});
testWidgets
(
'forLongPress Wrapper'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'forLongPress Wrapper'
,
(
WidgetTester
tester
)
async
{
final
SemanticsTester
semanticsTester
=
new
SemanticsTester
(
tester
);
int
callbackCount
=
0
;
int
callbackCount
=
0
;
final
VoidCallback
callback
=
()
{
final
VoidCallback
callback
=
()
{
callbackCount
++;
callbackCount
++;
...
@@ -147,26 +89,15 @@ void main () {
...
@@ -147,26 +89,15 @@ void main () {
},
},
));
));
await
tester
.
pumpAndSettle
(
kWaitDuration
);
await
tester
.
pumpAndSettle
(
kWaitDuration
);
final
RenderObject
object
=
tester
.
firstRenderObject
(
find
.
byType
(
GestureDetector
));
expect
(
feedback
.
hapticCount
,
0
);
expect
(
feedback
.
hapticCount
,
0
);
expect
(
feedback
.
clickSoundCount
,
0
);
expect
(
feedback
.
clickSoundCount
,
0
);
expect
(
callbackCount
,
0
);
expect
(
callbackCount
,
0
);
await
tester
.
longPress
(
find
.
text
(
'X'
));
await
tester
.
longPress
(
find
.
text
(
'X'
));
await
tester
.
pumpAndSettle
(
kWaitDuration
);
await
tester
.
pumpAndSettle
(
kWaitDuration
);
expect
(
feedback
.
hapticCount
,
1
);
expect
(
feedback
.
hapticCount
,
1
);
expect
(
feedback
.
clickSoundCount
,
0
);
expect
(
feedback
.
clickSoundCount
,
0
);
expect
(
callbackCount
,
1
);
expect
(
callbackCount
,
1
);
expect
(
semanticEvents
.
single
,
<
String
,
dynamic
>{
'type'
:
'longPress'
,
'nodeId'
:
object
.
debugSemantics
.
id
,
'data'
:
<
String
,
dynamic
>{},
});
expect
(
object
.
debugSemantics
.
getSemanticsData
().
hasAction
(
SemanticsAction
.
longPress
),
true
);
semanticsTester
.
dispose
();
});
});
});
});
...
...
packages/flutter/test/material/radio_test.dart
View file @
322eb81a
...
@@ -5,7 +5,6 @@
...
@@ -5,7 +5,6 @@
import
'dart:ui'
;
import
'dart:ui'
;
import
'package:flutter/rendering.dart'
;
import
'package:flutter/rendering.dart'
;
import
'package:flutter/services.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter/material.dart'
;
...
@@ -163,39 +162,4 @@ void main() {
...
@@ -163,39 +162,4 @@ void main() {
semantics
.
dispose
();
semantics
.
dispose
();
});
});
testWidgets
(
'has semantic events'
,
(
WidgetTester
tester
)
async
{
final
SemanticsTester
semantics
=
new
SemanticsTester
(
tester
);
final
Key
key
=
new
UniqueKey
();
dynamic
semanticEvent
;
int
radioValue
=
2
;
SystemChannels
.
accessibility
.
setMockMessageHandler
((
dynamic
message
)
{
semanticEvent
=
message
;
});
await
tester
.
pumpWidget
(
new
Material
(
child:
new
Radio
<
int
>(
key:
key
,
value:
1
,
groupValue:
radioValue
,
onChanged:
(
int
i
)
{
radioValue
=
i
;
},
),
));
await
tester
.
tap
(
find
.
byKey
(
key
));
final
RenderObject
object
=
tester
.
firstRenderObject
(
find
.
byKey
(
key
));
expect
(
radioValue
,
1
);
expect
(
semanticEvent
,
<
String
,
dynamic
>{
'type'
:
'tap'
,
'nodeId'
:
object
.
debugSemantics
.
id
,
'data'
:
<
String
,
dynamic
>{},
});
expect
(
object
.
debugSemantics
.
getSemanticsData
().
hasAction
(
SemanticsAction
.
tap
),
true
);
semantics
.
dispose
();
SystemChannels
.
accessibility
.
setMockMessageHandler
(
null
);
});
}
}
packages/flutter/test/material/switch_test.dart
View file @
322eb81a
...
@@ -4,11 +4,9 @@
...
@@ -4,11 +4,9 @@
import
'package:flutter/material.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter/rendering.dart'
;
import
'package:flutter/rendering.dart'
;
import
'package:flutter/services.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
import
'../rendering/mock_canvas.dart'
;
import
'../rendering/mock_canvas.dart'
;
import
'../widgets/semantics_tester.dart'
;
void
main
(
)
{
void
main
(
)
{
testWidgets
(
'Switch can toggle on tap'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'Switch can toggle on tap'
,
(
WidgetTester
tester
)
async
{
...
@@ -189,48 +187,4 @@ void main() {
...
@@ -189,48 +187,4 @@ void main() {
..
circle
(
color:
Colors
.
red
[
500
])
..
circle
(
color:
Colors
.
red
[
500
])
);
);
});
});
testWidgets
(
'switch has semantic events'
,
(
WidgetTester
tester
)
async
{
dynamic
semanticEvent
;
bool
value
=
false
;
SystemChannels
.
accessibility
.
setMockMessageHandler
((
dynamic
message
)
{
semanticEvent
=
message
;
});
final
SemanticsTester
semanticsTester
=
new
SemanticsTester
(
tester
);
await
tester
.
pumpWidget
(
new
Directionality
(
textDirection:
TextDirection
.
ltr
,
child:
new
StatefulBuilder
(
builder:
(
BuildContext
context
,
StateSetter
setState
)
{
return
new
Material
(
child:
new
Center
(
child:
new
Switch
(
value:
value
,
onChanged:
(
bool
newValue
)
{
setState
(()
{
value
=
newValue
;
});
},
),
),
);
},
),
),
);
await
tester
.
tap
(
find
.
byType
(
Switch
));
final
RenderObject
object
=
tester
.
firstRenderObject
(
find
.
byType
(
Switch
));
expect
(
value
,
true
);
expect
(
semanticEvent
,
<
String
,
dynamic
>{
'type'
:
'tap'
,
'nodeId'
:
object
.
debugSemantics
.
id
,
'data'
:
<
String
,
dynamic
>{},
});
expect
(
object
.
debugSemantics
.
getSemanticsData
().
hasAction
(
SemanticsAction
.
tap
),
true
);
semanticsTester
.
dispose
();
SystemChannels
.
accessibility
.
setMockMessageHandler
(
null
);
});
}
}
packages/flutter/test/material/tooltip_test.dart
View file @
322eb81a
import
'dart:ui'
;
import
'dart:ui'
;
import
'package:flutter/services.dart'
;
// Copyright 2015 The Chromium Authors. All rights reserved.
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// found in the LICENSE file.
...
@@ -606,48 +605,6 @@ void main() {
...
@@ -606,48 +605,6 @@ void main() {
feedback
.
dispose
();
feedback
.
dispose
();
});
});
testWidgets
(
'has semantic events'
,
(
WidgetTester
tester
)
async
{
final
List
<
dynamic
>
semanticEvents
=
<
dynamic
>[];
SystemChannels
.
accessibility
.
setMockMessageHandler
((
dynamic
message
)
{
semanticEvents
.
add
(
message
);
});
final
SemanticsTester
semantics
=
new
SemanticsTester
(
tester
);
await
tester
.
pumpWidget
(
new
MaterialApp
(
home:
new
Center
(
child:
new
Tooltip
(
message:
'Foo'
,
child:
new
Container
(
width:
100.0
,
height:
100.0
,
color:
Colors
.
green
[
500
],
),
),
),
),
);
await
tester
.
longPress
(
find
.
byType
(
Tooltip
));
final
RenderObject
object
=
tester
.
firstRenderObject
(
find
.
byType
(
Tooltip
));
expect
(
semanticEvents
,
unorderedEquals
(<
dynamic
>[
<
String
,
dynamic
>{
'type'
:
'longPress'
,
'nodeId'
:
findDebugSemantics
(
object
).
id
,
'data'
:
<
String
,
dynamic
>{},
},
<
String
,
dynamic
>{
'type'
:
'tooltip'
,
'data'
:
<
String
,
dynamic
>{
'message'
:
'Foo'
,
},
},
]));
semantics
.
dispose
();
SystemChannels
.
accessibility
.
setMockMessageHandler
(
null
);
});
testWidgets
(
'Semantics included'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'Semantics included'
,
(
WidgetTester
tester
)
async
{
final
SemanticsTester
semantics
=
new
SemanticsTester
(
tester
);
final
SemanticsTester
semantics
=
new
SemanticsTester
(
tester
);
...
@@ -720,9 +677,3 @@ void main() {
...
@@ -720,9 +677,3 @@ void main() {
});
});
}
}
SemanticsNode
findDebugSemantics
(
RenderObject
object
)
{
if
(
object
.
debugSemantics
!=
null
)
return
object
.
debugSemantics
;
return
findDebugSemantics
(
object
.
parent
);
}
\ No newline at end of file
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