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
07eb5ea0
Unverified
Commit
07eb5ea0
authored
Mar 12, 2018
by
Hans Muller
Committed by
GitHub
Mar 12, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added custom selection indicators to the gallery scrollable tabs demo (#15323)
parent
a6159279
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
65 additions
and
0 deletions
+65
-0
scrollable_tabs_demo.dart
...utter_gallery/lib/demo/material/scrollable_tabs_demo.dart
+65
-0
No files found.
examples/flutter_gallery/lib/demo/material/scrollable_tabs_demo.dart
View file @
07eb5ea0
...
...
@@ -43,6 +43,7 @@ class ScrollableTabsDemo extends StatefulWidget {
class
ScrollableTabsDemoState
extends
State
<
ScrollableTabsDemo
>
with
SingleTickerProviderStateMixin
{
TabController
_controller
;
TabsDemoStyle
_demoStyle
=
TabsDemoStyle
.
iconsAndText
;
bool
_customIndicator
=
false
;
@override
void
initState
()
{
...
...
@@ -62,6 +63,61 @@ class ScrollableTabsDemoState extends State<ScrollableTabsDemo> with SingleTicke
});
}
ShapeDecoration
getIndicator
()
{
if
(!
_customIndicator
)
return
null
;
switch
(
_demoStyle
)
{
case
TabsDemoStyle
.
iconsAndText
:
return
new
ShapeDecoration
(
shape:
const
RoundedRectangleBorder
(
borderRadius:
const
BorderRadius
.
all
(
const
Radius
.
circular
(
4.0
)),
side:
const
BorderSide
(
color:
Colors
.
white24
,
width:
2.0
,
),
)
+
const
RoundedRectangleBorder
(
borderRadius:
const
BorderRadius
.
all
(
const
Radius
.
circular
(
4.0
)),
side:
const
BorderSide
(
color:
Colors
.
transparent
,
width:
4.0
,
),
),
);
case
TabsDemoStyle
.
iconsOnly
:
return
new
ShapeDecoration
(
shape:
const
CircleBorder
(
side:
const
BorderSide
(
color:
Colors
.
white24
,
width:
4.0
,
),
)
+
const
CircleBorder
(
side:
const
BorderSide
(
color:
Colors
.
transparent
,
width:
4.0
,
),
),
);
case
TabsDemoStyle
.
textOnly
:
return
new
ShapeDecoration
(
shape:
const
StadiumBorder
(
side:
const
BorderSide
(
color:
Colors
.
white24
,
width:
2.0
,
),
)
+
const
StadiumBorder
(
side:
const
BorderSide
(
color:
Colors
.
transparent
,
width:
4.0
,
),
),
);
}
return
null
;
}
@override
Widget
build
(
BuildContext
context
)
{
final
Color
iconColor
=
Theme
.
of
(
context
).
accentColor
;
...
...
@@ -69,6 +125,14 @@ class ScrollableTabsDemoState extends State<ScrollableTabsDemo> with SingleTicke
appBar:
new
AppBar
(
title:
const
Text
(
'Scrollable tabs'
),
actions:
<
Widget
>[
new
IconButton
(
icon:
const
Icon
(
Icons
.
sentiment_very_satisfied
),
onPressed:
()
{
setState
(()
{
_customIndicator
=
!
_customIndicator
;
});
},
),
new
PopupMenuButton
<
TabsDemoStyle
>(
onSelected:
changeDemoStyle
,
itemBuilder:
(
BuildContext
context
)
=>
<
PopupMenuItem
<
TabsDemoStyle
>>[
...
...
@@ -90,6 +154,7 @@ class ScrollableTabsDemoState extends State<ScrollableTabsDemo> with SingleTicke
bottom:
new
TabBar
(
controller:
_controller
,
isScrollable:
true
,
indicator:
getIndicator
(),
tabs:
_allPages
.
map
((
_Page
page
)
{
switch
(
_demoStyle
)
{
case
TabsDemoStyle
.
iconsAndText
:
...
...
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