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
99a22938
Unverified
Commit
99a22938
authored
Oct 03, 2018
by
Hans Muller
Committed by
GitHub
Oct 03, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added ColorScheme dartdoc (#22592)
parent
9eca0830
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
0 deletions
+41
-0
color_scheme.dart
packages/flutter/lib/src/material/color_scheme.dart
+41
-0
No files found.
packages/flutter/lib/src/material/color_scheme.dart
View file @
99a22938
...
...
@@ -17,6 +17,7 @@ import 'theme_data.dart';
/// with [ColorScheme.fromSwatch].
@immutable
class
ColorScheme
extends
Diagnosticable
{
/// Create a ColorScheme instance.
const
ColorScheme
({
@required
this
.
primary
,
@required
this
.
primaryVariant
,
...
...
@@ -45,6 +46,8 @@ class ColorScheme extends Diagnosticable {
assert
(
onError
!=
null
),
assert
(
brightness
!=
null
);
/// Create a ColorScheme based on a purple primary color that matches the
/// [baseline Material color scheme](https://material.io/design/color/the-color-system.html#color-theme-creation).
const
ColorScheme
.
light
({
this
.
primary
=
const
Color
(
0xff6200ee
),
this
.
primaryVariant
=
const
Color
(
0xff3700b3
),
...
...
@@ -73,6 +76,8 @@ class ColorScheme extends Diagnosticable {
assert
(
onError
!=
null
),
assert
(
brightness
!=
null
);
/// Create dark version of the
/// [baseline Material color scheme](https://material.io/design/color/the-color-system.html#color-theme-creation).
const
ColorScheme
.
dark
({
this
.
primary
=
const
Color
(
0xffbb86fc
),
this
.
primaryVariant
=
const
Color
(
0xff4b01d0
),
...
...
@@ -101,6 +106,10 @@ class ColorScheme extends Diagnosticable {
assert
(
onError
!=
null
),
assert
(
brightness
!=
null
);
/// Create a color scheme from a [MaterialColor] swatch.
///
/// This constructor is used by [ThemeData] to create its default \
/// color scheme.
factory
ColorScheme
.
fromSwatch
({
MaterialColor
primarySwatch
=
Colors
.
blue
,
Color
primaryColorDark
,
...
...
@@ -137,20 +146,49 @@ class ColorScheme extends Diagnosticable {
static
Brightness
_brightnessFor
(
Color
color
)
=>
ThemeData
.
estimateBrightnessForColor
(
color
);
/// The color displayed most frequently across your app’s screens and components.
final
Color
primary
;
/// A darker version of the primary color.
final
Color
primaryVariant
;
/// An accent color that, when used sparingly, calls attention to parts
/// of your app.
final
Color
secondary
;
/// A darker version of the secondary color.
final
Color
secondaryVariant
;
/// A color that typically appears behind scrollable content.
final
Color
background
;
/// The color to use for input validation errors, e.g. for
/// [InputDecoration.errorText].
final
Color
error
;
/// The background color for widgets like [Card].
final
Color
surface
;
/// A color that's clearly legible when drawn on [primary].
final
Color
onPrimary
;
/// A color that's clearly legible when drawn on [secondary].
final
Color
onSecondary
;
/// A color that's clearly legible when drawn on [surface].
final
Color
onSurface
;
/// A color that's clearly legible when drawn on [error].
final
Color
onError
;
/// A color that's clearly legible when drawn on [background].
final
Color
onBackground
;
/// The overall brightness of this color scheme.
final
Brightness
brightness
;
/// Creates a copy of this color scheme with the given fields
/// replaced by the non-null parameter values.
ColorScheme
copyWith
({
Color
primary
,
Color
primaryVariant
,
...
...
@@ -183,6 +221,9 @@ class ColorScheme extends Diagnosticable {
);
}
/// Linearly interpolate between two [ColorScheme] objects.
///
/// {@macro flutter.material.themeData.lerp}
static
ColorScheme
lerp
(
ColorScheme
a
,
ColorScheme
b
,
double
t
)
{
return
ColorScheme
(
primary:
Color
.
lerp
(
a
.
primary
,
b
.
primary
,
t
),
...
...
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