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
803f9959
Unverified
Commit
803f9959
authored
May 07, 2022
by
Taha Tesser
Committed by
GitHub
May 07, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update Cupertino examples and add missing tests (#103128)
parent
b05b44e8
Changes
30
Hide whitespace changes
Inline
Side-by-side
Showing
30 changed files
with
493 additions
and
235 deletions
+493
-235
cupertino_activity_indicator.0.dart
...no/activity_indicator/cupertino_activity_indicator.0.dart
+3
-1
cupertino_button.0.dart
examples/api/lib/cupertino/button/cupertino_button.0.dart
+3
-0
cupertino_context_menu.0.dart
.../lib/cupertino/context_menu/cupertino_context_menu.0.dart
+38
-16
cupertino_date_picker.0.dart
...pi/lib/cupertino/date_picker/cupertino_date_picker.0.dart
+3
-0
cupertino_timer_picker.0.dart
...i/lib/cupertino/date_picker/cupertino_timer_picker.0.dart
+3
-0
cupertino_form_row.0.dart
...ples/api/lib/cupertino/form_row/cupertino_form_row.0.dart
+66
-60
cupertino_page_scaffold.0.dart
...ib/cupertino/page_scaffold/cupertino_page_scaffold.0.dart
+26
-22
cupertino_picker.0.dart
examples/api/lib/cupertino/picker/cupertino_picker.0.dart
+3
-0
cupertino_sliver_refresh_control.0.dart
...cupertino/refresh/cupertino_sliver_refresh_control.0.dart
+12
-11
show_cupertino_dialog.0.dart
...ples/api/lib/cupertino/route/show_cupertino_dialog.0.dart
+29
-20
show_cupertino_modal_popup.0.dart
...api/lib/cupertino/route/show_cupertino_modal_popup.0.dart
+14
-15
cupertino_scrollbar.0.dart
...es/api/lib/cupertino/scrollbar/cupertino_scrollbar.0.dart
+28
-28
cupertino_scrollbar.1.dart
...es/api/lib/cupertino/scrollbar/cupertino_scrollbar.1.dart
+32
-31
cupertino_segmented_control.0.dart
...tino/segmented_control/cupertino_segmented_control.0.dart
+3
-3
cupertino_sliding_segmented_control.0.dart
...mented_control/cupertino_sliding_segmented_control.0.dart
+3
-3
cupertino_slider.0.dart
examples/api/lib/cupertino/slider/cupertino_slider.0.dart
+3
-0
cupertino_text_field.0.dart
.../api/lib/cupertino/text_field/cupertino_text_field.0.dart
+3
-0
cupertino_text_form_field_row.1.dart
.../text_form_field_row/cupertino_text_form_field_row.1.dart
+13
-18
cupertino_context_menu.0_test.dart
...cupertino/context_menu/cupertino_context_menu.0_test.dart
+26
-0
cupertino_sliver_nav_bar.0_test.dart
...st/cupertino/nav_bar/cupertino_sliver_nav_bar.0_test.dart
+3
-3
cupertino_page_scaffold.0_test.dart
...pertino/page_scaffold/cupertino_page_scaffold.0_test.dart
+21
-0
cupertino_sliver_refresh_control.0_test.dart
...tino/refresh/cupertino_sliver_refresh_control.0_test.dart
+26
-0
show_cupertino_dialog.0_test.dart
...pi/test/cupertino/route/show_cupertino_dialog.0_test.dart
+26
-0
show_cupertino_modal_popup.0_test.dart
...st/cupertino/route/show_cupertino_modal_popup.0_test.dart
+26
-0
cupertino_scrollbar.0_test.dart
.../test/cupertino/scrollbar/cupertino_scrollbar.0_test.dart
+26
-0
cupertino_scrollbar.1_test.dart
.../test/cupertino/scrollbar/cupertino_scrollbar.1_test.dart
+26
-0
cupertino_segmented_control.0_test.dart
...segmented_control/cupertino_segmented_control.0_test.dart
+1
-1
cupertino_sliding_segmented_control.0_test.dart
...d_control/cupertino_sliding_segmented_control.0_test.dart
+1
-1
cupertino_text_form_field_row.1_test.dart
..._form_field_row/cupertino_text_form_field_row.1_test.dart
+24
-0
route.dart
packages/flutter/lib/src/cupertino/route.dart
+2
-2
No files found.
examples/api/lib/cupertino/activity_indicator/cupertino_activity_indicator.0.dart
View file @
803f9959
...
@@ -25,8 +25,10 @@ class CupertinoIndicatorExample extends StatelessWidget {
...
@@ -25,8 +25,10 @@ class CupertinoIndicatorExample extends StatelessWidget {
@override
@override
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
return
CupertinoPageScaffold
(
return
CupertinoPageScaffold
(
navigationBar:
const
CupertinoNavigationBar
(
middle:
Text
(
'CupertinoActivityIndicator Sample'
),
),
child:
Center
(
child:
Center
(
child:
Column
(
child:
Column
(
mainAxisAlignment:
MainAxisAlignment
.
spaceEvenly
,
mainAxisAlignment:
MainAxisAlignment
.
spaceEvenly
,
...
...
examples/api/lib/cupertino/button/cupertino_button.0.dart
View file @
803f9959
...
@@ -26,6 +26,9 @@ class CupertinoButtonExample extends StatelessWidget {
...
@@ -26,6 +26,9 @@ class CupertinoButtonExample extends StatelessWidget {
@override
@override
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
return
CupertinoPageScaffold
(
return
CupertinoPageScaffold
(
navigationBar:
const
CupertinoNavigationBar
(
middle:
Text
(
'CupertinoButton Sample'
),
),
child:
Center
(
child:
Center
(
child:
Column
(
child:
Column
(
mainAxisSize:
MainAxisSize
.
min
,
mainAxisSize:
MainAxisSize
.
min
,
...
...
examples/api/lib/cupertino/context_menu/cupertino_context_menu.0.dart
View file @
803f9959
...
@@ -5,52 +5,74 @@
...
@@ -5,52 +5,74 @@
// Flutter code sample for CupertinoContextMenu
// Flutter code sample for CupertinoContextMenu
import
'package:flutter/cupertino.dart'
;
import
'package:flutter/cupertino.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter/material.dart'
;
void
main
(
)
=>
runApp
(
const
MyApp
());
void
main
(
)
=>
runApp
(
const
ContextMenuApp
());
class
MyApp
extends
StatelessWidget
{
const
MyApp
({
Key
?
key
})
:
super
(
key:
key
);
static
const
String
_title
=
'Flutter Code Sample'
;
class
ContextMenuApp
extends
StatelessWidget
{
const
ContextMenuApp
({
Key
?
key
})
:
super
(
key:
key
);
@override
@override
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
return
const
Material
App
(
return
const
Cupertino
App
(
t
itle:
_title
,
t
heme:
CupertinoThemeData
(
brightness:
Brightness
.
light
)
,
home:
MyStatelessWidget
(),
home:
ContextMenuExample
(),
);
);
}
}
}
}
class
MyStatelessWidget
extends
StatelessWidget
{
class
ContextMenuExample
extends
StatelessWidget
{
const
MyStatelessWidget
({
Key
?
key
})
:
super
(
key:
key
);
const
ContextMenuExample
({
Key
?
key
})
:
super
(
key:
key
);
@override
@override
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
return
Scaffold
(
return
CupertinoPageScaffold
(
body:
Center
(
navigationBar:
const
CupertinoNavigationBar
(
middle:
Text
(
'CupertinoContextMenu Sample'
),
),
child:
Center
(
child:
SizedBox
(
child:
SizedBox
(
width:
100
,
width:
100
,
height:
100
,
height:
100
,
child:
CupertinoContextMenu
(
child:
CupertinoContextMenu
(
actions:
<
Widget
>[
actions:
<
Widget
>[
CupertinoContextMenuAction
(
CupertinoContextMenuAction
(
child:
const
Text
(
'Action one'
),
onPressed:
()
{
onPressed:
()
{
Navigator
.
pop
(
context
);
Navigator
.
pop
(
context
);
},
},
isDefaultAction:
true
,
trailingIcon:
CupertinoIcons
.
doc_on_clipboard_fill
,
child:
const
Text
(
'Copy'
),
),
CupertinoContextMenuAction
(
onPressed:
()
{
Navigator
.
pop
(
context
);
},
trailingIcon:
CupertinoIcons
.
share
,
child:
const
Text
(
'Share '
),
),
),
CupertinoContextMenuAction
(
CupertinoContextMenuAction
(
child:
const
Text
(
'Action two'
),
onPressed:
()
{
onPressed:
()
{
Navigator
.
pop
(
context
);
Navigator
.
pop
(
context
);
},
},
trailingIcon:
CupertinoIcons
.
heart
,
child:
const
Text
(
'Favorite'
),
),
CupertinoContextMenuAction
(
onPressed:
()
{
Navigator
.
pop
(
context
);
},
isDestructiveAction:
true
,
trailingIcon:
CupertinoIcons
.
delete
,
child:
const
Text
(
'Delete'
),
),
),
],
],
child:
Container
(
child:
Container
(
color:
Colors
.
red
,
decoration:
BoxDecoration
(
color:
CupertinoColors
.
systemYellow
,
borderRadius:
BorderRadius
.
circular
(
20.0
),
),
child:
const
FlutterLogo
(
size:
500.0
),
),
),
),
),
),
),
...
...
examples/api/lib/cupertino/date_picker/cupertino_date_picker.0.dart
View file @
803f9959
...
@@ -57,6 +57,9 @@ class _DatePickerExampleState extends State<DatePickerExample> {
...
@@ -57,6 +57,9 @@ class _DatePickerExampleState extends State<DatePickerExample> {
@override
@override
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
return
CupertinoPageScaffold
(
return
CupertinoPageScaffold
(
navigationBar:
const
CupertinoNavigationBar
(
middle:
Text
(
'CupertinoDatePicker Sample'
),
),
child:
DefaultTextStyle
(
child:
DefaultTextStyle
(
style:
TextStyle
(
style:
TextStyle
(
color:
CupertinoColors
.
label
.
resolveFrom
(
context
),
color:
CupertinoColors
.
label
.
resolveFrom
(
context
),
...
...
examples/api/lib/cupertino/date_picker/cupertino_timer_picker.0.dart
View file @
803f9959
...
@@ -55,6 +55,9 @@ class _TimerPickerExampleState extends State<TimerPickerExample> {
...
@@ -55,6 +55,9 @@ class _TimerPickerExampleState extends State<TimerPickerExample> {
@override
@override
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
return
CupertinoPageScaffold
(
return
CupertinoPageScaffold
(
navigationBar:
const
CupertinoNavigationBar
(
middle:
Text
(
'CupertinoTimerPicker Sample'
),
),
child:
DefaultTextStyle
(
child:
DefaultTextStyle
(
style:
TextStyle
(
style:
TextStyle
(
color:
CupertinoColors
.
label
.
resolveFrom
(
context
),
color:
CupertinoColors
.
label
.
resolveFrom
(
context
),
...
...
examples/api/lib/cupertino/form_row/cupertino_form_row.0.dart
View file @
803f9959
...
@@ -33,74 +33,80 @@ class _CupertinoFormRowExampleState extends State<CupertinoFormRowExample> {
...
@@ -33,74 +33,80 @@ class _CupertinoFormRowExampleState extends State<CupertinoFormRowExample> {
@override
@override
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
return
CupertinoPageScaffold
(
return
CupertinoPageScaffold
(
child:
CupertinoFormSection
(
navigationBar:
const
CupertinoNavigationBar
(
header:
const
Text
(
'Connectivity'
),
middle:
Text
(
'CupertinoFormSection Sample'
),
children:
<
Widget
>[
),
CupertinoFormRow
(
// Add safe area widget to place the CupertinoFormSection below the navigation bar.
prefix:
const
PrefixWidget
(
child:
SafeArea
(
icon:
CupertinoIcons
.
airplane
,
child:
CupertinoFormSection
(
title:
'Airplane Mode'
,
header:
const
Text
(
'Connectivity'
),
color:
CupertinoColors
.
systemOrange
,
children:
<
Widget
>[
),
CupertinoFormRow
(
child:
CupertinoSwitch
(
prefix:
const
PrefixWidget
(
value:
airplaneMode
,
icon:
CupertinoIcons
.
airplane
,
onChanged:
(
bool
value
)
{
title:
'Airplane Mode'
,
setState
(()
{
color:
CupertinoColors
.
systemOrange
,
airplaneMode
=
value
;
),
});
child:
CupertinoSwitch
(
},
value:
airplaneMode
,
),
onChanged:
(
bool
value
)
{
),
setState
(()
{
CupertinoFormRow
(
airplaneMode
=
value
;
prefix:
const
PrefixWidget
(
});
icon:
CupertinoIcons
.
wifi
,
},
title:
'Wi-Fi'
,
),
color:
CupertinoColors
.
systemBlue
,
),
error:
const
Text
(
'Home network unavailable'
),
child:
Row
(
mainAxisAlignment:
MainAxisAlignment
.
end
,
children:
const
<
Widget
>[
Text
(
'Not connected'
),
SizedBox
(
width:
5
),
Icon
(
CupertinoIcons
.
forward
)
],
),
),
CupertinoFormRow
(
prefix:
const
PrefixWidget
(
icon:
CupertinoIcons
.
bluetooth
,
title:
'Bluetooth'
,
color:
CupertinoColors
.
activeBlue
,
),
),
helper:
Padding
(
CupertinoFormRow
(
padding:
const
EdgeInsets
.
symmetric
(
vertical:
4.0
),
prefix:
const
PrefixWidget
(
icon:
CupertinoIcons
.
wifi
,
title:
'Wi-Fi'
,
color:
CupertinoColors
.
systemBlue
,
),
error:
const
Text
(
'Home network unavailable'
),
child:
Row
(
child:
Row
(
mainAxisAlignment:
MainAxisAlignment
.
spaceBetween
,
mainAxisAlignment:
MainAxisAlignment
.
end
,
children:
const
<
Widget
>[
children:
const
<
Widget
>[
Text
(
'Headphone'
),
Text
(
'Not connected'
),
Text
(
'Connected'
),
SizedBox
(
width:
5
),
Icon
(
CupertinoIcons
.
forward
)
],
],
),
),
),
),
child:
Row
(
CupertinoFormRow
(
mainAxisAlignment:
MainAxisAlignment
.
end
,
prefix:
const
PrefixWidget
(
children:
const
<
Widget
>[
icon:
CupertinoIcons
.
bluetooth
,
Text
(
'On'
),
title:
'Bluetooth'
,
SizedBox
(
width:
5
),
color:
CupertinoColors
.
activeBlue
,
Icon
(
CupertinoIcons
.
forward
)
),
],
helper:
Padding
(
padding:
const
EdgeInsets
.
symmetric
(
vertical:
4.0
),
child:
Row
(
mainAxisAlignment:
MainAxisAlignment
.
spaceBetween
,
children:
const
<
Widget
>[
Text
(
'Headphone'
),
Text
(
'Connected'
),
],
),
),
child:
Row
(
mainAxisAlignment:
MainAxisAlignment
.
end
,
children:
const
<
Widget
>[
Text
(
'On'
),
SizedBox
(
width:
5
),
Icon
(
CupertinoIcons
.
forward
)
],
),
),
),
),
const
CupertinoFormRow
(
const
CupertinoFormRow
(
prefix:
PrefixWidget
(
prefix:
PrefixWidget
(
icon:
CupertinoIcons
.
bluetooth
,
icon:
CupertinoIcons
.
bluetooth
,
title:
'Mobile Data'
,
title:
'Mobile Data'
,
color:
CupertinoColors
.
systemGreen
,
color:
CupertinoColors
.
systemGreen
,
),
child:
Icon
(
CupertinoIcons
.
forward
),
),
),
child:
Icon
(
CupertinoIcons
.
forward
),
],
),
),
],
),
),
);
);
}
}
...
...
examples/api/lib/cupertino/page_scaffold/cupertino_page_scaffold.0.dart
View file @
803f9959
...
@@ -6,30 +6,28 @@
...
@@ -6,30 +6,28 @@
import
'package:flutter/cupertino.dart'
;
import
'package:flutter/cupertino.dart'
;
void
main
(
)
=>
runApp
(
const
My
App
());
void
main
(
)
=>
runApp
(
const
PageScaffold
App
());
class
MyApp
extends
StatelessWidget
{
class
PageScaffoldApp
extends
StatelessWidget
{
const
MyApp
({
Key
?
key
})
:
super
(
key:
key
);
const
PageScaffoldApp
({
Key
?
key
})
:
super
(
key:
key
);
static
const
String
_title
=
'Flutter Code Sample'
;
@override
@override
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
return
const
CupertinoApp
(
return
const
CupertinoApp
(
t
itle:
_title
,
t
heme:
CupertinoThemeData
(
brightness:
Brightness
.
light
)
,
home:
MyStatefulWidget
(),
home:
PageScaffoldExample
(),
);
);
}
}
}
}
class
MyStatefulWidget
extends
StatefulWidget
{
class
PageScaffoldExample
extends
StatefulWidget
{
const
MyStatefulWidget
({
Key
?
key
})
:
super
(
key:
key
);
const
PageScaffoldExample
({
Key
?
key
})
:
super
(
key:
key
);
@override
@override
State
<
MyStatefulWidget
>
createState
()
=>
_MyStatefulWidget
State
();
State
<
PageScaffoldExample
>
createState
()
=>
_PageScaffoldExample
State
();
}
}
class
_
MyStatefulWidgetState
extends
State
<
MyStatefulWidget
>
{
class
_
PageScaffoldExampleState
extends
State
<
PageScaffoldExample
>
{
int
_count
=
0
;
int
_count
=
0
;
@override
@override
...
@@ -38,18 +36,24 @@ class _MyStatefulWidgetState extends State<MyStatefulWidget> {
...
@@ -38,18 +36,24 @@ class _MyStatefulWidgetState extends State<MyStatefulWidget> {
// Uncomment to change the background color
// Uncomment to change the background color
// backgroundColor: CupertinoColors.systemPink,
// backgroundColor: CupertinoColors.systemPink,
navigationBar:
const
CupertinoNavigationBar
(
navigationBar:
const
CupertinoNavigationBar
(
middle:
Text
(
'
Sample Cod
e'
),
middle:
Text
(
'
CupertinoPageScaffold Sampl
e'
),
),
),
child:
ListView
(
child:
Center
(
children:
<
Widget
>[
child:
Column
(
CupertinoButton
(
mainAxisAlignment:
MainAxisAlignment
.
center
,
onPressed:
()
=>
setState
(()
=>
_count
++),
children:
<
Widget
>[
child:
const
Icon
(
CupertinoIcons
.
add
),
Center
(
),
child:
Text
(
'You have pressed the button
$_count
times.'
),
Center
(
),
child:
Text
(
'You have pressed the button
$_count
times.'
),
const
SizedBox
(
height:
20.0
),
),
Center
(
],
child:
CupertinoButton
.
filled
(
onPressed:
()
=>
setState
(()
=>
_count
++),
child:
const
Icon
(
CupertinoIcons
.
add
),
),
),
],
),
),
),
);
);
}
}
...
...
examples/api/lib/cupertino/picker/cupertino_picker.0.dart
View file @
803f9959
...
@@ -64,6 +64,9 @@ class _CupertinoPickerExampleState extends State<CupertinoPickerExample> {
...
@@ -64,6 +64,9 @@ class _CupertinoPickerExampleState extends State<CupertinoPickerExample> {
@override
@override
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
return
CupertinoPageScaffold
(
return
CupertinoPageScaffold
(
navigationBar:
const
CupertinoNavigationBar
(
middle:
Text
(
'CupertinoPicker Sample'
),
),
child:
DefaultTextStyle
(
child:
DefaultTextStyle
(
style:
TextStyle
(
style:
TextStyle
(
color:
CupertinoColors
.
label
.
resolveFrom
(
context
),
color:
CupertinoColors
.
label
.
resolveFrom
(
context
),
...
...
examples/api/lib/cupertino/refresh/cupertino_sliver_refresh_control.0.dart
View file @
803f9959
...
@@ -6,30 +6,28 @@
...
@@ -6,30 +6,28 @@
import
'package:flutter/cupertino.dart'
;
import
'package:flutter/cupertino.dart'
;
void
main
(
)
=>
runApp
(
const
My
App
());
void
main
(
)
=>
runApp
(
const
RefreshControl
App
());
class
MyApp
extends
StatelessWidget
{
class
RefreshControlApp
extends
StatelessWidget
{
const
MyApp
({
Key
?
key
})
:
super
(
key:
key
);
const
RefreshControlApp
({
Key
?
key
})
:
super
(
key:
key
);
static
const
String
_title
=
'Flutter Code Sample'
;
@override
@override
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
return
const
CupertinoApp
(
return
const
CupertinoApp
(
t
itle:
_title
,
t
heme:
CupertinoThemeData
(
brightness:
Brightness
.
light
)
,
home:
MyStatefulWidget
(),
home:
RefreshControlExample
(),
);
);
}
}
}
}
class
MyStatefulWidget
extends
StatefulWidget
{
class
RefreshControlExample
extends
StatefulWidget
{
const
MyStatefulWidget
({
Key
?
key
})
:
super
(
key:
key
);
const
RefreshControlExample
({
Key
?
key
})
:
super
(
key:
key
);
@override
@override
State
<
MyStatefulWidget
>
createState
()
=>
_MyStatefulWidget
State
();
State
<
RefreshControlExample
>
createState
()
=>
_RefreshControlExample
State
();
}
}
class
_
MyStatefulWidgetState
extends
State
<
MyStatefulWidget
>
{
class
_
RefreshControlExampleState
extends
State
<
RefreshControlExample
>
{
List
<
Color
>
colors
=
<
Color
>[
List
<
Color
>
colors
=
<
Color
>[
CupertinoColors
.
systemYellow
,
CupertinoColors
.
systemYellow
,
CupertinoColors
.
systemOrange
,
CupertinoColors
.
systemOrange
,
...
@@ -44,6 +42,9 @@ class _MyStatefulWidgetState extends State<MyStatefulWidget> {
...
@@ -44,6 +42,9 @@ class _MyStatefulWidgetState extends State<MyStatefulWidget> {
@override
@override
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
return
CupertinoPageScaffold
(
return
CupertinoPageScaffold
(
navigationBar:
const
CupertinoNavigationBar
(
middle:
Text
(
'CupertinoSliverRefreshControl Sample'
),
),
child:
CustomScrollView
(
child:
CustomScrollView
(
physics:
const
BouncingScrollPhysics
(
physics:
const
BouncingScrollPhysics
(
parent:
AlwaysScrollableScrollPhysics
(),
parent:
AlwaysScrollableScrollPhysics
(),
...
...
examples/api/lib/cupertino/route/show_cupertino_dialog.0.dart
View file @
803f9959
...
@@ -6,25 +6,23 @@
...
@@ -6,25 +6,23 @@
import
'package:flutter/cupertino.dart'
;
import
'package:flutter/cupertino.dart'
;
void
main
(
)
=>
runApp
(
const
My
App
());
void
main
(
)
=>
runApp
(
const
CupertinoDialog
App
());
class
MyApp
extends
StatelessWidget
{
class
CupertinoDialogApp
extends
StatelessWidget
{
const
MyApp
({
Key
?
key
})
:
super
(
key:
key
);
const
CupertinoDialogApp
({
Key
?
key
})
:
super
(
key:
key
);
static
const
String
_title
=
'Flutter Code Sample'
;
@override
@override
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
return
const
CupertinoApp
(
return
const
CupertinoApp
(
theme:
CupertinoThemeData
(
brightness:
Brightness
.
light
),
restorationScopeId:
'app'
,
restorationScopeId:
'app'
,
title:
_title
,
home:
CupertinoDialogExample
(),
home:
MyStatelessWidget
(),
);
);
}
}
}
}
class
MyStatelessWidget
extends
StatelessWidget
{
class
CupertinoDialogExample
extends
StatelessWidget
{
const
MyStatelessWidget
({
Key
?
key
})
:
super
(
key:
key
);
const
CupertinoDialogExample
({
Key
?
key
})
:
super
(
key:
key
);
@override
@override
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
...
@@ -33,12 +31,13 @@ class MyStatelessWidget extends StatelessWidget {
...
@@ -33,12 +31,13 @@ class MyStatelessWidget extends StatelessWidget {
middle:
Text
(
'Home'
),
middle:
Text
(
'Home'
),
),
),
child:
Center
(
child:
Center
(
child:
CupertinoButton
(
child:
CupertinoButton
(
onPressed:
()
{
onPressed:
()
{
Navigator
.
of
(
context
).
restorablePush
(
_dialogBuilder
);
Navigator
.
of
(
context
).
restorablePush
(
_dialogBuilder
);
},
},
child:
const
Text
(
'Open Dialog'
),
child:
const
Text
(
'Open Dialog'
),
)),
),
),
);
);
}
}
...
@@ -47,12 +46,22 @@ class MyStatelessWidget extends StatelessWidget {
...
@@ -47,12 +46,22 @@ class MyStatelessWidget extends StatelessWidget {
return
CupertinoDialogRoute
<
void
>(
return
CupertinoDialogRoute
<
void
>(
context:
context
,
context:
context
,
builder:
(
BuildContext
context
)
{
builder:
(
BuildContext
context
)
{
return
const
CupertinoAlertDialog
(
return
CupertinoAlertDialog
(
title:
Text
(
'Title'
),
title:
const
Text
(
'Title'
),
content:
Text
(
'Content'
),
content:
const
Text
(
'Content'
),
actions:
<
Widget
>[
actions:
<
Widget
>[
CupertinoDialogAction
(
child:
Text
(
'Yes'
)),
CupertinoDialogAction
(
CupertinoDialogAction
(
child:
Text
(
'No'
)),
onPressed:
()
{
Navigator
.
pop
(
context
);
},
child:
const
Text
(
'Yes'
),
),
CupertinoDialogAction
(
onPressed:
()
{
Navigator
.
pop
(
context
);
},
child:
const
Text
(
'No'
),
),
],
],
);
);
},
},
...
...
examples/api/lib/cupertino/route/show_cupertino_modal_popup.0.dart
View file @
803f9959
...
@@ -6,25 +6,23 @@
...
@@ -6,25 +6,23 @@
import
'package:flutter/cupertino.dart'
;
import
'package:flutter/cupertino.dart'
;
void
main
(
)
=>
runApp
(
const
M
y
App
());
void
main
(
)
=>
runApp
(
const
M
odalPopup
App
());
class
MyApp
extends
StatelessWidget
{
class
ModalPopupApp
extends
StatelessWidget
{
const
MyApp
({
Key
?
key
})
:
super
(
key:
key
);
const
ModalPopupApp
({
Key
?
key
})
:
super
(
key:
key
);
static
const
String
_title
=
'Flutter Code Sample'
;
@override
@override
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
return
const
CupertinoApp
(
return
const
CupertinoApp
(
theme:
CupertinoThemeData
(
brightness:
Brightness
.
light
),
restorationScopeId:
'app'
,
restorationScopeId:
'app'
,
title:
_title
,
home:
ModalPopupExample
(),
home:
MyStatelessWidget
(),
);
);
}
}
}
}
class
M
yStatelessWidget
extends
StatelessWidget
{
class
M
odalPopupExample
extends
StatelessWidget
{
const
M
yStatelessWidget
({
Key
?
key
})
:
super
(
key:
key
);
const
M
odalPopupExample
({
Key
?
key
})
:
super
(
key:
key
);
@override
@override
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
...
@@ -33,12 +31,13 @@ class MyStatelessWidget extends StatelessWidget {
...
@@ -33,12 +31,13 @@ class MyStatelessWidget extends StatelessWidget {
middle:
Text
(
'Home'
),
middle:
Text
(
'Home'
),
),
),
child:
Center
(
child:
Center
(
child:
CupertinoButton
(
child:
CupertinoButton
(
onPressed:
()
{
onPressed:
()
{
Navigator
.
of
(
context
).
restorablePush
(
_modalBuilder
);
Navigator
.
of
(
context
).
restorablePush
(
_modalBuilder
);
},
},
child:
const
Text
(
'Open Modal'
),
child:
const
Text
(
'Open Modal'
),
)),
),
),
);
);
}
}
...
...
examples/api/lib/cupertino/scrollbar/cupertino_scrollbar.0.dart
View file @
803f9959
...
@@ -6,45 +6,45 @@
...
@@ -6,45 +6,45 @@
import
'package:flutter/cupertino.dart'
;
import
'package:flutter/cupertino.dart'
;
import
'package:flutter/material.dart'
;
void
main
(
)
=>
runApp
(
const
ScrollbarApp
())
;
void
main
(
)
=>
runApp
(
const
MyApp
());
class
ScrollbarApp
extends
StatelessWidget
{
const
ScrollbarApp
({
Key
?
key
})
:
super
(
key:
key
);
class
MyApp
extends
StatelessWidget
{
const
MyApp
({
Key
?
key
})
:
super
(
key:
key
);
static
const
String
_title
=
'Flutter Code Sample'
;
@override
@override
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
return
MaterialApp
(
return
const
CupertinoApp
(
title:
_title
,
theme:
CupertinoThemeData
(
brightness:
Brightness
.
light
),
home:
Scaffold
(
home:
ScrollbarExample
(),
appBar:
AppBar
(
title:
const
Text
(
_title
)),
body:
const
MyStatelessWidget
(),
),
);
);
}
}
}
}
class
MyStatelessWidget
extends
StatelessWidget
{
class
ScrollbarExample
extends
StatelessWidget
{
const
MyStatelessWidget
({
Key
?
key
})
:
super
(
key:
key
);
const
ScrollbarExample
({
Key
?
key
})
:
super
(
key:
key
);
@override
@override
@override
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
return
CupertinoScrollbar
(
return
CupertinoPageScaffold
(
thickness:
6.0
,
navigationBar:
const
CupertinoNavigationBar
(
thicknessWhileDragging:
10.0
,
middle:
Text
(
'CupertinoScrollbar Sample'
),
radius:
const
Radius
.
circular
(
34.0
),
),
radiusWhileDragging:
Radius
.
zero
,
child:
CupertinoScrollbar
(
child:
ListView
.
builder
(
thickness:
6.0
,
itemCount:
120
,
thicknessWhileDragging:
10.0
,
itemBuilder:
(
BuildContext
context
,
int
index
)
{
radius:
const
Radius
.
circular
(
34.0
),
return
Center
(
radiusWhileDragging:
Radius
.
zero
,
child:
Text
(
'item
$index
'
),
child:
ListView
.
builder
(
);
itemCount:
120
,
},
itemBuilder:
(
BuildContext
context
,
int
index
)
{
return
Center
(
child:
Padding
(
padding:
const
EdgeInsets
.
all
(
8.0
),
child:
Text
(
'Item
$index
'
),
),
);
},
),
),
),
);
);
}
}
...
...
examples/api/lib/cupertino/scrollbar/cupertino_scrollbar.1.dart
View file @
803f9959
...
@@ -6,54 +6,55 @@
...
@@ -6,54 +6,55 @@
import
'package:flutter/cupertino.dart'
;
import
'package:flutter/cupertino.dart'
;
import
'package:flutter/material.dart'
;
void
main
(
)
=>
runApp
(
const
ScrollbarApp
())
;
void
main
(
)
=>
runApp
(
const
MyApp
());
class
ScrollbarApp
extends
StatelessWidget
{
const
ScrollbarApp
({
Key
?
key
})
:
super
(
key:
key
);
class
MyApp
extends
StatelessWidget
{
const
MyApp
({
Key
?
key
})
:
super
(
key:
key
);
static
const
String
_title
=
'Flutter Code Sample'
;
@override
@override
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
return
MaterialApp
(
return
const
CupertinoApp
(
title:
_title
,
theme:
CupertinoThemeData
(
brightness:
Brightness
.
light
),
home:
Scaffold
(
home:
ScrollbarExample
(),
appBar:
AppBar
(
title:
const
Text
(
_title
)),
body:
const
MyStatefulWidget
(),
),
);
);
}
}
}
}
class
MyStatefulWidget
extends
StatefulWidget
{
class
ScrollbarExample
extends
StatefulWidget
{
const
MyStatefulWidget
({
Key
?
key
})
:
super
(
key:
key
);
const
ScrollbarExample
({
Key
?
key
})
:
super
(
key:
key
);
@override
@override
State
<
MyStatefulWidget
>
createState
()
=>
_MyStatefulWidget
State
();
State
<
ScrollbarExample
>
createState
()
=>
_ScrollbarExample
State
();
}
}
class
_
MyStatefulWidgetState
extends
State
<
MyStatefulWidget
>
{
class
_
ScrollbarExampleState
extends
State
<
ScrollbarExample
>
{
final
ScrollController
_controllerOne
=
ScrollController
();
final
ScrollController
_controllerOne
=
ScrollController
();
@override
@override
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
return
CupertinoScrollbar
(
return
CupertinoPageScaffold
(
thickness:
6.0
,
navigationBar:
const
CupertinoNavigationBar
(
thicknessWhileDragging:
10.0
,
middle:
Text
(
'CupertinoScrollbar Sample'
),
radius:
const
Radius
.
circular
(
34.0
),
),
radiusWhileDragging:
Radius
.
zero
,
child:
CupertinoScrollbar
(
controller:
_controllerOne
,
thickness:
6.0
,
thumbVisibility:
true
,
thicknessWhileDragging:
10.0
,
child:
ListView
.
builder
(
radius:
const
Radius
.
circular
(
34.0
),
radiusWhileDragging:
Radius
.
zero
,
controller:
_controllerOne
,
controller:
_controllerOne
,
itemCount:
120
,
thumbVisibility:
true
,
itemBuilder:
(
BuildContext
context
,
int
index
)
{
child:
ListView
.
builder
(
return
Center
(
controller:
_controllerOne
,
child:
Text
(
'item
$index
'
),
itemCount:
120
,
);
itemBuilder:
(
BuildContext
context
,
int
index
)
{
},
return
Center
(
child:
Padding
(
padding:
const
EdgeInsets
.
all
(
8.0
),
child:
Text
(
'Item
$index
'
),
),
);
},
),
),
),
);
);
}
}
...
...
examples/api/lib/cupertino/segmented_control/cupertino_segmented_control.0.dart
View file @
803f9959
...
@@ -14,10 +14,10 @@ Map<Sky, Color> skyColors = <Sky, Color> {
...
@@ -14,10 +14,10 @@ Map<Sky, Color> skyColors = <Sky, Color> {
Sky
.
cerulean
:
const
Color
(
0xff007ba7
),
Sky
.
cerulean
:
const
Color
(
0xff007ba7
),
};
};
void
main
(
)
=>
runApp
(
const
SegmentControlApp
());
void
main
(
)
=>
runApp
(
const
Segment
ed
ControlApp
());
class
SegmentControlApp
extends
StatelessWidget
{
class
Segment
ed
ControlApp
extends
StatelessWidget
{
const
SegmentControlApp
({
Key
?
key
})
:
super
(
key:
key
);
const
Segment
ed
ControlApp
({
Key
?
key
})
:
super
(
key:
key
);
@override
@override
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
...
...
examples/api/lib/cupertino/segmented_control/cupertino_sliding_segmented_control.0.dart
View file @
803f9959
...
@@ -14,10 +14,10 @@ Map<Sky, Color> skyColors = <Sky, Color> {
...
@@ -14,10 +14,10 @@ Map<Sky, Color> skyColors = <Sky, Color> {
Sky
.
cerulean
:
const
Color
(
0xff007ba7
),
Sky
.
cerulean
:
const
Color
(
0xff007ba7
),
};
};
void
main
(
)
=>
runApp
(
const
SegmentControlApp
());
void
main
(
)
=>
runApp
(
const
Segment
ed
ControlApp
());
class
SegmentControlApp
extends
StatelessWidget
{
class
Segment
ed
ControlApp
extends
StatelessWidget
{
const
SegmentControlApp
({
Key
?
key
})
:
super
(
key:
key
);
const
Segment
ed
ControlApp
({
Key
?
key
})
:
super
(
key:
key
);
@override
@override
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
...
...
examples/api/lib/cupertino/slider/cupertino_slider.0.dart
View file @
803f9959
...
@@ -34,6 +34,9 @@ class _CupertinoSliderExampleState extends State<CupertinoSliderExample> {
...
@@ -34,6 +34,9 @@ class _CupertinoSliderExampleState extends State<CupertinoSliderExample> {
@override
@override
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
return
CupertinoPageScaffold
(
return
CupertinoPageScaffold
(
navigationBar:
const
CupertinoNavigationBar
(
middle:
Text
(
'CupertinoSlider Sample'
),
),
child:
Center
(
child:
Center
(
child:
Column
(
child:
Column
(
mainAxisSize:
MainAxisSize
.
min
,
mainAxisSize:
MainAxisSize
.
min
,
...
...
examples/api/lib/cupertino/text_field/cupertino_text_field.0.dart
View file @
803f9959
...
@@ -45,6 +45,9 @@ class _CupertinoTextFieldExampleState extends State<CupertinoTextFieldExample> {
...
@@ -45,6 +45,9 @@ class _CupertinoTextFieldExampleState extends State<CupertinoTextFieldExample> {
@override
@override
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
return
CupertinoPageScaffold
(
return
CupertinoPageScaffold
(
navigationBar:
const
CupertinoNavigationBar
(
middle:
Text
(
'CupertinoTextField Sample'
),
),
child:
Center
(
child:
Center
(
child:
CupertinoTextField
(
child:
CupertinoTextField
(
controller:
_textController
,
controller:
_textController
,
...
...
examples/api/lib/cupertino/text_form_field_row/cupertino_text_form_field_row.1.dart
View file @
803f9959
...
@@ -6,36 +6,31 @@
...
@@ -6,36 +6,31 @@
import
'package:flutter/cupertino.dart'
;
import
'package:flutter/cupertino.dart'
;
import
'package:flutter/material.dart'
;
void
main
(
)
=>
runApp
(
const
FormSectionApp
())
;
void
main
(
)
=>
runApp
(
const
MyApp
());
class
FormSectionApp
extends
StatelessWidget
{
const
FormSectionApp
({
Key
?
key
})
:
super
(
key:
key
);
class
MyApp
extends
StatelessWidget
{
const
MyApp
({
Key
?
key
})
:
super
(
key:
key
);
static
const
String
_title
=
'Flutter Code Sample'
;
@override
@override
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
return
const
Material
App
(
return
const
Cupertino
App
(
t
itle:
_title
,
t
heme:
CupertinoThemeData
(
brightness:
Brightness
.
light
)
,
home:
MyStatefulWidget
(),
home:
FromSectionExample
(),
);
);
}
}
}
}
class
MyStatefulWidget
extends
StatefulWidget
{
class
FromSectionExample
extends
StatelessWidget
{
const
MyStatefulWidget
({
Key
?
key
})
:
super
(
key:
key
);
const
FromSectionExample
({
Key
?
key
})
:
super
(
key:
key
);
@override
State
<
MyStatefulWidget
>
createState
()
=>
_MyStatefulWidgetState
();
}
class
_MyStatefulWidgetState
extends
State
<
MyStatefulWidget
>
{
@override
@override
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
return
CupertinoPageScaffold
(
return
CupertinoPageScaffold
(
child:
Center
(
navigationBar:
const
CupertinoNavigationBar
(
middle:
Text
(
'CupertinoFormSection Sample'
),
),
// Add safe area widget to place the CupertinoFormSection below the navigation bar.
child:
SafeArea
(
child:
Form
(
child:
Form
(
autovalidateMode:
AutovalidateMode
.
always
,
autovalidateMode:
AutovalidateMode
.
always
,
onChanged:
()
{
onChanged:
()
{
...
...
examples/api/test/cupertino/context_menu/cupertino_context_menu.0_test.dart
0 → 100644
View file @
803f9959
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import
'package:flutter/material.dart'
;
import
'package:flutter_api_samples/cupertino/context_menu/cupertino_context_menu.0.dart'
as
example
;
import
'package:flutter_test/flutter_test.dart'
;
void
main
(
)
{
testWidgets
(
'Can open cupertino context menu'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
const
example
.
ContextMenuApp
(),
);
final
Offset
logo
=
tester
.
getCenter
(
find
.
byType
(
FlutterLogo
));
expect
(
find
.
text
(
'Favorite'
),
findsNothing
);
await
tester
.
startGesture
(
logo
);
await
tester
.
pumpAndSettle
();
expect
(
find
.
text
(
'Favorite'
),
findsOneWidget
);
await
tester
.
tap
(
find
.
text
(
'Favorite'
));
await
tester
.
pumpAndSettle
();
expect
(
find
.
text
(
'Favorite'
),
findsNothing
);
});
}
examples/api/test/cupertino/nav_bar/cupertino_sliver_nav_bar.0_test.dart
View file @
803f9959
...
@@ -9,7 +9,7 @@ import 'package:flutter_test/flutter_test.dart';
...
@@ -9,7 +9,7 @@ import 'package:flutter_test/flutter_test.dart';
const
Offset
dragUp
=
Offset
(
0.0
,
-
150.0
);
const
Offset
dragUp
=
Offset
(
0.0
,
-
150.0
);
void
main
(
)
{
void
main
(
)
{
testWidgets
(
'Collapse and expand CupertinoSliverNavigationBar changes title position'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'Collapse and expand CupertinoSliverNavigationBar changes title position'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
const
example
.
SliverNavBarApp
(),
const
example
.
SliverNavBarApp
(),
);
);
...
@@ -23,7 +23,7 @@ void main() {
...
@@ -23,7 +23,7 @@ void main() {
expect
(
tester
.
getBottomLeft
(
find
.
text
(
'Contacts'
).
first
).
dy
,
36.0
);
expect
(
tester
.
getBottomLeft
(
find
.
text
(
'Contacts'
).
first
).
dy
,
36.0
);
});
});
testWidgets
(
'Middle widget is visible in both collapsed and expanded states'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'Middle widget is visible in both collapsed and expanded states'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
const
example
.
SliverNavBarApp
(),
const
example
.
SliverNavBarApp
(),
);
);
...
@@ -46,7 +46,7 @@ void main() {
...
@@ -46,7 +46,7 @@ void main() {
expect
(
tester
.
getBottomLeft
(
find
.
text
(
'Family'
).
first
).
dy
,
36.0
);
expect
(
tester
.
getBottomLeft
(
find
.
text
(
'Family'
).
first
).
dy
,
36.0
);
});
});
testWidgets
(
'CupertinoSliverNavigationBar with previous route has back button'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'CupertinoSliverNavigationBar with previous route has back button'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
const
example
.
SliverNavBarApp
(),
const
example
.
SliverNavBarApp
(),
);
);
...
...
examples/api/test/cupertino/page_scaffold/cupertino_page_scaffold.0_test.dart
0 → 100644
View file @
803f9959
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import
'package:flutter/cupertino.dart'
;
import
'package:flutter_api_samples/cupertino/page_scaffold/cupertino_page_scaffold.0.dart'
as
example
;
import
'package:flutter_test/flutter_test.dart'
;
void
main
(
)
{
testWidgets
(
'Can increment counter'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
const
example
.
PageScaffoldApp
(),
);
expect
(
find
.
byType
(
CupertinoPageScaffold
),
findsOneWidget
);
expect
(
find
.
text
(
'You have pressed the button 0 times.'
),
findsOneWidget
);
await
tester
.
tap
(
find
.
byType
(
CupertinoButton
));
await
tester
.
pumpAndSettle
();
expect
(
find
.
text
(
'You have pressed the button 1 times.'
),
findsOneWidget
);
});
}
examples/api/test/cupertino/refresh/cupertino_sliver_refresh_control.0_test.dart
0 → 100644
View file @
803f9959
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import
'package:flutter/cupertino.dart'
;
import
'package:flutter_api_samples/cupertino/refresh/cupertino_sliver_refresh_control.0.dart'
as
example
;
import
'package:flutter_test/flutter_test.dart'
;
void
main
(
)
{
testWidgets
(
'Can pull down to reveal CupertinoSliverRefreshControl'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
const
example
.
RefreshControlApp
(),
);
expect
(
find
.
byType
(
CupertinoSliverRefreshControl
),
findsNothing
);
expect
(
find
.
byType
(
Container
),
findsNWidgets
(
3
));
final
Finder
firstItem
=
find
.
byType
(
Container
).
first
;
await
tester
.
drag
(
firstItem
,
const
Offset
(
0.0
,
150.0
),
touchSlopY:
0
);
await
tester
.
pump
();
expect
(
find
.
byType
(
CupertinoSliverRefreshControl
),
findsOneWidget
);
await
tester
.
pumpAndSettle
();
expect
(
find
.
byType
(
CupertinoSliverRefreshControl
),
findsNothing
);
expect
(
find
.
byType
(
Container
),
findsNWidgets
(
4
));
});
}
examples/api/test/cupertino/route/show_cupertino_dialog.0_test.dart
0 → 100644
View file @
803f9959
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import
'package:flutter/cupertino.dart'
;
import
'package:flutter_api_samples/cupertino/route/show_cupertino_dialog.0.dart'
as
example
;
import
'package:flutter_test/flutter_test.dart'
;
void
main
(
)
{
testWidgets
(
'Tap on button displays cupertino dialog'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
const
example
.
CupertinoDialogApp
(),
);
final
Finder
dialogTitle
=
find
.
text
(
'Title'
);
expect
(
dialogTitle
,
findsNothing
);
await
tester
.
tap
(
find
.
byType
(
CupertinoButton
));
await
tester
.
pumpAndSettle
();
expect
(
dialogTitle
,
findsOneWidget
);
await
tester
.
tap
(
find
.
text
(
'Yes'
));
await
tester
.
pumpAndSettle
();
expect
(
dialogTitle
,
findsNothing
);
});
}
examples/api/test/cupertino/route/show_cupertino_modal_popup.0_test.dart
0 → 100644
View file @
803f9959
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import
'package:flutter/cupertino.dart'
;
import
'package:flutter_api_samples/cupertino/route/show_cupertino_modal_popup.0.dart'
as
example
;
import
'package:flutter_test/flutter_test.dart'
;
void
main
(
)
{
testWidgets
(
'Tap on button displays cupertino modal dialog'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
const
example
.
ModalPopupApp
(),
);
final
Finder
actionOne
=
find
.
text
(
'Action One'
);
expect
(
actionOne
,
findsNothing
);
await
tester
.
tap
(
find
.
byType
(
CupertinoButton
));
await
tester
.
pumpAndSettle
();
expect
(
actionOne
,
findsOneWidget
);
await
tester
.
tap
(
find
.
text
(
'Action One'
));
await
tester
.
pumpAndSettle
();
expect
(
actionOne
,
findsNothing
);
});
}
examples/api/test/cupertino/scrollbar/cupertino_scrollbar.0_test.dart
0 → 100644
View file @
803f9959
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import
'package:flutter/cupertino.dart'
;
import
'package:flutter_api_samples/cupertino/scrollbar/cupertino_scrollbar.0.dart'
as
example
;
import
'package:flutter_test/flutter_test.dart'
;
void
main
(
)
{
testWidgets
(
'List view displays CupertinoScrollbar'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
const
example
.
ScrollbarApp
(),
);
expect
(
find
.
text
(
'Item 0'
),
findsOneWidget
);
final
TestGesture
gesture
=
await
tester
.
startGesture
(
tester
.
getCenter
(
find
.
byType
(
ListView
)));
await
gesture
.
moveBy
(
const
Offset
(
0.0
,
-
100.0
));
await
tester
.
pumpAndSettle
();
expect
(
find
.
text
(
'Item 0'
),
findsNothing
);
final
Finder
scrollbar
=
find
.
byType
(
CupertinoScrollbar
);
expect
(
scrollbar
,
findsOneWidget
);
expect
(
tester
.
getTopLeft
(
scrollbar
).
dy
,
0.0
);
expect
(
tester
.
getBottomLeft
(
scrollbar
).
dy
,
600.0
);
});
}
examples/api/test/cupertino/scrollbar/cupertino_scrollbar.1_test.dart
0 → 100644
View file @
803f9959
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import
'package:flutter/cupertino.dart'
;
import
'package:flutter_api_samples/cupertino/scrollbar/cupertino_scrollbar.1.dart'
as
example
;
import
'package:flutter_test/flutter_test.dart'
;
void
main
(
)
{
testWidgets
(
'List view displays CupertinoScrollbar'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
const
example
.
ScrollbarApp
(),
);
expect
(
find
.
text
(
'Item 0'
),
findsOneWidget
);
final
TestGesture
gesture
=
await
tester
.
startGesture
(
tester
.
getCenter
(
find
.
byType
(
ListView
)));
await
gesture
.
moveBy
(
const
Offset
(
0.0
,
-
100.0
));
await
tester
.
pumpAndSettle
();
expect
(
find
.
text
(
'Item 0'
),
findsNothing
);
final
Finder
scrollbar
=
find
.
byType
(
CupertinoScrollbar
);
expect
(
scrollbar
,
findsOneWidget
);
expect
(
tester
.
getTopLeft
(
scrollbar
).
dy
,
0.0
);
expect
(
tester
.
getBottomLeft
(
scrollbar
).
dy
,
600.0
);
});
}
examples/api/test/cupertino/segmented_control/cupertino_segmented_control.0_test.dart
View file @
803f9959
...
@@ -8,7 +8,7 @@ import 'package:flutter_test/flutter_test.dart';
...
@@ -8,7 +8,7 @@ import 'package:flutter_test/flutter_test.dart';
void
main
(
)
{
void
main
(
)
{
testWidgets
(
'Can change a selected segmented control'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'Can change a selected segmented control'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
const
example
.
SegmentControlApp
(),
const
example
.
Segment
ed
ControlApp
(),
);
);
expect
(
find
.
text
(
'Selected Segment: midnight'
),
findsOneWidget
);
expect
(
find
.
text
(
'Selected Segment: midnight'
),
findsOneWidget
);
...
...
examples/api/test/cupertino/segmented_control/cupertino_sliding_segmented_control.0_test.dart
View file @
803f9959
...
@@ -8,7 +8,7 @@ import 'package:flutter_test/flutter_test.dart';
...
@@ -8,7 +8,7 @@ import 'package:flutter_test/flutter_test.dart';
void
main
(
)
{
void
main
(
)
{
testWidgets
(
'Can change a selected segmented control'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'Can change a selected segmented control'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
const
example
.
SegmentControlApp
(),
const
example
.
Segment
ed
ControlApp
(),
);
);
expect
(
find
.
text
(
'Selected Segment: midnight'
),
findsOneWidget
);
expect
(
find
.
text
(
'Selected Segment: midnight'
),
findsOneWidget
);
...
...
examples/api/test/cupertino/text_form_field_row/cupertino_text_form_field_row.1_test.dart
0 → 100644
View file @
803f9959
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import
'package:flutter/cupertino.dart'
;
import
'package:flutter_api_samples/cupertino/text_form_field_row/cupertino_text_form_field_row.1.dart'
as
example
;
import
'package:flutter_test/flutter_test.dart'
;
void
main
(
)
{
testWidgets
(
'Can enter text in CupertinoTextFormFieldRow'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
const
example
.
FormSectionApp
(),
);
expect
(
find
.
byType
(
CupertinoFormSection
),
findsOneWidget
);
expect
(
find
.
byType
(
CupertinoTextFormFieldRow
),
findsNWidgets
(
5
));
expect
(
find
.
widgetWithText
(
CupertinoTextFormFieldRow
,
'abcd'
),
findsNothing
);
await
tester
.
enterText
(
find
.
byType
(
CupertinoTextFormFieldRow
).
first
,
'abcd'
);
await
tester
.
pump
();
expect
(
find
.
widgetWithText
(
CupertinoTextFormFieldRow
,
'abcd'
),
findsOneWidget
);
});
}
packages/flutter/lib/src/cupertino/route.dart
View file @
803f9959
...
@@ -1143,7 +1143,7 @@ class CupertinoModalPopupRoute<T> extends PopupRoute<T> {
...
@@ -1143,7 +1143,7 @@ class CupertinoModalPopupRoute<T> extends PopupRoute<T> {
///
///
/// For more information about state restoration, see [RestorationManager].
/// For more information about state restoration, see [RestorationManager].
///
///
/// {@tool
sample
}
/// {@tool
dartpad
}
/// This sample demonstrates how to create a restorable Cupertino modal route.
/// This sample demonstrates how to create a restorable Cupertino modal route.
/// This is accomplished by enabling state restoration by specifying
/// This is accomplished by enabling state restoration by specifying
/// [CupertinoApp.restorationScopeId] and using [Navigator.restorablePush] to
/// [CupertinoApp.restorationScopeId] and using [Navigator.restorablePush] to
...
@@ -1249,7 +1249,7 @@ Widget _buildCupertinoDialogTransitions(BuildContext context, Animation<double>
...
@@ -1249,7 +1249,7 @@ Widget _buildCupertinoDialogTransitions(BuildContext context, Animation<double>
///
///
/// For more information about state restoration, see [RestorationManager].
/// For more information about state restoration, see [RestorationManager].
///
///
/// {@tool
sample
}
/// {@tool
dartpad
}
/// This sample demonstrates how to create a restorable Cupertino dialog. This is
/// This sample demonstrates how to create a restorable Cupertino dialog. This is
/// accomplished by enabling state restoration by specifying
/// accomplished by enabling state restoration by specifying
/// [CupertinoApp.restorationScopeId] and using [Navigator.restorablePush] to
/// [CupertinoApp.restorationScopeId] and using [Navigator.restorablePush] to
...
...
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