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
8c05c0a9
Unverified
Commit
8c05c0a9
authored
Mar 10, 2021
by
Hans Muller
Committed by
GitHub
Mar 10, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removed Stepper accentColor dependency (#77732)
parent
b15465fc
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
73 additions
and
42 deletions
+73
-42
stepper.dart
packages/flutter/lib/src/material/stepper.dart
+28
-42
stepper_test.dart
packages/flutter/test/material/stepper_test.dart
+45
-0
No files found.
packages/flutter/lib/src/material/stepper.dart
View file @
8c05c0a9
...
...
@@ -127,46 +127,32 @@ class Step {
/// ```dart
/// int _index = 0;
/// Widget build(BuildContext context) {
/// return Container(
/// height: 300,
/// width: 300,
/// child: Stepper(
/// currentStep: _index,
/// onStepCancel: () {
/// if (_index <= 0) {
/// return;
/// }
/// setState(() {
/// _index--;
/// });
/// },
/// onStepContinue: () {
/// if (_index >= 1) {
/// return;
/// }
/// setState(() {
/// _index++;
/// });
/// },
/// onStepTapped: (index) {
/// setState(() {
/// _index = index;
/// });
/// },
/// steps: [
/// Step(
/// title: Text("Step 1 title"),
/// content: Container(
/// alignment: Alignment.centerLeft,
/// child: Text("Content for Step 1")
/// ),
/// return Stepper(
/// currentStep: _index,
/// onStepCancel: () {
/// if (_index > 0)
/// setState(() { _index -= 1; });
/// },
/// onStepContinue: () {
/// if (_index <= 0)
/// setState(() { _index += 1; });
/// },
/// onStepTapped: (index) {
/// setState(() { _index = index; });
/// },
/// steps: <Step>[
/// Step(
/// title: Text('Step 1 title'),
/// content: Container(
/// alignment: Alignment.centerLeft,
/// child: Text('Content for Step 1')
/// ),
///
Step(
///
title: Text("Step 2 title"),
///
content: Text("Content for Step 2"
),
/// ),
///
]
,
///
)
,
///
),
///
Step(
///
title: Text('Step 2 title'
),
///
content: Text('Content for Step 2'
),
///
)
,
///
]
,
/// );
/// }
/// ```
...
...
@@ -372,11 +358,11 @@ class _StepperState extends State<Stepper> with TickerProviderStateMixin {
}
Color
_circleColor
(
int
index
)
{
final
ThemeData
themeData
=
Theme
.
of
(
context
)
;
final
ColorScheme
colorScheme
=
Theme
.
of
(
context
).
colorScheme
;
if
(!
_isDark
())
{
return
widget
.
steps
[
index
].
isActive
?
themeData
.
primaryColor
:
Colors
.
black38
;
return
widget
.
steps
[
index
].
isActive
?
colorScheme
.
primary
:
colorScheme
.
onSurface
.
withOpacity
(
0.38
)
;
}
else
{
return
widget
.
steps
[
index
].
isActive
?
themeData
.
accentColor
:
themeData
.
backgroundColor
;
return
widget
.
steps
[
index
].
isActive
?
colorScheme
.
secondary
:
colorScheme
.
background
;
}
}
...
...
packages/flutter/test/material/stepper_test.dart
View file @
8c05c0a9
...
...
@@ -842,4 +842,49 @@ void main() {
expect
(
listView
.
physics
,
physics
);
}
});
testWidgets
(
'Stepper horizontal size test'
,
(
WidgetTester
tester
)
async
{
// Regression test for https://github.com/flutter/flutter/pull/77732
Widget
buildFrame
({
bool
isActive
=
true
,
Brightness
?
brightness
})
{
return
MaterialApp
(
theme:
brightness
==
Brightness
.
dark
?
ThemeData
.
dark
()
:
ThemeData
.
light
(),
home:
Scaffold
(
body:
Center
(
child:
Stepper
(
type:
StepperType
.
horizontal
,
steps:
<
Step
>[
Step
(
title:
const
Text
(
'step'
),
content:
const
Text
(
'content'
),
isActive:
isActive
,
),
],
),
),
),
);
}
Color
?
circleFillColor
()
{
final
Finder
container
=
find
.
widgetWithText
(
AnimatedContainer
,
'1'
);
return
(
tester
.
widget
<
AnimatedContainer
>(
container
).
decoration
as
BoxDecoration
?)?.
color
;
}
// Light theme
final
ColorScheme
light
=
ThemeData
.
light
().
colorScheme
;
await
tester
.
pumpWidget
(
buildFrame
(
isActive:
true
,
brightness:
Brightness
.
light
));
expect
(
circleFillColor
(),
light
.
primary
);
await
tester
.
pumpWidget
(
buildFrame
(
isActive:
false
,
brightness:
Brightness
.
light
));
await
tester
.
pumpAndSettle
();
expect
(
circleFillColor
(),
light
.
onSurface
.
withOpacity
(
0.38
));
// Dark theme
final
ColorScheme
dark
=
ThemeData
.
dark
().
colorScheme
;
await
tester
.
pumpWidget
(
buildFrame
(
isActive:
true
,
brightness:
Brightness
.
dark
));
await
tester
.
pumpAndSettle
();
expect
(
circleFillColor
(),
dark
.
secondary
);
await
tester
.
pumpWidget
(
buildFrame
(
isActive:
false
,
brightness:
Brightness
.
dark
));
await
tester
.
pumpAndSettle
();
expect
(
circleFillColor
(),
dark
.
background
);
});
}
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