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
d80f3e39
Unverified
Commit
d80f3e39
authored
May 05, 2022
by
Taha Tesser
Committed by
GitHub
May 05, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cupertino examples improvements and clean up (#103044)
parent
27fee486
Changes
27
Hide whitespace changes
Inline
Side-by-side
Showing
27 changed files
with
219 additions
and
202 deletions
+219
-202
cupertino_tab_bar.0.dart
...api/lib/cupertino/bottom_tab_bar/cupertino_tab_bar.0.dart
+19
-18
cupertino_button.0.dart
examples/api/lib/cupertino/button/cupertino_button.0.dart
+33
-33
cupertino_date_picker.0.dart
...pi/lib/cupertino/date_picker/cupertino_date_picker.0.dart
+9
-11
cupertino_timer_picker.0.dart
...i/lib/cupertino/date_picker/cupertino_timer_picker.0.dart
+9
-11
cupertino_action_sheet.0.dart
...es/api/lib/cupertino/dialog/cupertino_action_sheet.0.dart
+9
-13
cupertino_alert_dialog.0.dart
...es/api/lib/cupertino/dialog/cupertino_alert_dialog.0.dart
+9
-13
cupertino_navigation_bar.0.dart
...api/lib/cupertino/nav_bar/cupertino_navigation_bar.0.dart
+10
-12
cupertino_sliver_nav_bar.0.dart
...api/lib/cupertino/nav_bar/cupertino_sliver_nav_bar.0.dart
+7
-9
cupertino_picker.0.dart
examples/api/lib/cupertino/picker/cupertino_picker.0.dart
+9
-12
cupertino_segmented_control.0.dart
...tino/segmented_control/cupertino_segmented_control.0.dart
+12
-23
cupertino_sliding_segmented_control.0.dart
...mented_control/cupertino_sliding_segmented_control.0.dart
+9
-11
cupertino_slider.0.dart
examples/api/lib/cupertino/slider/cupertino_slider.0.dart
+9
-11
cupertino_text_field.0.dart
.../api/lib/cupertino/text_field/cupertino_text_field.0.dart
+9
-11
cupertino_tab_bar.0_test.dart
...st/cupertino/bottom_tab_bar/cupertino_tab_bar.0_test.dart
+23
-0
cupertino_button.0_test.dart
...es/api/test/cupertino/button/cupertino_button.0_test.dart
+1
-1
cupertino_date_picker.0_test.dart
...t/cupertino/date_picker/cupertino_date_picker.0_test.dart
+1
-1
cupertino_timer_picker.0_test.dart
.../cupertino/date_picker/cupertino_timer_picker.0_test.dart
+1
-1
cupertino_action_sheet.0_test.dart
.../test/cupertino/dialog/cupertino_action_sheet.0_test.dart
+1
-1
cupertino_alert_dialog.0_test.dart
.../test/cupertino/dialog/cupertino_alert_dialog.0_test.dart
+1
-1
cupertino_navigation_bar.0_test.dart
...st/cupertino/nav_bar/cupertino_navigation_bar.0_test.dart
+20
-0
cupertino_sliver_nav_bar.0_test.dart
...st/cupertino/nav_bar/cupertino_sliver_nav_bar.0_test.dart
+3
-3
cupertino_picker.0_test.dart
...es/api/test/cupertino/picker/cupertino_picker.0_test.dart
+1
-1
cupertino_segmented_control.0_test.dart
...segmented_control/cupertino_segmented_control.0_test.dart
+3
-1
cupertino_sliding_segmented_control.0_test.dart
...d_control/cupertino_sliding_segmented_control.0_test.dart
+1
-1
cupertino_slider.0_test.dart
...es/api/test/cupertino/slider/cupertino_slider.0_test.dart
+1
-1
cupertino_text_field.0.dart
...api/test/cupertino/text_field/cupertino_text_field.0.dart
+8
-1
bottom_tab_bar.dart
packages/flutter/lib/src/cupertino/bottom_tab_bar.dart
+1
-1
No files found.
examples/api/lib/cupertino/bottom_tab_bar/
bottom
_tab_bar.0.dart
→
examples/api/lib/cupertino/bottom_tab_bar/
cupertino
_tab_bar.0.dart
View file @
d80f3e39
...
...
@@ -6,42 +6,43 @@
import
'package:flutter/cupertino.dart'
;
void
main
(
)
=>
runApp
(
const
My
App
());
void
main
(
)
=>
runApp
(
const
CupertinoTabBar
App
());
class
MyApp
extends
StatelessWidget
{
const
MyApp
({
Key
?
key
})
:
super
(
key:
key
);
static
const
String
_title
=
'Flutter Code Sample'
;
class
CupertinoTabBarApp
extends
StatelessWidget
{
const
CupertinoTabBarApp
({
Key
?
key
})
:
super
(
key:
key
);
@override
Widget
build
(
BuildContext
context
)
{
return
const
CupertinoApp
(
t
itle:
_title
,
home:
MyStatefulWidget
(),
t
heme:
CupertinoThemeData
(
brightness:
Brightness
.
light
)
,
home:
CupertinoTabBarExample
(),
);
}
}
class
MyStatefulWidget
extends
StatefulWidget
{
const
MyStatefulWidget
({
Key
?
key
})
:
super
(
key:
key
);
@override
State
<
MyStatefulWidget
>
createState
()
=>
_MyStatefulWidgetState
();
}
class
CupertinoTabBarExample
extends
StatelessWidget
{
const
CupertinoTabBarExample
({
Key
?
key
})
:
super
(
key:
key
);
class
_MyStatefulWidgetState
extends
State
<
MyStatefulWidget
>
{
@override
Widget
build
(
BuildContext
context
)
{
return
CupertinoTabScaffold
(
tabBar:
CupertinoTabBar
(
items:
const
<
BottomNavigationBarItem
>[
BottomNavigationBarItem
(
icon:
Icon
(
CupertinoIcons
.
circle
),
label:
'Tab 1'
,
icon:
Icon
(
CupertinoIcons
.
star_fill
),
label:
'Favourites'
,
),
BottomNavigationBarItem
(
icon:
Icon
(
CupertinoIcons
.
clock_solid
),
label:
'Recents'
,
),
BottomNavigationBarItem
(
icon:
Icon
(
CupertinoIcons
.
person_alt_circle_fill
),
label:
'Contacts'
,
),
BottomNavigationBarItem
(
icon:
Icon
(
CupertinoIcons
.
add
),
label:
'
Tab 2
'
,
icon:
Icon
(
CupertinoIcons
.
circle_grid_3x3_fill
),
label:
'
Keypad
'
,
),
],
),
...
...
examples/api/lib/cupertino/button/cupertino_button.0.dart
View file @
d80f3e39
...
...
@@ -6,51 +6,51 @@
import
'package:flutter/cupertino.dart'
;
void
main
(
)
=>
runApp
(
const
My
App
());
void
main
(
)
=>
runApp
(
const
CupertinoButton
App
());
class
MyApp
extends
StatelessWidget
{
const
MyApp
({
Key
?
key
})
:
super
(
key:
key
);
static
const
String
_title
=
'Flutter Code Sample'
;
class
CupertinoButtonApp
extends
StatelessWidget
{
const
CupertinoButtonApp
({
Key
?
key
})
:
super
(
key:
key
);
@override
Widget
build
(
BuildContext
context
)
{
return
const
CupertinoApp
(
t
itle:
_title
,
home:
MyStatelessWidget
(),
t
heme:
CupertinoThemeData
(
brightness:
Brightness
.
light
)
,
home:
CupertinoButtonExample
(),
);
}
}
class
MyStatelessWidget
extends
StatelessWidget
{
const
MyStatelessWidget
({
Key
?
key
})
:
super
(
key:
key
);
class
CupertinoButtonExample
extends
StatelessWidget
{
const
CupertinoButtonExample
({
Key
?
key
})
:
super
(
key:
key
);
@override
Widget
build
(
BuildContext
context
)
{
return
Center
(
child:
Column
(
mainAxisSize:
MainAxisSize
.
min
,
children:
<
Widget
>[
const
CupertinoButton
(
onPressed:
null
,
child:
Text
(
'Disabled'
),
),
const
SizedBox
(
height:
30
),
const
CupertinoButton
.
filled
(
onPressed:
null
,
child:
Text
(
'Disabled'
),
),
const
SizedBox
(
height:
30
),
CupertinoButton
(
onPressed:
()
{},
child:
const
Text
(
'Enabled'
),
),
const
SizedBox
(
height:
30
),
CupertinoButton
.
filled
(
onPressed:
()
{},
child:
const
Text
(
'Enabled'
),
),
],
return
CupertinoPageScaffold
(
child:
Center
(
child:
Column
(
mainAxisSize:
MainAxisSize
.
min
,
children:
<
Widget
>[
const
CupertinoButton
(
onPressed:
null
,
child:
Text
(
'Disabled'
),
),
const
SizedBox
(
height:
30
),
const
CupertinoButton
.
filled
(
onPressed:
null
,
child:
Text
(
'Disabled'
),
),
const
SizedBox
(
height:
30
),
CupertinoButton
(
onPressed:
()
{},
child:
const
Text
(
'Enabled'
),
),
const
SizedBox
(
height:
30
),
CupertinoButton
.
filled
(
onPressed:
()
{},
child:
const
Text
(
'Enabled'
),
),
],
),
),
);
}
...
...
examples/api/lib/cupertino/date_picker/cupertino_date_picker.0.dart
View file @
d80f3e39
...
...
@@ -6,30 +6,28 @@
import
'package:flutter/cupertino.dart'
;
void
main
(
)
=>
runApp
(
const
My
App
());
void
main
(
)
=>
runApp
(
const
DatePicker
App
());
class
MyApp
extends
StatelessWidget
{
const
MyApp
({
Key
?
key
})
:
super
(
key:
key
);
static
const
String
_title
=
'Flutter Code Sample'
;
class
DatePickerApp
extends
StatelessWidget
{
const
DatePickerApp
({
Key
?
key
})
:
super
(
key:
key
);
@override
Widget
build
(
BuildContext
context
)
{
return
const
CupertinoApp
(
t
itle:
_title
,
home:
MyStatelessWidget
(),
t
heme:
CupertinoThemeData
(
brightness:
Brightness
.
light
)
,
home:
DatePickerExample
(),
);
}
}
class
MyStatelessWidget
extends
StatefulWidget
{
const
MyStatelessWidget
({
Key
?
key
})
:
super
(
key:
key
);
class
DatePickerExample
extends
StatefulWidget
{
const
DatePickerExample
({
Key
?
key
})
:
super
(
key:
key
);
@override
State
<
MyStatelessWidget
>
createState
()
=>
_MyStatelessWidget
State
();
State
<
DatePickerExample
>
createState
()
=>
_DatePickerExample
State
();
}
class
_
MyStatelessWidgetState
extends
State
<
MyStatelessWidget
>
{
class
_
DatePickerExampleState
extends
State
<
DatePickerExample
>
{
DateTime
date
=
DateTime
(
2016
,
10
,
26
);
DateTime
time
=
DateTime
(
2016
,
5
,
10
,
22
,
35
);
DateTime
dateTime
=
DateTime
(
2016
,
8
,
3
,
17
,
45
);
...
...
examples/api/lib/cupertino/date_picker/cupertino_timer_picker.0.dart
View file @
d80f3e39
...
...
@@ -6,30 +6,28 @@
import
'package:flutter/cupertino.dart'
;
void
main
(
)
=>
runApp
(
const
My
App
());
void
main
(
)
=>
runApp
(
const
TimerPicker
App
());
class
MyApp
extends
StatelessWidget
{
const
MyApp
({
Key
?
key
})
:
super
(
key:
key
);
static
const
String
_title
=
'CupertinoTimerPicker Sample'
;
class
TimerPickerApp
extends
StatelessWidget
{
const
TimerPickerApp
({
Key
?
key
})
:
super
(
key:
key
);
@override
Widget
build
(
BuildContext
context
)
{
return
const
CupertinoApp
(
t
itle:
_title
,
home:
CupertinoTimerPickerS
ample
(),
t
heme:
CupertinoThemeData
(
brightness:
Brightness
.
light
)
,
home:
TimerPickerEx
ample
(),
);
}
}
class
CupertinoTimerPickerS
ample
extends
StatefulWidget
{
const
CupertinoTimerPickerS
ample
({
Key
?
key
})
:
super
(
key:
key
);
class
TimerPickerEx
ample
extends
StatefulWidget
{
const
TimerPickerEx
ample
({
Key
?
key
})
:
super
(
key:
key
);
@override
State
<
CupertinoTimerPickerSample
>
createState
()
=>
_CupertinoTimerPickerS
ampleState
();
State
<
TimerPickerExample
>
createState
()
=>
_TimerPickerEx
ampleState
();
}
class
_
CupertinoTimerPickerSampleState
extends
State
<
CupertinoTimerPickerS
ample
>
{
class
_
TimerPickerExampleState
extends
State
<
TimerPickerEx
ample
>
{
Duration
duration
=
const
Duration
(
hours:
1
,
minutes:
23
);
// This shows a CupertinoModalPopup with a reasonable fixed height which hosts CupertinoTimerPicker.
...
...
examples/api/lib/cupertino/dialog/cupertino_action_sheet.0.dart
View file @
d80f3e39
...
...
@@ -6,26 +6,22 @@
import
'package:flutter/cupertino.dart'
;
void
main
(
)
=>
runApp
(
const
My
App
());
void
main
(
)
=>
runApp
(
const
ActionSheet
App
());
class
MyApp
extends
StatelessWidget
{
const
MyApp
({
Key
?
key
})
:
super
(
key:
key
);
static
const
String
_title
=
'CupertinoActionSheet Sample'
;
class
ActionSheetApp
extends
StatelessWidget
{
const
ActionSheetApp
({
Key
?
key
})
:
super
(
key:
key
);
@override
Widget
build
(
BuildContext
context
)
{
return
const
CupertinoApp
(
t
itle:
_title
,
home:
ActionSheet
Sample
(
title:
_title
),
t
heme:
CupertinoThemeData
(
brightness:
Brightness
.
light
)
,
home:
ActionSheet
Example
(
),
);
}
}
class
ActionSheetSample
extends
StatelessWidget
{
const
ActionSheetSample
({
Key
?
key
,
required
this
.
title
})
:
super
(
key:
key
);
final
String
title
;
class
ActionSheetExample
extends
StatelessWidget
{
const
ActionSheetExample
({
Key
?
key
})
:
super
(
key:
key
);
// This shows a CupertinoModalPopup which hosts a CupertinoActionSheet.
void
_showActionSheet
(
BuildContext
context
)
{
...
...
@@ -68,8 +64,8 @@ class ActionSheetSample extends StatelessWidget {
@override
Widget
build
(
BuildContext
context
)
{
return
CupertinoPageScaffold
(
navigationBar:
CupertinoNavigationBar
(
middle:
Text
(
title
),
navigationBar:
const
CupertinoNavigationBar
(
middle:
Text
(
'CupertinoActionSheet Sample'
),
),
child:
Center
(
child:
CupertinoButton
(
...
...
examples/api/lib/cupertino/dialog/cupertino_alert_dialog.0.dart
View file @
d80f3e39
...
...
@@ -6,26 +6,22 @@
import
'package:flutter/cupertino.dart'
;
void
main
(
)
=>
runApp
(
const
My
App
());
void
main
(
)
=>
runApp
(
const
AlertDialog
App
());
class
MyApp
extends
StatelessWidget
{
const
MyApp
({
Key
?
key
})
:
super
(
key:
key
);
static
const
String
_title
=
'CupertinoAlertDialog Sample'
;
class
AlertDialogApp
extends
StatelessWidget
{
const
AlertDialogApp
({
Key
?
key
})
:
super
(
key:
key
);
@override
Widget
build
(
BuildContext
context
)
{
return
const
CupertinoApp
(
t
itle:
_title
,
home:
A
ctionSheetSample
(
title:
_title
),
t
heme:
CupertinoThemeData
(
brightness:
Brightness
.
light
)
,
home:
A
lertDialogExample
(
),
);
}
}
class
ActionSheetSample
extends
StatelessWidget
{
const
ActionSheetSample
({
Key
?
key
,
required
this
.
title
})
:
super
(
key:
key
);
final
String
title
;
class
AlertDialogExample
extends
StatelessWidget
{
const
AlertDialogExample
({
Key
?
key
})
:
super
(
key:
key
);
// This shows a CupertinoModalPopup which hosts a CupertinoAlertDialog.
void
_showAlertDialog
(
BuildContext
context
)
{
...
...
@@ -62,8 +58,8 @@ class ActionSheetSample extends StatelessWidget {
@override
Widget
build
(
BuildContext
context
)
{
return
CupertinoPageScaffold
(
navigationBar:
CupertinoNavigationBar
(
middle:
Text
(
title
),
navigationBar:
const
CupertinoNavigationBar
(
middle:
Text
(
'CupertinoAlertDialog Sample'
),
),
child:
Center
(
child:
CupertinoButton
(
...
...
examples/api/lib/cupertino/nav_bar/cupertino_navigation_bar.0.dart
View file @
d80f3e39
...
...
@@ -6,37 +6,35 @@
import
'package:flutter/cupertino.dart'
;
void
main
(
)
=>
runApp
(
const
My
App
());
void
main
(
)
=>
runApp
(
const
NavBar
App
());
class
MyApp
extends
StatelessWidget
{
const
MyApp
({
Key
?
key
})
:
super
(
key:
key
);
static
const
String
_title
=
'Flutter Code Sample'
;
class
NavBarApp
extends
StatelessWidget
{
const
NavBarApp
({
Key
?
key
})
:
super
(
key:
key
);
@override
Widget
build
(
BuildContext
context
)
{
return
const
CupertinoApp
(
t
itle:
_title
,
home:
MyStatefulWidget
(),
t
heme:
CupertinoThemeData
(
brightness:
Brightness
.
light
)
,
home:
NavBarExample
(),
);
}
}
class
MyStatefulWidget
extends
StatefulWidget
{
const
MyStatefulWidget
({
Key
?
key
})
:
super
(
key:
key
);
class
NavBarExample
extends
StatefulWidget
{
const
NavBarExample
({
Key
?
key
})
:
super
(
key:
key
);
@override
State
<
MyStatefulWidget
>
createState
()
=>
_MyStatefulWidget
State
();
State
<
NavBarExample
>
createState
()
=>
_NavBarExample
State
();
}
class
_
MyStatefulWidgetState
extends
State
<
MyStatefulWidget
>
{
class
_
NavBarExampleState
extends
State
<
NavBarExample
>
{
@override
Widget
build
(
BuildContext
context
)
{
return
CupertinoPageScaffold
(
navigationBar:
CupertinoNavigationBar
(
// Try removing opacity to observe the lack of a blur effect and of sliding content.
backgroundColor:
CupertinoColors
.
systemGrey
.
withOpacity
(
0.5
),
middle:
const
Text
(
'
Sample Cod
e'
),
middle:
const
Text
(
'
CupertinoNavigationBar Sampl
e'
),
),
child:
Column
(
children:
<
Widget
>[
...
...
examples/api/lib/cupertino/nav_bar/cupertino_sliver_nav_bar.0.dart
View file @
d80f3e39
...
...
@@ -6,24 +6,22 @@
import
'package:flutter/cupertino.dart'
;
void
main
(
)
=>
runApp
(
const
My
App
());
void
main
(
)
=>
runApp
(
const
SliverNavBar
App
());
class
MyApp
extends
StatelessWidget
{
const
MyApp
({
Key
?
key
})
:
super
(
key:
key
);
static
const
String
_title
=
'CupertinoSliverNavigationBar Sample'
;
class
SliverNavBarApp
extends
StatelessWidget
{
const
SliverNavBarApp
({
Key
?
key
})
:
super
(
key:
key
);
@override
Widget
build
(
BuildContext
context
)
{
return
const
CupertinoApp
(
t
itle:
_title
,
home:
CupertinoNavBarS
ample
(),
t
heme:
CupertinoThemeData
(
brightness:
Brightness
.
light
)
,
home:
SliverNavBarEx
ample
(),
);
}
}
class
CupertinoNavBarS
ample
extends
StatelessWidget
{
const
CupertinoNavBarS
ample
({
Key
?
key
})
:
super
(
key:
key
);
class
SliverNavBarEx
ample
extends
StatelessWidget
{
const
SliverNavBarEx
ample
({
Key
?
key
})
:
super
(
key:
key
);
@override
Widget
build
(
BuildContext
context
)
{
...
...
examples/api/lib/cupertino/picker/cupertino_picker.0.dart
View file @
d80f3e39
...
...
@@ -16,30 +16,27 @@ const List<String> _fruitNames = <String>[
'Strawberry'
,
];
void
main
(
)
=>
runApp
(
const
My
App
());
void
main
(
)
=>
runApp
(
const
CupertinoPicker
App
());
class
MyApp
extends
StatelessWidget
{
const
MyApp
({
Key
?
key
})
:
super
(
key:
key
);
static
const
String
_title
=
'Flutter Code Sample'
;
class
CupertinoPickerApp
extends
StatelessWidget
{
const
CupertinoPickerApp
({
Key
?
key
})
:
super
(
key:
key
);
@override
Widget
build
(
BuildContext
context
)
{
return
const
CupertinoApp
(
t
itle:
_title
,
home:
CupertinoPicker
S
ample
(),
t
heme:
CupertinoThemeData
(
brightness:
Brightness
.
light
)
,
home:
CupertinoPicker
Ex
ample
(),
);
}
}
class
CupertinoPickerSample
extends
StatefulWidget
{
const
CupertinoPickerSample
({
Key
?
key
})
:
super
(
key:
key
);
class
CupertinoPickerExample
extends
StatefulWidget
{
const
CupertinoPickerExample
({
Key
?
key
})
:
super
(
key:
key
);
@override
State
<
CupertinoPicker
Sample
>
createState
()
=>
_CupertinoPickerS
ampleState
();
State
<
CupertinoPicker
Example
>
createState
()
=>
_CupertinoPickerEx
ampleState
();
}
class
_CupertinoPicker
SampleState
extends
State
<
CupertinoPickerS
ample
>
{
class
_CupertinoPicker
ExampleState
extends
State
<
CupertinoPickerEx
ample
>
{
int
_selectedFruit
=
0
;
// This shows a CupertinoModalPopup with a reasonable fixed height which hosts CupertinoPicker.
...
...
examples/api/lib/cupertino/segmented_control/cupertino_segmented_control.0.dart
View file @
d80f3e39
...
...
@@ -14,30 +14,28 @@ Map<Sky, Color> skyColors = <Sky, Color> {
Sky
.
cerulean
:
const
Color
(
0xff007ba7
),
};
void
main
(
)
=>
runApp
(
const
My
App
());
void
main
(
)
=>
runApp
(
const
SegmentControl
App
());
class
MyApp
extends
StatelessWidget
{
const
MyApp
({
Key
?
key
})
:
super
(
key:
key
);
static
const
String
_title
=
'CupertinoSegmentedControl Sample'
;
class
SegmentControlApp
extends
StatelessWidget
{
const
SegmentControlApp
({
Key
?
key
})
:
super
(
key:
key
);
@override
Widget
build
(
BuildContext
context
)
{
return
const
CupertinoApp
(
t
itle:
_title
,
home:
SegmentedControl
S
ample
(),
t
heme:
CupertinoThemeData
(
brightness:
Brightness
.
light
)
,
home:
SegmentedControl
Ex
ample
(),
);
}
}
class
SegmentedControl
S
ample
extends
StatefulWidget
{
const
SegmentedControl
S
ample
({
Key
?
key
})
:
super
(
key:
key
);
class
SegmentedControl
Ex
ample
extends
StatefulWidget
{
const
SegmentedControl
Ex
ample
({
Key
?
key
})
:
super
(
key:
key
);
@override
State
<
SegmentedControl
Sample
>
createState
()
=>
_SegmentedControlS
ampleState
();
State
<
SegmentedControl
Example
>
createState
()
=>
_SegmentedControlEx
ampleState
();
}
class
_SegmentedControl
SampleState
extends
State
<
SegmentedControlS
ample
>
{
class
_SegmentedControl
ExampleState
extends
State
<
SegmentedControlEx
ample
>
{
Sky
_selectedSegment
=
Sky
.
midnight
;
@override
...
...
@@ -61,24 +59,15 @@ class _SegmentedControlSampleState extends State<SegmentedControlSample> {
children:
const
<
Sky
,
Widget
>{
Sky
.
midnight
:
Padding
(
padding:
EdgeInsets
.
symmetric
(
horizontal:
20
),
child:
Text
(
'Midnight'
,
style:
TextStyle
(
color:
CupertinoColors
.
white
),
),
child:
Text
(
'Midnight'
),
),
Sky
.
viridian
:
Padding
(
padding:
EdgeInsets
.
symmetric
(
horizontal:
20
),
child:
Text
(
'Viridian'
,
style:
TextStyle
(
color:
CupertinoColors
.
white
),
),
child:
Text
(
'Viridian'
),
),
Sky
.
cerulean
:
Padding
(
padding:
EdgeInsets
.
symmetric
(
horizontal:
20
),
child:
Text
(
'Cerulean'
,
style:
TextStyle
(
color:
CupertinoColors
.
white
),
),
child:
Text
(
'Cerulean'
),
),
},
),
...
...
examples/api/lib/cupertino/segmented_control/cupertino_sliding_segmented_control.0.dart
View file @
d80f3e39
...
...
@@ -14,30 +14,28 @@ Map<Sky, Color> skyColors = <Sky, Color> {
Sky
.
cerulean
:
const
Color
(
0xff007ba7
),
};
void
main
(
)
=>
runApp
(
const
My
App
());
void
main
(
)
=>
runApp
(
const
SegmentControl
App
());
class
MyApp
extends
StatelessWidget
{
const
MyApp
({
Key
?
key
})
:
super
(
key:
key
);
static
const
String
_title
=
'CupertinoSlidingSegmentedControl Sample'
;
class
SegmentControlApp
extends
StatelessWidget
{
const
SegmentControlApp
({
Key
?
key
})
:
super
(
key:
key
);
@override
Widget
build
(
BuildContext
context
)
{
return
const
CupertinoApp
(
t
itle:
_title
,
home:
SegmentedControl
S
ample
(),
t
heme:
CupertinoThemeData
(
brightness:
Brightness
.
light
)
,
home:
SegmentedControl
Ex
ample
(),
);
}
}
class
SegmentedControl
S
ample
extends
StatefulWidget
{
const
SegmentedControl
S
ample
({
Key
?
key
})
:
super
(
key:
key
);
class
SegmentedControl
Ex
ample
extends
StatefulWidget
{
const
SegmentedControl
Ex
ample
({
Key
?
key
})
:
super
(
key:
key
);
@override
State
<
SegmentedControl
Sample
>
createState
()
=>
_SegmentedControlS
ampleState
();
State
<
SegmentedControl
Example
>
createState
()
=>
_SegmentedControlEx
ampleState
();
}
class
_SegmentedControl
SampleState
extends
State
<
SegmentedControlS
ample
>
{
class
_SegmentedControl
ExampleState
extends
State
<
SegmentedControlEx
ample
>
{
Sky
_selectedSegment
=
Sky
.
midnight
;
@override
...
...
examples/api/lib/cupertino/slider/cupertino_slider.0.dart
View file @
d80f3e39
...
...
@@ -6,30 +6,28 @@
import
'package:flutter/cupertino.dart'
;
void
main
(
)
=>
runApp
(
const
My
App
());
void
main
(
)
=>
runApp
(
const
CupertinoSlider
App
());
class
MyApp
extends
StatelessWidget
{
const
MyApp
({
Key
?
key
})
:
super
(
key:
key
);
static
const
String
_title
=
'Flutter Code Sample'
;
class
CupertinoSliderApp
extends
StatelessWidget
{
const
CupertinoSliderApp
({
Key
?
key
})
:
super
(
key:
key
);
@override
Widget
build
(
BuildContext
context
)
{
return
const
CupertinoApp
(
t
itle:
_title
,
home:
CupertinoSlider
S
ample
(),
t
heme:
CupertinoThemeData
(
brightness:
Brightness
.
light
)
,
home:
CupertinoSlider
Ex
ample
(),
);
}
}
class
CupertinoSlider
S
ample
extends
StatefulWidget
{
const
CupertinoSlider
S
ample
({
Key
?
key
})
:
super
(
key:
key
);
class
CupertinoSlider
Ex
ample
extends
StatefulWidget
{
const
CupertinoSlider
Ex
ample
({
Key
?
key
})
:
super
(
key:
key
);
@override
State
<
CupertinoSlider
Sample
>
createState
()
=>
_CupertinoSliderS
ampleState
();
State
<
CupertinoSlider
Example
>
createState
()
=>
_CupertinoSliderEx
ampleState
();
}
class
_CupertinoSlider
SampleState
extends
State
<
CupertinoSliderS
ample
>
{
class
_CupertinoSlider
ExampleState
extends
State
<
CupertinoSliderEx
ample
>
{
double
_currentSliderValue
=
0.0
;
String
?
_sliderStatus
;
...
...
examples/api/lib/cupertino/text_field/cupertino_text_field.0.dart
View file @
d80f3e39
...
...
@@ -6,30 +6,28 @@
import
'package:flutter/cupertino.dart'
;
void
main
(
)
=>
runApp
(
const
My
App
());
void
main
(
)
=>
runApp
(
const
CupertinoTextField
App
());
class
MyApp
extends
StatelessWidget
{
const
MyApp
({
Key
?
key
})
:
super
(
key:
key
);
static
const
String
_title
=
'Flutter Code Sample'
;
class
CupertinoTextFieldApp
extends
StatelessWidget
{
const
CupertinoTextFieldApp
({
Key
?
key
})
:
super
(
key:
key
);
@override
Widget
build
(
BuildContext
context
)
{
return
const
CupertinoApp
(
t
itle:
_title
,
home:
MyStatefulWidget
(),
t
heme:
CupertinoThemeData
(
brightness:
Brightness
.
light
)
,
home:
CupertinoTextFieldExample
(),
);
}
}
class
MyStatefulWidget
extends
StatefulWidget
{
const
MyStatefulWidget
({
Key
?
key
})
:
super
(
key:
key
);
class
CupertinoTextFieldExample
extends
StatefulWidget
{
const
CupertinoTextFieldExample
({
Key
?
key
})
:
super
(
key:
key
);
@override
State
<
MyStatefulWidget
>
createState
()
=>
_MyStatefulWidget
State
();
State
<
CupertinoTextFieldExample
>
createState
()
=>
_CupertinoTextFieldExample
State
();
}
class
_
MyStatefulWidgetState
extends
State
<
MyStatefulWidget
>
{
class
_
CupertinoTextFieldExampleState
extends
State
<
CupertinoTextFieldExample
>
{
late
TextEditingController
_textController
;
@override
...
...
examples/api/test/cupertino/bottom_tab_bar/cupertino_tab_bar.0_test.dart
0 → 100644
View file @
d80f3e39
// 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/bottom_tab_bar/cupertino_tab_bar.0.dart'
as
example
;
import
'package:flutter_test/flutter_test.dart'
;
void
main
(
)
{
testWidgets
(
'Can switch between tabs'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
const
example
.
CupertinoTabBarApp
(),
);
expect
(
find
.
byType
(
CupertinoTabBar
),
findsOneWidget
);
expect
(
find
.
text
(
'Content of tab 0'
),
findsOneWidget
);
await
tester
.
tap
(
find
.
text
(
'Contacts'
));
await
tester
.
pump
();
expect
(
find
.
text
(
'Content of tab 2'
),
findsOneWidget
);
});
}
examples/api/test/cupertino/button/cupertino_button.0_test.dart
View file @
d80f3e39
...
...
@@ -9,7 +9,7 @@ import 'package:flutter_test/flutter_test.dart';
void
main
(
)
{
testWidgets
(
'Has 4 CupertinoButton variants'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
const
example
.
My
App
(),
const
example
.
CupertinoButton
App
(),
);
expect
(
find
.
byType
(
CupertinoButton
),
findsNWidgets
(
4
));
...
...
examples/api/test/cupertino/date_picker/cupertino_date_picker.0_test.dart
View file @
d80f3e39
...
...
@@ -10,7 +10,7 @@ const Offset _kRowOffset = Offset(0.0, -50.0);
void
main
(
)
{
testWidgets
(
'Can change date, time and dateTime using CupertinoDatePicker'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
const
example
.
My
App
(),
const
example
.
DatePicker
App
(),
);
// Open the date picker.
await
tester
.
tap
(
find
.
text
(
'10-26-2016'
));
...
...
examples/api/test/cupertino/date_picker/cupertino_timer_picker.0_test.dart
View file @
d80f3e39
...
...
@@ -10,7 +10,7 @@ const Offset _kRowOffset = Offset(0.0, -50.0);
void
main
(
)
{
testWidgets
(
'Can pick a duration from CupertinoTimerPicker'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
const
example
.
My
App
(),
const
example
.
TimerPicker
App
(),
);
// Launch the timer picker.
...
...
examples/api/test/cupertino/dialog/cupertino_action_sheet.0_test.dart
View file @
d80f3e39
...
...
@@ -10,7 +10,7 @@ void main() {
testWidgets
(
'Perform an action on CupertinoActionSheet'
,
(
WidgetTester
tester
)
async
{
const
String
actionText
=
'Destructive Action'
;
await
tester
.
pumpWidget
(
const
example
.
My
App
(),
const
example
.
ActionSheet
App
(),
);
// Launch the CupertinoActionSheet.
...
...
examples/api/test/cupertino/dialog/cupertino_alert_dialog.0_test.dart
View file @
d80f3e39
...
...
@@ -10,7 +10,7 @@ void main() {
testWidgets
(
'Perform an action on CupertinoAlertDialog'
,
(
WidgetTester
tester
)
async
{
const
String
actionText
=
'Yes'
;
await
tester
.
pumpWidget
(
const
example
.
My
App
(),
const
example
.
AlertDialog
App
(),
);
// Launch the CupertinoAlertDialog.
...
...
examples/api/test/cupertino/nav_bar/cupertino_navigation_bar.0_test.dart
0 → 100644
View file @
d80f3e39
// 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/nav_bar/cupertino_navigation_bar.0.dart'
as
example
;
import
'package:flutter_test/flutter_test.dart'
;
void
main
(
)
{
testWidgets
(
'CupertinoNavigationBar is semi transparent'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
const
example
.
NavBarApp
(),
);
final
Finder
navBarFinder
=
find
.
byType
(
CupertinoNavigationBar
);
expect
(
navBarFinder
,
findsOneWidget
);
final
CupertinoNavigationBar
cupertinoNavigationBar
=
tester
.
widget
<
CupertinoNavigationBar
>(
navBarFinder
);
expect
(
cupertinoNavigationBar
.
backgroundColor
,
CupertinoColors
.
systemGrey
.
withOpacity
(
0.5
));
});
}
examples/api/test/cupertino/nav_bar/cupertino_sliver_nav_bar.0_test.dart
View file @
d80f3e39
...
...
@@ -11,7 +11,7 @@ const Offset dragUp = Offset(0.0, -150.0);
void
main
(
)
{
testWidgets
(
'Collapse and expand CupertinoSliverNavigationBar changes title position'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
const
example
.
My
App
(),
const
example
.
SliverNavBar
App
(),
);
// Large title is visible and at lower position.
...
...
@@ -25,7 +25,7 @@ void main() {
testWidgets
(
'Middle widget is visible in both collapsed and expanded states'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
const
example
.
My
App
(),
const
example
.
SliverNavBar
App
(),
);
// Navigate to a page that has both middle and large titles.
...
...
@@ -48,7 +48,7 @@ void main() {
testWidgets
(
'CupertinoSliverNavigationBar with previous route has back button'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
const
example
.
My
App
(),
const
example
.
SliverNavBar
App
(),
);
// Navigate to a page that has back button
...
...
examples/api/test/cupertino/picker/cupertino_picker.0_test.dart
View file @
d80f3e39
...
...
@@ -10,7 +10,7 @@ const Offset _kRowOffset = Offset(0.0, -50.0);
void
main
(
)
{
testWidgets
(
'Change selected fruit using CupertinoPicker'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
const
example
.
My
App
(),
const
example
.
CupertinoPicker
App
(),
);
// Open the Cupertino picker.
...
...
examples/api/test/cupertino/segmented_control/cupertino_segmented_control.0_test.dart
View file @
d80f3e39
...
...
@@ -8,12 +8,14 @@ import 'package:flutter_test/flutter_test.dart';
void
main
(
)
{
testWidgets
(
'Can change a selected segmented control'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
const
example
.
My
App
(),
const
example
.
SegmentControl
App
(),
);
expect
(
find
.
text
(
'Selected Segment: midnight'
),
findsOneWidget
);
await
tester
.
tap
(
find
.
text
(
'Cerulean'
));
await
tester
.
pumpAndSettle
();
expect
(
find
.
text
(
'Selected Segment: cerulean'
),
findsOneWidget
);
});
}
examples/api/test/cupertino/segmented_control/cupertino_sliding_segmented_control.0_test.dart
View file @
d80f3e39
...
...
@@ -8,7 +8,7 @@ import 'package:flutter_test/flutter_test.dart';
void
main
(
)
{
testWidgets
(
'Can change a selected segmented control'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
const
example
.
My
App
(),
const
example
.
SegmentControl
App
(),
);
expect
(
find
.
text
(
'Selected Segment: midnight'
),
findsOneWidget
);
...
...
examples/api/test/cupertino/slider/cupertino_slider.0_test.dart
View file @
d80f3e39
...
...
@@ -16,7 +16,7 @@ void main() {
testWidgets
(
'Can change value using CupertinoSlider'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
const
example
.
My
App
(),
const
example
.
CupertinoSlider
App
(),
);
// Check for the initial slider value.
...
...
examples/api/test/cupertino/text_field/cupertino_text_field.0.dart
View file @
d80f3e39
...
...
@@ -2,15 +2,22 @@
// 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_field/cupertino_text_field.0.dart'
as
example
;
import
'package:flutter_test/flutter_test.dart'
;
void
main
(
)
{
testWidgets
(
'CupertinoTextField has initial text'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
const
example
.
My
App
(),
const
example
.
CupertinoTextField
App
(),
);
expect
(
find
.
byType
(
CupertinoTextField
),
findsOneWidget
);
expect
(
find
.
text
(
'initial text'
),
findsOneWidget
);
await
tester
.
enterText
(
find
.
byType
(
CupertinoTextField
),
'new text'
);
await
tester
.
pump
();
expect
(
find
.
text
(
'new text'
),
findsOneWidget
);
});
}
packages/flutter/lib/src/cupertino/bottom_tab_bar.dart
View file @
d80f3e39
...
...
@@ -48,7 +48,7 @@ const Color _kDefaultTabBarInactiveColor = CupertinoColors.inactiveGray;
/// {@tool dartpad}
/// This example shows a [CupertinoTabBar] placed in a [CupertinoTabScaffold].
///
/// ** See code in examples/api/lib/cupertino/bottom_tab_bar/
bottom
_tab_bar.0.dart **
/// ** See code in examples/api/lib/cupertino/bottom_tab_bar/
cupertino
_tab_bar.0.dart **
/// {@end-tool}
///
/// See also:
...
...
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