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
30fb97be
Unverified
Commit
30fb97be
authored
Dec 15, 2018
by
Hans Muller
Committed by
GitHub
Dec 15, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed Typography null factory constructor (#24932)
parent
ad2e3eb3
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
39 additions
and
68 deletions
+39
-68
tabs.dart
packages/flutter/lib/src/material/tabs.dart
+2
-3
typography.dart
packages/flutter/lib/src/material/typography.dart
+6
-4
outline_button_test.dart
packages/flutter/test/material/outline_button_test.dart
+12
-10
tabs_test.dart
packages/flutter/test/material/tabs_test.dart
+0
-51
typography_test.dart
packages/flutter/test/material/typography_test.dart
+19
-0
No files found.
packages/flutter/lib/src/material/tabs.dart
View file @
30fb97be
...
@@ -1183,10 +1183,9 @@ class _TabBarViewState extends State<TabBarView> {
...
@@ -1183,10 +1183,9 @@ class _TabBarViewState extends State<TabBarView> {
if
(
notification
is
ScrollUpdateNotification
&&
!
_controller
.
indexIsChanging
)
{
if
(
notification
is
ScrollUpdateNotification
&&
!
_controller
.
indexIsChanging
)
{
if
((
_pageController
.
page
-
_controller
.
index
).
abs
()
>
1.0
)
{
if
((
_pageController
.
page
-
_controller
.
index
).
abs
()
>
1.0
)
{
_controller
.
index
=
_pageController
.
page
.
floor
();
_controller
.
index
=
_pageController
.
page
.
floor
();
_currentIndex
=
_controller
.
index
;
_currentIndex
=
_controller
.
index
;
}
}
if
(
_controller
.
length
>
1
)
_controller
.
offset
=
(
_pageController
.
page
-
_controller
.
index
).
clamp
(-
1.0
,
1.0
);
_controller
.
offset
=
(
_pageController
.
page
-
_controller
.
index
).
clamp
(-
1.0
,
1.0
);
}
else
if
(
notification
is
ScrollEndNotification
)
{
}
else
if
(
notification
is
ScrollEndNotification
)
{
_controller
.
index
=
_pageController
.
page
.
round
();
_controller
.
index
=
_pageController
.
page
.
round
();
_currentIndex
=
_controller
.
index
;
_currentIndex
=
_controller
.
index
;
...
...
packages/flutter/lib/src/material/typography.dart
View file @
30fb97be
...
@@ -87,20 +87,22 @@ enum ScriptCategory {
...
@@ -87,20 +87,22 @@ enum ScriptCategory {
class
Typography
extends
Diagnosticable
{
class
Typography
extends
Diagnosticable
{
/// Creates a typography instance.
/// Creates a typography instance.
///
///
/// If [platform] is specified, the default values for [black] and [white]
/// If [platform] is [TargetPlatform.iOS], the default values for [black] and
/// are [blackCupertino] and [whiteCupertino] respectively. Otherwise
/// [white] are [blackCupertino] and [whiteCupertino] respectively. Otherwise
/// they are [blackMountainView] and [whiteMoutainView].
/// they are [blackMountainView] and [whiteMoutainView]. If [platform] is
/// null then both [black] and [white] must be specified.
///
///
/// The default values for [englishLike], [dense], and [tall] are
/// The default values for [englishLike], [dense], and [tall] are
/// [englishLike2014], [dense2014], and [tall2014].
/// [englishLike2014], [dense2014], and [tall2014].
factory
Typography
({
factory
Typography
({
TargetPlatform
platform
,
TargetPlatform
platform
=
TargetPlatform
.
android
,
TextTheme
black
,
TextTheme
black
,
TextTheme
white
,
TextTheme
white
,
TextTheme
englishLike
,
TextTheme
englishLike
,
TextTheme
dense
,
TextTheme
dense
,
TextTheme
tall
,
TextTheme
tall
,
})
{
})
{
assert
(
platform
!=
null
||
(
black
!=
null
&&
white
!=
null
));
switch
(
platform
)
{
switch
(
platform
)
{
case
TargetPlatform
.
iOS
:
case
TargetPlatform
.
iOS
:
black
??=
blackCupertino
;
black
??=
blackCupertino
;
...
...
packages/flutter/test/material/outline_button_test.dart
View file @
30fb97be
...
@@ -271,20 +271,22 @@ void main() {
...
@@ -271,20 +271,22 @@ void main() {
expect
(
tester
.
getSize
(
find
.
byType
(
Text
)).
height
,
equals
(
42.0
));
expect
(
tester
.
getSize
(
find
.
byType
(
Text
)).
height
,
equals
(
42.0
));
});
});
testWidgets
(
'OutlineButton implements debugFill
Description
'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'OutlineButton implements debugFill
Properties
'
,
(
WidgetTester
tester
)
async
{
final
DiagnosticPropertiesBuilder
builder
=
DiagnosticPropertiesBuilder
();
final
DiagnosticPropertiesBuilder
builder
=
DiagnosticPropertiesBuilder
();
OutlineButton
(
OutlineButton
(
onPressed:
()
{},
onPressed:
()
{},
textColor:
const
Color
(
0xFF00FF00
),
textColor:
const
Color
(
0xFF00FF00
),
disabledTextColor:
const
Color
(
0xFFFF0000
),
disabledTextColor:
const
Color
(
0xFFFF0000
),
color:
const
Color
(
0xFF000000
),
color:
const
Color
(
0xFF000000
),
highlightColor:
const
Color
(
0xFF1565C0
),
highlightColor:
const
Color
(
0xFF1565C0
),
splashColor:
const
Color
(
0xFF9E9E9E
),
splashColor:
const
Color
(
0xFF9E9E9E
),
child:
const
Text
(
'Hello'
),
child:
const
Text
(
'Hello'
),
).
debugFillProperties
(
builder
);
).
debugFillProperties
(
builder
);
final
List
<
String
>
description
=
builder
.
properties
final
List
<
String
>
description
=
builder
.
properties
.
where
((
DiagnosticsNode
n
)
=>
!
n
.
isFiltered
(
DiagnosticLevel
.
info
))
.
where
((
DiagnosticsNode
node
)
=>
!
node
.
isFiltered
(
DiagnosticLevel
.
info
))
.
map
((
DiagnosticsNode
n
)
=>
n
.
toString
()).
toList
();
.
map
((
DiagnosticsNode
node
)
=>
node
.
toString
()).
toList
();
expect
(
description
,
<
String
>[
expect
(
description
,
<
String
>[
'textColor: Color(0xff00ff00)'
,
'textColor: Color(0xff00ff00)'
,
'disabledTextColor: Color(0xffff0000)'
,
'disabledTextColor: Color(0xffff0000)'
,
...
...
packages/flutter/test/material/tabs_test.dart
View file @
30fb97be
...
@@ -1976,55 +1976,4 @@ void main() {
...
@@ -1976,55 +1976,4 @@ void main() {
expect
(
find
.
text
(
AlwaysKeepAliveWidget
.
text
,
skipOffstage:
false
),
findsOneWidget
);
expect
(
find
.
text
(
AlwaysKeepAliveWidget
.
text
,
skipOffstage:
false
),
findsOneWidget
);
expect
(
find
.
text
(
'4'
),
findsOneWidget
);
expect
(
find
.
text
(
'4'
),
findsOneWidget
);
});
});
testWidgets
(
'Removing the last tab'
,
(
WidgetTester
tester
)
async
{
// This is a regression test for https://github.com/flutter/flutter/issues/24424
final
List
<
Tab
>
tabs
=
<
Tab
>[
const
Tab
(
text:
'LEFT'
),
const
Tab
(
text:
'RIGHT'
)];
Widget
buildFrame
(
TabController
controller
)
{
return
boilerplate
(
child:
Container
(
alignment:
Alignment
.
topLeft
,
child:
Column
(
children:
<
Widget
>[
TabBar
(
controller:
controller
,
tabs:
tabs
),
Expanded
(
child:
TabBarView
(
controller:
controller
,
children:
tabs
)),
]
),
),
);
}
final
TabController
controller1
=
TabController
(
vsync:
const
TestVSync
(),
length:
2
,
initialIndex:
0
,
);
await
tester
.
pumpWidget
(
buildFrame
(
controller1
));
expect
(
controller1
.
index
,
0
);
await
tester
.
tap
(
find
.
text
(
'RIGHT'
));
expect
(
controller1
.
index
,
1
);
expect
(
controller1
.
indexIsChanging
,
true
);
// At this point the change selected tab animation hasn't completed.
// When the controller is replaced the TabBarView will see one last
// scroll notification. Since there's only one tab left, it can be
// ignored.
final
TabController
controller2
=
TabController
(
vsync:
const
TestVSync
(),
length:
1
,
initialIndex:
0
,
);
tabs
.
removeAt
(
1
);
await
tester
.
pumpWidget
(
buildFrame
(
controller2
));
await
tester
.
pumpAndSettle
();
expect
(
controller1
.
indexIsChanging
,
false
);
expect
(
controller2
.
index
,
0
);
});
}
}
packages/flutter/test/material/typography_test.dart
View file @
30fb97be
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// found in the LICENSE file.
import
'package:flutter/foundation.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
...
@@ -47,4 +48,22 @@ void main() {
...
@@ -47,4 +48,22 @@ void main() {
expect
(
textTheme
.
overline
,
isTextFont
);
expect
(
textTheme
.
overline
,
isTextFont
);
}
}
});
});
testWidgets
(
'Typography implements debugFillProperties'
,
(
WidgetTester
tester
)
async
{
final
DiagnosticPropertiesBuilder
builder
=
DiagnosticPropertiesBuilder
();
Typography
(
platform:
TargetPlatform
.
android
,
black:
Typography
.
blackCupertino
,
white:
Typography
.
whiteCupertino
,
englishLike:
Typography
.
englishLike2018
,
dense:
Typography
.
dense2018
,
tall:
Typography
.
tall2018
,
).
debugFillProperties
(
builder
);
final
List
<
String
>
nonDefaultPropertyNames
=
builder
.
properties
.
where
((
DiagnosticsNode
node
)
=>
!
node
.
isFiltered
(
DiagnosticLevel
.
info
))
.
map
((
DiagnosticsNode
node
)
=>
node
.
name
).
toList
();
expect
(
nonDefaultPropertyNames
,
<
String
>[
'black'
,
'white'
,
'englishLike'
,
'dense'
,
'tall'
]);
});
}
}
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