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
09eba82a
Commit
09eba82a
authored
Jun 09, 2017
by
Hans Muller
Committed by
GitHub
Jun 09, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add indicatorWeight, indicatorPadding to TabBar (#10600)
parent
4bde698f
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
144 additions
and
41 deletions
+144
-41
constants.dart
packages/flutter/lib/src/material/constants.dart
+3
-0
tabs.dart
packages/flutter/lib/src/material/tabs.dart
+76
-41
tabs_test.dart
packages/flutter/test/material/tabs_test.dart
+65
-0
No files found.
packages/flutter/lib/src/material/constants.dart
View file @
09eba82a
...
...
@@ -28,5 +28,8 @@ const int kRadialReactionAlpha = 0x33;
/// The duration of the horizontal scroll animation that occurs when a tab is tapped.
const
Duration
kTabScrollDuration
=
const
Duration
(
milliseconds:
300
);
/// The horizontal padding included by [Tab]s.
const
EdgeInsets
kTabLabelPadding
=
const
EdgeInsets
.
symmetric
(
horizontal:
12.0
);
/// The padding added around material list items.
const
EdgeInsets
kMaterialListPadding
=
const
EdgeInsets
.
symmetric
(
vertical:
8.0
);
packages/flutter/lib/src/material/tabs.dart
View file @
09eba82a
This diff is collapsed.
Click to expand it.
packages/flutter/test/material/tabs_test.dart
View file @
09eba82a
...
...
@@ -6,6 +6,7 @@ import 'package:flutter_test/flutter_test.dart';
import
'package:flutter/material.dart'
;
import
'package:flutter/widgets.dart'
;
import
'../rendering/mock_canvas.dart'
;
import
'../rendering/recording_canvas.dart'
;
class
StateMarker
extends
StatefulWidget
{
...
...
@@ -835,4 +836,68 @@ void main() {
expect
(
find
.
text
(
'TAB #19'
),
findsOneWidget
);
expect
(
tester
.
getTopRight
(
find
.
widgetWithText
(
Tab
,
'TAB #19'
)).
dx
,
800.0
);
});
testWidgets
(
'TabBar with indicatorWeight, indicatorPadding'
,
(
WidgetTester
tester
)
async
{
const
Color
color
=
const
Color
(
0xFF00FF00
);
const
double
height
=
100.0
;
const
double
weight
=
8.0
;
const
double
padLeft
=
8.0
;
const
double
padRight
=
4.0
;
final
List
<
Widget
>
tabs
=
new
List
<
Widget
>.
generate
(
4
,
(
int
index
)
{
return
new
Container
(
key:
new
ValueKey
<
int
>(
index
),
height:
height
,
);
});
final
TabController
controller
=
new
TabController
(
vsync:
const
TestVSync
(),
length:
tabs
.
length
,
);
await
tester
.
pumpWidget
(
new
Material
(
child:
new
Column
(
children:
<
Widget
>[
new
TabBar
(
indicatorWeight:
8.0
,
indicatorColor:
color
,
indicatorPadding:
const
EdgeInsets
.
only
(
left:
padLeft
,
right:
padRight
),
controller:
controller
,
tabs:
tabs
,
),
new
Flexible
(
child:
new
Container
()),
],
),
),
);
final
RenderBox
tabBarBox
=
tester
.
firstRenderObject
<
RenderBox
>(
find
.
byType
(
TabBar
));
// Selected tab dimensions
double
tabWidth
=
tester
.
getSize
(
find
.
byKey
(
const
ValueKey
<
int
>(
0
))).
width
;
double
tabLeft
=
tester
.
getTopLeft
(
find
.
byKey
(
const
ValueKey
<
int
>(
0
))).
dx
;
double
tabRight
=
tabLeft
+
tabWidth
;
expect
(
tabBarBox
,
paints
..
rect
(
style:
PaintingStyle
.
fill
,
color:
color
,
rect:
new
Rect
.
fromLTRB
(
tabLeft
+
padLeft
,
height
,
tabRight
-
padRight
,
height
+
weight
)
));
// Select tab 3
controller
.
index
=
3
;
await
tester
.
pumpAndSettle
();
tabWidth
=
tester
.
getSize
(
find
.
byKey
(
const
ValueKey
<
int
>(
3
))).
width
;
tabLeft
=
tester
.
getTopLeft
(
find
.
byKey
(
const
ValueKey
<
int
>(
3
))).
dx
;
tabRight
=
tabLeft
+
tabWidth
;
expect
(
tabBarBox
,
paints
..
rect
(
style:
PaintingStyle
.
fill
,
color:
color
,
rect:
new
Rect
.
fromLTRB
(
tabLeft
+
padLeft
,
height
,
tabRight
-
padRight
,
height
+
weight
)
));
});
}
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