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
faffd3ae
Commit
faffd3ae
authored
Aug 15, 2018
by
Natalie Sampsell
Committed by
xster
Aug 15, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add CupertinoActionSheet to gallery (#20411)
parent
fa5374e8
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
66 additions
and
9 deletions
+66
-9
cupertino.dart
examples/flutter_gallery/lib/demo/cupertino/cupertino.dart
+1
-1
cupertino_alert_demo.dart
...tter_gallery/lib/demo/cupertino/cupertino_alert_demo.dart
+62
-5
demos.dart
examples/flutter_gallery/lib/gallery/demos.dart
+3
-3
No files found.
examples/flutter_gallery/lib/demo/cupertino/cupertino.dart
View file @
faffd3ae
...
@@ -3,8 +3,8 @@
...
@@ -3,8 +3,8 @@
// found in the LICENSE file.
// found in the LICENSE file.
export
'cupertino_activity_indicator_demo.dart'
;
export
'cupertino_activity_indicator_demo.dart'
;
export
'cupertino_alert_demo.dart'
;
export
'cupertino_buttons_demo.dart'
;
export
'cupertino_buttons_demo.dart'
;
export
'cupertino_dialog_demo.dart'
;
export
'cupertino_navigation_demo.dart'
;
export
'cupertino_navigation_demo.dart'
;
export
'cupertino_picker_demo.dart'
;
export
'cupertino_picker_demo.dart'
;
export
'cupertino_refresh_demo.dart'
;
export
'cupertino_refresh_demo.dart'
;
...
...
examples/flutter_gallery/lib/demo/cupertino/cupertino_
dialog
_demo.dart
→
examples/flutter_gallery/lib/demo/cupertino/cupertino_
alert
_demo.dart
View file @
faffd3ae
...
@@ -5,14 +5,14 @@
...
@@ -5,14 +5,14 @@
import
'package:flutter/cupertino.dart'
;
import
'package:flutter/cupertino.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter/material.dart'
;
class
Cupertino
Dialog
Demo
extends
StatefulWidget
{
class
Cupertino
Alert
Demo
extends
StatefulWidget
{
static
const
String
routeName
=
'/cupertino/
dialog
'
;
static
const
String
routeName
=
'/cupertino/
alert
'
;
@override
@override
_Cupertino
DialogDemoState
createState
()
=>
new
_CupertinoDialog
DemoState
();
_Cupertino
AlertDemoState
createState
()
=>
new
_CupertinoAlert
DemoState
();
}
}
class
_Cupertino
DialogDemoState
extends
State
<
CupertinoDialog
Demo
>
{
class
_Cupertino
AlertDemoState
extends
State
<
CupertinoAlert
Demo
>
{
final
GlobalKey
<
ScaffoldState
>
_scaffoldKey
=
new
GlobalKey
<
ScaffoldState
>();
final
GlobalKey
<
ScaffoldState
>
_scaffoldKey
=
new
GlobalKey
<
ScaffoldState
>();
void
showDemoDialog
<
T
>({
BuildContext
context
,
Widget
child
})
{
void
showDemoDialog
<
T
>({
BuildContext
context
,
Widget
child
})
{
...
@@ -32,12 +32,27 @@ class _CupertinoDialogDemoState extends State<CupertinoDialogDemo> {
...
@@ -32,12 +32,27 @@ class _CupertinoDialogDemoState extends State<CupertinoDialogDemo> {
});
});
}
}
void
showDemoActionSheet
<
T
>({
BuildContext
context
,
Widget
child
})
{
showCupertinoModalPopup
<
T
>(
context:
context
,
builder:
(
BuildContext
context
)
=>
child
,
).
then
<
void
>((
T
value
)
{
if
(
value
!=
null
)
{
_scaffoldKey
.
currentState
.
showSnackBar
(
new
SnackBar
(
content:
new
Text
(
'You selected:
$value
'
),
),
);
}
});
}
@override
@override
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
return
new
Scaffold
(
return
new
Scaffold
(
key:
_scaffoldKey
,
key:
_scaffoldKey
,
appBar:
new
AppBar
(
appBar:
new
AppBar
(
title:
const
Text
(
'Cupertino
Dialog
s'
),
title:
const
Text
(
'Cupertino
Alert
s'
),
),
),
body:
new
ListView
(
body:
new
ListView
(
padding:
const
EdgeInsets
.
symmetric
(
vertical:
24.0
,
horizontal:
72.0
),
padding:
const
EdgeInsets
.
symmetric
(
vertical:
24.0
,
horizontal:
72.0
),
...
@@ -129,6 +144,48 @@ class _CupertinoDialogDemoState extends State<CupertinoDialogDemo> {
...
@@ -129,6 +144,48 @@ class _CupertinoDialogDemoState extends State<CupertinoDialogDemo> {
);
);
},
},
),
),
const
Padding
(
padding:
EdgeInsets
.
all
(
8.0
)),
new
CupertinoButton
(
child:
const
Text
(
'Action Sheet'
),
color:
CupertinoColors
.
activeBlue
,
padding:
const
EdgeInsets
.
symmetric
(
vertical:
16.0
,
horizontal:
36.0
),
onPressed:
()
{
showDemoActionSheet
<
String
>(
context:
context
,
child:
new
CupertinoActionSheet
(
title:
const
Text
(
'Favorite Dessert'
),
message:
const
Text
(
'Please select the best dessert from the options below.'
),
actions:
<
Widget
>[
new
CupertinoActionSheetAction
(
child:
const
Text
(
'Profiteroles'
),
onPressed:
()
{
Navigator
.
pop
(
context
,
'Profiteroles'
);
},
),
new
CupertinoActionSheetAction
(
child:
const
Text
(
'Cannolis'
),
onPressed:
()
{
Navigator
.
pop
(
context
,
'Cannolis'
);
},
),
new
CupertinoActionSheetAction
(
child:
const
Text
(
'Trifle'
),
onPressed:
()
{
Navigator
.
pop
(
context
,
'Trifle'
);
},
),
],
cancelButton:
new
CupertinoActionSheetAction
(
child:
const
Text
(
'Cancel'
),
isDefaultAction:
true
,
onPressed:
()
{
Navigator
.
pop
(
context
,
'Cancel'
);
},
)
),
);
},
),
],
],
),
),
);
);
...
...
examples/flutter_gallery/lib/gallery/demos.dart
View file @
faffd3ae
...
@@ -402,11 +402,11 @@ List<GalleryDemo> _buildGalleryDemos() {
...
@@ -402,11 +402,11 @@ List<GalleryDemo> _buildGalleryDemos() {
buildRoute:
(
BuildContext
context
)
=>
new
CupertinoButtonsDemo
(),
buildRoute:
(
BuildContext
context
)
=>
new
CupertinoButtonsDemo
(),
),
),
new
GalleryDemo
(
new
GalleryDemo
(
title:
'
Dialog
s'
,
title:
'
Alert
s'
,
icon:
GalleryIcons
.
dialogs
,
icon:
GalleryIcons
.
dialogs
,
category:
_kCupertinoComponents
,
category:
_kCupertinoComponents
,
routeName:
Cupertino
Dialog
Demo
.
routeName
,
routeName:
Cupertino
Alert
Demo
.
routeName
,
buildRoute:
(
BuildContext
context
)
=>
new
Cupertino
Dialog
Demo
(),
buildRoute:
(
BuildContext
context
)
=>
new
Cupertino
Alert
Demo
(),
),
),
new
GalleryDemo
(
new
GalleryDemo
(
title:
'Navigation'
,
title:
'Navigation'
,
...
...
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