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
9d49ee3b
Unverified
Commit
9d49ee3b
authored
Jul 10, 2018
by
Natalie Sampsell
Committed by
GitHub
Jul 10, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add segmented control to gallery (#19192)
* Adding segmented control to gallery
parent
3397338c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
125 additions
and
0 deletions
+125
-0
cupertino.dart
examples/flutter_gallery/lib/demo/cupertino/cupertino.dart
+1
-0
cupertino_segmented_control_demo.dart
.../lib/demo/cupertino/cupertino_segmented_control_demo.dart
+117
-0
demos.dart
examples/flutter_gallery/lib/gallery/demos.dart
+7
-0
No files found.
examples/flutter_gallery/lib/demo/cupertino/cupertino.dart
View file @
9d49ee3b
...
...
@@ -8,5 +8,6 @@ export 'cupertino_dialog_demo.dart';
export
'cupertino_navigation_demo.dart'
;
export
'cupertino_picker_demo.dart'
;
export
'cupertino_refresh_demo.dart'
;
export
'cupertino_segmented_control_demo.dart'
;
export
'cupertino_slider_demo.dart'
;
export
'cupertino_switch_demo.dart'
;
examples/flutter_gallery/lib/demo/cupertino/cupertino_segmented_control_demo.dart
0 → 100644
View file @
9d49ee3b
// Copyright 2018 The Chromium 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/material.dart'
;
const
Color
_kKeyUmbraOpacity
=
const
Color
(
0x33000000
);
// alpha = 0.2
const
Color
_kKeyPenumbraOpacity
=
const
Color
(
0x24000000
);
// alpha = 0.14
const
Color
_kAmbientShadowOpacity
=
const
Color
(
0x1F000000
);
// alpha = 0.12
class
CupertinoSegmentedControlDemo
extends
StatefulWidget
{
static
const
String
routeName
=
'cupertino/segmented_control'
;
@override
_CupertinoSegmentedControlDemoState
createState
()
=>
new
_CupertinoSegmentedControlDemoState
();
}
class
_CupertinoSegmentedControlDemoState
extends
State
<
CupertinoSegmentedControlDemo
>
{
final
Map
<
int
,
Widget
>
children
=
const
<
int
,
Widget
>{
0
:
Center
(
child:
const
Text
(
'Midnight'
),
),
1
:
Center
(
child:
const
Text
(
'Viridian'
),
),
2
:
Center
(
child:
const
Text
(
'Cerulean'
),
),
};
final
Map
<
int
,
Widget
>
icons
=
const
<
int
,
Widget
>{
0
:
Center
(
child:
const
FlutterLogo
(
colors:
Colors
.
indigo
,
size:
200.0
,
),
),
1
:
Center
(
child:
const
FlutterLogo
(
colors:
Colors
.
teal
,
size:
200.0
,
),
),
2
:
Center
(
child:
const
FlutterLogo
(
colors:
Colors
.
cyan
,
size:
200.0
,
),
),
};
int
sharedValue
=
0
;
@override
Widget
build
(
BuildContext
context
)
{
return
new
Scaffold
(
appBar:
new
AppBar
(
title:
const
Text
(
'Cupertino Segmented Control'
),
),
body:
new
Column
(
children:
<
Widget
>[
const
Padding
(
padding:
const
EdgeInsets
.
all
(
16.0
),
),
new
SegmentedControl
<
int
>(
children:
children
,
onValueChanged:
(
int
newValue
)
{
setState
(()
{
sharedValue
=
newValue
;
});
},
groupValue:
sharedValue
,
),
new
Expanded
(
child:
new
Padding
(
padding:
const
EdgeInsets
.
symmetric
(
vertical:
32.0
,
horizontal:
16.0
,
),
child:
new
Container
(
padding:
const
EdgeInsets
.
symmetric
(
vertical:
64.0
,
horizontal:
16.0
,
),
decoration:
new
BoxDecoration
(
color:
CupertinoColors
.
white
,
borderRadius:
new
BorderRadius
.
circular
(
3.0
),
boxShadow:
const
<
BoxShadow
>[
const
BoxShadow
(
offset:
const
Offset
(
0.0
,
3.0
),
blurRadius:
5.0
,
spreadRadius:
-
1.0
,
color:
_kKeyUmbraOpacity
,
),
const
BoxShadow
(
offset:
const
Offset
(
0.0
,
6.0
),
blurRadius:
10.0
,
spreadRadius:
0.0
,
color:
_kKeyPenumbraOpacity
,
),
const
BoxShadow
(
offset:
const
Offset
(
0.0
,
1.0
),
blurRadius:
18.0
,
spreadRadius:
0.0
,
color:
_kAmbientShadowOpacity
,
),
],
),
child:
icons
[
sharedValue
]),
),
),
],
),
);
}
}
examples/flutter_gallery/lib/gallery/demos.dart
View file @
9d49ee3b
...
...
@@ -421,6 +421,13 @@ List<GalleryDemo> _buildGalleryDemos() {
routeName:
CupertinoRefreshControlDemo
.
routeName
,
buildRoute:
(
BuildContext
context
)
=>
new
CupertinoRefreshControlDemo
(),
),
new
GalleryDemo
(
title:
'Segmented Control'
,
icon:
GalleryIcons
.
tabs
,
category:
_kCupertinoComponents
,
routeName:
CupertinoSegmentedControlDemo
.
routeName
,
buildRoute:
(
BuildContext
context
)
=>
new
CupertinoSegmentedControlDemo
(),
),
new
GalleryDemo
(
title:
'Sliders'
,
icon:
GalleryIcons
.
sliders
,
...
...
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