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
031e042e
Commit
031e042e
authored
Mar 17, 2017
by
Hans Muller
Committed by
GitHub
Mar 17, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Now each Colors.foo constant is-a Color and a color swatch (#8833)
parent
5cf04b61
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
848 additions
and
531 deletions
+848
-531
card_collection.dart
dev/manual_tests/card_collection.dart
+4
-4
colors_demo.dart
examples/flutter_gallery/lib/demo/colors_demo.dart
+44
-40
icons_demo.dart
examples/flutter_gallery/lib/demo/material/icons_demo.dart
+4
-4
tabs_fab_demo.dart
...ples/flutter_gallery/lib/demo/material/tabs_fab_demo.dart
+1
-1
drawer.dart
examples/flutter_gallery/lib/gallery/drawer.dart
+19
-18
gestures.dart
examples/layers/widgets/gestures.dart
+38
-24
colors.dart
packages/flutter/lib/src/material/colors.dart
+604
-380
flutter_logo.dart
packages/flutter/lib/src/material/flutter_logo.dart
+9
-11
list_tile.dart
packages/flutter/lib/src/material/list_tile.dart
+1
-1
theme_data.dart
packages/flutter/lib/src/material/theme_data.dart
+1
-1
flutter_logo.dart
packages/flutter/lib/src/painting/flutter_logo.dart
+37
-47
colors_test.dart
packages/flutter/test/material/colors_test.dart
+86
-0
No files found.
dev/manual_tests/card_collection.dart
View file @
031e042e
...
@@ -32,7 +32,7 @@ class CardCollectionState extends State<CardCollection> {
...
@@ -32,7 +32,7 @@ class CardCollectionState extends State<CardCollection> {
static
const
double
kCardMargins
=
8.0
;
static
const
double
kCardMargins
=
8.0
;
static
const
double
kFixedCardHeight
=
100.0
;
static
const
double
kFixedCardHeight
=
100.0
;
Ma
p
<
int
,
Color
>
_primaryColor
=
Colors
.
deepPurple
;
Ma
terialColor
_primaryColor
=
Colors
.
deepPurple
;
List
<
CardModel
>
_cardModels
;
List
<
CardModel
>
_cardModels
;
DismissDirection
_dismissDirection
=
DismissDirection
.
horizontal
;
DismissDirection
_dismissDirection
=
DismissDirection
.
horizontal
;
TextAlign
_textAlign
=
TextAlign
.
center
;
TextAlign
_textAlign
=
TextAlign
.
center
;
...
@@ -148,7 +148,7 @@ class CardCollectionState extends State<CardCollection> {
...
@@ -148,7 +148,7 @@ class CardCollectionState extends State<CardCollection> {
});
});
}
}
void
_selectColor
(
Ma
p
<
int
,
Color
>
selection
)
{
void
_selectColor
(
Ma
terialColor
selection
)
{
setState
(()
{
setState
(()
{
_primaryColor
=
selection
;
_primaryColor
=
selection
;
});
});
...
@@ -181,14 +181,14 @@ class CardCollectionState extends State<CardCollection> {
...
@@ -181,14 +181,14 @@ class CardCollectionState extends State<CardCollection> {
);
);
}
}
Widget
buildDrawerColorRadioItem
(
String
label
,
Ma
p
<
int
,
Color
>
itemValue
,
Map
<
int
,
Color
>
currentValue
,
ValueChanged
<
Map
<
int
,
Color
>
>
onChanged
,
{
IconData
icon
,
bool
enabled:
true
})
{
Widget
buildDrawerColorRadioItem
(
String
label
,
Ma
terialColor
itemValue
,
MaterialColor
currentValue
,
ValueChanged
<
MaterialColor
>
onChanged
,
{
IconData
icon
,
bool
enabled:
true
})
{
return
new
DrawerItem
(
return
new
DrawerItem
(
icon:
new
Icon
(
icon
),
icon:
new
Icon
(
icon
),
onPressed:
enabled
?
()
{
onChanged
(
itemValue
);
}
:
null
,
onPressed:
enabled
?
()
{
onChanged
(
itemValue
);
}
:
null
,
child:
new
Row
(
child:
new
Row
(
children:
<
Widget
>[
children:
<
Widget
>[
new
Expanded
(
child:
new
Text
(
label
)),
new
Expanded
(
child:
new
Text
(
label
)),
new
Radio
<
Ma
p
<
int
,
Color
>
>(
new
Radio
<
Ma
terialColor
>(
value:
itemValue
,
value:
itemValue
,
groupValue:
currentValue
,
groupValue:
currentValue
,
onChanged:
enabled
?
onChanged
:
null
,
onChanged:
enabled
?
onChanged
:
null
,
...
...
examples/flutter_gallery/lib/demo/colors_demo.dart
View file @
031e042e
...
@@ -6,37 +6,37 @@ import 'package:flutter/material.dart';
...
@@ -6,37 +6,37 @@ import 'package:flutter/material.dart';
const
double
kColorItemHeight
=
48.0
;
const
double
kColorItemHeight
=
48.0
;
class
ColorSwatch
{
class
Palette
{
ColorSwatch
({
this
.
name
,
this
.
colors
,
this
.
accentColors
,
this
.
threshold
:
900
});
Palette
({
this
.
name
,
this
.
primary
,
this
.
accent
,
this
.
threshold
:
900
});
final
String
name
;
final
String
name
;
final
Ma
p
<
int
,
Color
>
colors
;
final
Ma
terialColor
primary
;
final
Ma
p
<
int
,
Color
>
accentColors
;
final
Ma
terialAccentColor
accent
;
final
int
threshold
;
// titles for indices > threshold are white, otherwise black
final
int
threshold
;
// titles for indices > threshold are white, otherwise black
bool
get
isValid
=>
name
!=
null
&&
colors
!=
null
&&
threshold
!=
null
;
bool
get
isValid
=>
name
!=
null
&&
primary
!=
null
&&
threshold
!=
null
;
}
}
final
List
<
ColorSwatch
>
colorSwatches
=
<
ColorSwatch
>[
final
List
<
Palette
>
allPalettes
=
<
Palette
>[
new
ColorSwatch
(
name:
'RED'
,
colors:
Colors
.
red
,
accentColors
:
Colors
.
redAccent
,
threshold:
300
),
new
Palette
(
name:
'RED'
,
primary:
Colors
.
red
,
accent
:
Colors
.
redAccent
,
threshold:
300
),
new
ColorSwatch
(
name:
'PINK'
,
colors:
Colors
.
pink
,
accentColors
:
Colors
.
pinkAccent
,
threshold:
200
),
new
Palette
(
name:
'PINK'
,
primary:
Colors
.
pink
,
accent
:
Colors
.
pinkAccent
,
threshold:
200
),
new
ColorSwatch
(
name:
'PURPLE'
,
colors:
Colors
.
purple
,
accentColors
:
Colors
.
purpleAccent
,
threshold:
200
),
new
Palette
(
name:
'PURPLE'
,
primary:
Colors
.
purple
,
accent
:
Colors
.
purpleAccent
,
threshold:
200
),
new
ColorSwatch
(
name:
'DEEP PURPLE'
,
colors:
Colors
.
deepPurple
,
accentColors
:
Colors
.
deepPurpleAccent
,
threshold:
200
),
new
Palette
(
name:
'DEEP PURPLE'
,
primary:
Colors
.
deepPurple
,
accent
:
Colors
.
deepPurpleAccent
,
threshold:
200
),
new
ColorSwatch
(
name:
'INDIGO'
,
colors:
Colors
.
indigo
,
accentColors
:
Colors
.
indigoAccent
,
threshold:
200
),
new
Palette
(
name:
'INDIGO'
,
primary:
Colors
.
indigo
,
accent
:
Colors
.
indigoAccent
,
threshold:
200
),
new
ColorSwatch
(
name:
'BLUE'
,
colors:
Colors
.
blue
,
accentColors
:
Colors
.
blueAccent
,
threshold:
400
),
new
Palette
(
name:
'BLUE'
,
primary:
Colors
.
blue
,
accent
:
Colors
.
blueAccent
,
threshold:
400
),
new
ColorSwatch
(
name:
'LIGHT BLUE'
,
colors:
Colors
.
lightBlue
,
accentColors
:
Colors
.
lightBlueAccent
,
threshold:
500
),
new
Palette
(
name:
'LIGHT BLUE'
,
primary:
Colors
.
lightBlue
,
accent
:
Colors
.
lightBlueAccent
,
threshold:
500
),
new
ColorSwatch
(
name:
'CYAN'
,
colors:
Colors
.
cyan
,
accentColors
:
Colors
.
cyanAccent
,
threshold:
600
),
new
Palette
(
name:
'CYAN'
,
primary:
Colors
.
cyan
,
accent
:
Colors
.
cyanAccent
,
threshold:
600
),
new
ColorSwatch
(
name:
'TEAL'
,
colors:
Colors
.
teal
,
accentColors
:
Colors
.
tealAccent
,
threshold:
400
),
new
Palette
(
name:
'TEAL'
,
primary:
Colors
.
teal
,
accent
:
Colors
.
tealAccent
,
threshold:
400
),
new
ColorSwatch
(
name:
'GREEN'
,
colors:
Colors
.
green
,
accentColors
:
Colors
.
greenAccent
,
threshold:
500
),
new
Palette
(
name:
'GREEN'
,
primary:
Colors
.
green
,
accent
:
Colors
.
greenAccent
,
threshold:
500
),
new
ColorSwatch
(
name:
'LIGHT GREEN'
,
colors:
Colors
.
lightGreen
,
accentColors
:
Colors
.
lightGreenAccent
,
threshold:
600
),
new
Palette
(
name:
'LIGHT GREEN'
,
primary:
Colors
.
lightGreen
,
accent
:
Colors
.
lightGreenAccent
,
threshold:
600
),
new
ColorSwatch
(
name:
'LIME'
,
colors:
Colors
.
lime
,
accentColors
:
Colors
.
limeAccent
,
threshold:
800
),
new
Palette
(
name:
'LIME'
,
primary:
Colors
.
lime
,
accent
:
Colors
.
limeAccent
,
threshold:
800
),
new
ColorSwatch
(
name:
'YELLOW'
,
colors:
Colors
.
yellow
,
accentColors
:
Colors
.
yellowAccent
),
new
Palette
(
name:
'YELLOW'
,
primary:
Colors
.
yellow
,
accent
:
Colors
.
yellowAccent
),
new
ColorSwatch
(
name:
'AMBER'
,
colors:
Colors
.
amber
,
accentColors
:
Colors
.
amberAccent
),
new
Palette
(
name:
'AMBER'
,
primary:
Colors
.
amber
,
accent
:
Colors
.
amberAccent
),
new
ColorSwatch
(
name:
'ORANGE'
,
colors:
Colors
.
orange
,
accentColors
:
Colors
.
orangeAccent
,
threshold:
700
),
new
Palette
(
name:
'ORANGE'
,
primary:
Colors
.
orange
,
accent
:
Colors
.
orangeAccent
,
threshold:
700
),
new
ColorSwatch
(
name:
'DEEP ORANGE'
,
colors:
Colors
.
deepOrange
,
accentColors
:
Colors
.
deepOrangeAccent
,
threshold:
400
),
new
Palette
(
name:
'DEEP ORANGE'
,
primary:
Colors
.
deepOrange
,
accent
:
Colors
.
deepOrangeAccent
,
threshold:
400
),
new
ColorSwatch
(
name:
'BROWN'
,
colors
:
Colors
.
brown
,
threshold:
200
),
new
Palette
(
name:
'BROWN'
,
primary
:
Colors
.
brown
,
threshold:
200
),
new
ColorSwatch
(
name:
'GREY'
,
colors
:
Colors
.
grey
,
threshold:
500
),
new
Palette
(
name:
'GREY'
,
primary
:
Colors
.
grey
,
threshold:
500
),
new
ColorSwatch
(
name:
'BLUE GREY'
,
colors
:
Colors
.
blueGrey
,
threshold:
500
),
new
Palette
(
name:
'BLUE GREY'
,
primary
:
Colors
.
blueGrey
,
threshold:
500
),
];
];
...
@@ -71,29 +71,33 @@ class ColorItem extends StatelessWidget {
...
@@ -71,29 +71,33 @@ class ColorItem extends StatelessWidget {
}
}
}
}
class
ColorSwatchTabView
extends
StatelessWidget
{
class
PaletteTabView
extends
StatelessWidget
{
ColorSwatchTabView
({
Key
key
,
this
.
swatch
})
:
super
(
key:
key
)
{
static
const
List
<
int
>
primaryKeys
=
const
<
int
>[
50
,
100
,
200
,
300
,
400
,
500
,
600
,
700
,
800
,
900
];
assert
(
swatch
!=
null
&&
swatch
.
isValid
);
static
const
List
<
int
>
accentKeys
=
const
<
int
>[
100
,
200
,
400
,
700
];
PaletteTabView
({
Key
key
,
this
.
colors
})
:
super
(
key:
key
)
{
assert
(
colors
!=
null
&&
colors
.
isValid
);
}
}
final
ColorSwatch
swatch
;
final
Palette
colors
;
@override
@override
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
final
TextTheme
textTheme
=
Theme
.
of
(
context
).
textTheme
;
final
TextTheme
textTheme
=
Theme
.
of
(
context
).
textTheme
;
final
TextStyle
whiteTextStyle
=
textTheme
.
body1
.
copyWith
(
color:
Colors
.
white
);
final
TextStyle
whiteTextStyle
=
textTheme
.
body1
.
copyWith
(
color:
Colors
.
white
);
final
TextStyle
blackTextStyle
=
textTheme
.
body1
.
copyWith
(
color:
Colors
.
black
);
final
TextStyle
blackTextStyle
=
textTheme
.
body1
.
copyWith
(
color:
Colors
.
black
);
final
List
<
Widget
>
colorItems
=
swatch
.
colors
.
k
eys
.
map
((
int
index
)
{
final
List
<
Widget
>
colorItems
=
primaryK
eys
.
map
((
int
index
)
{
return
new
DefaultTextStyle
(
return
new
DefaultTextStyle
(
style:
index
>
swatch
.
threshold
?
whiteTextStyle
:
blackTextStyle
,
style:
index
>
colors
.
threshold
?
whiteTextStyle
:
blackTextStyle
,
child:
new
ColorItem
(
index:
index
,
color:
swatch
.
colors
[
index
]),
child:
new
ColorItem
(
index:
index
,
color:
colors
.
primary
[
index
]),
);
);
}).
toList
();
}).
toList
();
if
(
swatch
.
accentColors
!=
null
)
{
if
(
colors
.
accent
!=
null
)
{
colorItems
.
addAll
(
swatch
.
accentColors
.
k
eys
.
map
((
int
index
)
{
colorItems
.
addAll
(
accentK
eys
.
map
((
int
index
)
{
return
new
DefaultTextStyle
(
return
new
DefaultTextStyle
(
style:
index
>
swatch
.
threshold
?
whiteTextStyle
:
blackTextStyle
,
style:
index
>
colors
.
threshold
?
whiteTextStyle
:
blackTextStyle
,
child:
new
ColorItem
(
index:
index
,
color:
swatch
.
accentColors
[
index
],
prefix:
'A'
),
child:
new
ColorItem
(
index:
index
,
color:
colors
.
accent
[
index
],
prefix:
'A'
),
);
);
}).
toList
());
}).
toList
());
}
}
...
@@ -111,19 +115,19 @@ class ColorsDemo extends StatelessWidget {
...
@@ -111,19 +115,19 @@ class ColorsDemo extends StatelessWidget {
@override
@override
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
return
new
DefaultTabController
(
return
new
DefaultTabController
(
length:
colorSwatch
es
.
length
,
length:
allPalett
es
.
length
,
child:
new
Scaffold
(
child:
new
Scaffold
(
appBar:
new
AppBar
(
appBar:
new
AppBar
(
elevation:
0
,
elevation:
0
,
title:
new
Text
(
'Colors'
),
title:
new
Text
(
'Colors'
),
bottom:
new
TabBar
(
bottom:
new
TabBar
(
isScrollable:
true
,
isScrollable:
true
,
tabs:
colorSwatches
.
map
((
ColorSwatch
swatch
)
=>
new
Tab
(
text:
swatch
.
name
)).
toList
(),
tabs:
allPalettes
.
map
((
Palette
swatch
)
=>
new
Tab
(
text:
swatch
.
name
)).
toList
(),
),
),
),
),
body:
new
TabBarView
(
body:
new
TabBarView
(
children:
colorSwatches
.
map
((
ColorSwatch
swatch
)
{
children:
allPalettes
.
map
((
Palette
colors
)
{
return
new
ColorSwatchTabView
(
swatch:
swatch
);
return
new
PaletteTabView
(
colors:
colors
);
}).
toList
(),
}).
toList
(),
),
),
),
),
...
...
examples/flutter_gallery/lib/demo/material/icons_demo.dart
View file @
031e042e
...
@@ -12,7 +12,7 @@ class IconsDemo extends StatefulWidget {
...
@@ -12,7 +12,7 @@ class IconsDemo extends StatefulWidget {
}
}
class
IconsDemoState
extends
State
<
IconsDemo
>
{
class
IconsDemoState
extends
State
<
IconsDemo
>
{
static
final
List
<
Ma
p
<
int
,
Color
>>
iconColorSwatches
=
<
Map
<
int
,
Color
>
>[
static
final
List
<
Ma
terialColor
>
iconColors
=
<
MaterialColor
>[
Colors
.
red
,
Colors
.
red
,
Colors
.
pink
,
Colors
.
pink
,
Colors
.
purple
,
Colors
.
purple
,
...
@@ -31,17 +31,17 @@ class IconsDemoState extends State<IconsDemo> {
...
@@ -31,17 +31,17 @@ class IconsDemoState extends State<IconsDemo> {
Colors
.
deepOrange
,
Colors
.
deepOrange
,
Colors
.
brown
,
Colors
.
brown
,
Colors
.
grey
,
Colors
.
grey
,
Colors
.
blueGrey
Colors
.
blueGrey
,
];
];
int
iconColorIndex
=
8
;
// teal
int
iconColorIndex
=
8
;
// teal
double
iconOpacity
=
1.0
;
double
iconOpacity
=
1.0
;
Color
get
iconColor
=>
iconColor
Swatches
[
iconColorIndex
][
400
];
Color
get
iconColor
=>
iconColor
s
[
iconColorIndex
];
void
handleIconButtonPress
()
{
void
handleIconButtonPress
()
{
setState
(()
{
setState
(()
{
iconColorIndex
=
(
iconColorIndex
+
1
)
%
iconColor
Swatche
s
.
length
;
iconColorIndex
=
(
iconColorIndex
+
1
)
%
iconColors
.
length
;
});
});
}
}
...
...
examples/flutter_gallery/lib/demo/material/tabs_fab_demo.dart
View file @
031e042e
...
@@ -14,7 +14,7 @@ class _Page {
...
@@ -14,7 +14,7 @@ class _Page {
_Page
({
this
.
label
,
this
.
colors
,
this
.
icon
});
_Page
({
this
.
label
,
this
.
colors
,
this
.
icon
});
final
String
label
;
final
String
label
;
final
Ma
p
<
int
,
Color
>
colors
;
final
Ma
terialColor
colors
;
final
IconData
icon
;
final
IconData
icon
;
Color
get
labelColor
=>
colors
!=
null
?
colors
[
300
]
:
Colors
.
grey
[
300
];
Color
get
labelColor
=>
colors
!=
null
?
colors
[
300
]
:
Colors
.
grey
[
300
];
...
...
examples/flutter_gallery/lib/gallery/drawer.dart
View file @
031e042e
...
@@ -31,7 +31,7 @@ class GalleryDrawerHeader extends StatefulWidget {
...
@@ -31,7 +31,7 @@ class GalleryDrawerHeader extends StatefulWidget {
class
_GalleryDrawerHeaderState
extends
State
<
GalleryDrawerHeader
>
{
class
_GalleryDrawerHeaderState
extends
State
<
GalleryDrawerHeader
>
{
bool
_logoHasName
=
true
;
bool
_logoHasName
=
true
;
bool
_logoHorizontal
=
true
;
bool
_logoHorizontal
=
true
;
Ma
p
<
int
,
Color
>
_swatch
=
Colors
.
blue
;
Ma
terialColor
_logoColor
=
Colors
.
blue
;
@override
@override
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
...
@@ -43,7 +43,8 @@ class _GalleryDrawerHeaderState extends State<GalleryDrawerHeader> {
...
@@ -43,7 +43,8 @@ class _GalleryDrawerHeaderState extends State<GalleryDrawerHeader> {
style:
_logoHasName
?
_logoHorizontal
?
FlutterLogoStyle
.
horizontal
style:
_logoHasName
?
_logoHorizontal
?
FlutterLogoStyle
.
horizontal
:
FlutterLogoStyle
.
stacked
:
FlutterLogoStyle
.
stacked
:
FlutterLogoStyle
.
markOnly
,
:
FlutterLogoStyle
.
markOnly
,
swatch:
_swatch
,
lightColor:
_logoColor
.
shade400
,
darkColor:
_logoColor
.
shade900
,
textColor:
config
.
light
?
const
Color
(
0xFF616161
)
:
const
Color
(
0xFF9E9E9E
),
textColor:
config
.
light
?
const
Color
(
0xFF616161
)
:
const
Color
(
0xFF9E9E9E
),
),
),
duration:
const
Duration
(
milliseconds:
750
),
duration:
const
Duration
(
milliseconds:
750
),
...
@@ -62,22 +63,22 @@ class _GalleryDrawerHeaderState extends State<GalleryDrawerHeader> {
...
@@ -62,22 +63,22 @@ class _GalleryDrawerHeaderState extends State<GalleryDrawerHeader> {
},
},
onDoubleTap:
()
{
onDoubleTap:
()
{
setState
(()
{
setState
(()
{
final
List
<
Ma
p
<
int
,
Color
>>
options
=
<
Map
<
int
,
Color
>
>[];
final
List
<
Ma
terialColor
>
options
=
<
MaterialColor
>[];
if
(
_
swatch
!=
Colors
.
blue
)
if
(
_
logoColor
!=
Colors
.
blue
)
options
.
addAll
(<
Ma
p
<
int
,
Color
>
>[
Colors
.
blue
,
Colors
.
blue
,
Colors
.
blue
,
Colors
.
blue
,
Colors
.
blue
,
Colors
.
blue
,
Colors
.
blue
]);
options
.
addAll
(<
Ma
terialColor
>[
Colors
.
blue
,
Colors
.
blue
,
Colors
.
blue
,
Colors
.
blue
,
Colors
.
blue
,
Colors
.
blue
,
Colors
.
blue
]);
if
(
_
swatch
!=
Colors
.
amber
)
if
(
_
logoColor
!=
Colors
.
amber
)
options
.
addAll
(<
Ma
p
<
int
,
Color
>
>[
Colors
.
amber
,
Colors
.
amber
,
Colors
.
amber
]);
options
.
addAll
(<
Ma
terialColor
>[
Colors
.
amber
,
Colors
.
amber
,
Colors
.
amber
]);
if
(
_
swatch
!=
Colors
.
red
)
if
(
_
logoColor
!=
Colors
.
red
)
options
.
addAll
(<
Ma
p
<
int
,
Color
>
>[
Colors
.
red
,
Colors
.
red
,
Colors
.
red
]);
options
.
addAll
(<
Ma
terialColor
>[
Colors
.
red
,
Colors
.
red
,
Colors
.
red
]);
if
(
_
swatch
!=
Colors
.
indigo
)
if
(
_
logoColor
!=
Colors
.
indigo
)
options
.
addAll
(<
Ma
p
<
int
,
Color
>
>[
Colors
.
indigo
,
Colors
.
indigo
,
Colors
.
indigo
]);
options
.
addAll
(<
Ma
terialColor
>[
Colors
.
indigo
,
Colors
.
indigo
,
Colors
.
indigo
]);
if
(
_
swatch
!=
Colors
.
pink
)
if
(
_
logoColor
!=
Colors
.
pink
)
options
.
addAll
(<
Ma
p
<
int
,
Color
>
>[
Colors
.
pink
]);
options
.
addAll
(<
Ma
terialColor
>[
Colors
.
pink
]);
if
(
_
swatch
!=
Colors
.
purple
)
if
(
_
logoColor
!=
Colors
.
purple
)
options
.
addAll
(<
Ma
p
<
int
,
Color
>
>[
Colors
.
purple
]);
options
.
addAll
(<
Ma
terialColor
>[
Colors
.
purple
]);
if
(
_
swatch
!=
Colors
.
cyan
)
if
(
_
logoColor
!=
Colors
.
cyan
)
options
.
addAll
(<
Ma
p
<
int
,
Color
>
>[
Colors
.
cyan
]);
options
.
addAll
(<
Ma
terialColor
>[
Colors
.
cyan
]);
_
swatch
=
options
[
new
math
.
Random
().
nextInt
(
options
.
length
)];
_
logoColor
=
options
[
new
math
.
Random
().
nextInt
(
options
.
length
)];
});
});
}
}
)
)
...
...
examples/layers/widgets/gestures.dart
View file @
031e042e
...
@@ -18,7 +18,7 @@ class _GesturePainter extends CustomPainter {
...
@@ -18,7 +18,7 @@ class _GesturePainter extends CustomPainter {
final
double
zoom
;
final
double
zoom
;
final
Offset
offset
;
final
Offset
offset
;
final
Ma
p
<
int
,
Color
>
swatch
;
final
Ma
terialColor
swatch
;
final
bool
forward
;
final
bool
forward
;
final
bool
scaleEnabled
;
final
bool
scaleEnabled
;
final
bool
tapEnabled
;
final
bool
tapEnabled
;
...
@@ -71,7 +71,7 @@ class _GestureDemoState extends State<GestureDemo> {
...
@@ -71,7 +71,7 @@ class _GestureDemoState extends State<GestureDemo> {
double
_previousZoom
;
double
_previousZoom
;
double
_zoom
=
1.0
;
double
_zoom
=
1.0
;
Ma
p
<
int
,
Color
>
_swatch
=
Colors
.
blue
;
Ma
terialColor
_swatch
=
Colors
.
blue
;
bool
_forward
=
true
;
bool
_forward
=
true
;
bool
_scaleEnabled
=
true
;
bool
_scaleEnabled
=
true
;
...
@@ -106,28 +106,42 @@ class _GestureDemoState extends State<GestureDemo> {
...
@@ -106,28 +106,42 @@ class _GestureDemoState extends State<GestureDemo> {
void
_handleColorChange
()
{
void
_handleColorChange
()
{
setState
(()
{
setState
(()
{
switch
(
_swatch
)
{
if
(
_swatch
==
Colors
.
blueGrey
)
case
Colors
.
blueGrey
:
_swatch
=
Colors
.
red
;
break
;
_swatch
=
Colors
.
red
;
case
Colors
.
red
:
_swatch
=
Colors
.
pink
;
break
;
else
if
(
_swatch
==
Colors
.
red
)
case
Colors
.
pink
:
_swatch
=
Colors
.
purple
;
break
;
_swatch
=
Colors
.
pink
;
case
Colors
.
purple
:
_swatch
=
Colors
.
deepPurple
;
break
;
else
if
(
_swatch
==
Colors
.
pink
)
case
Colors
.
deepPurple
:
_swatch
=
Colors
.
indigo
;
break
;
_swatch
=
Colors
.
purple
;
case
Colors
.
indigo
:
_swatch
=
Colors
.
blue
;
break
;
else
if
(
_swatch
==
Colors
.
purple
)
case
Colors
.
blue
:
_swatch
=
Colors
.
lightBlue
;
break
;
_swatch
=
Colors
.
deepPurple
;
case
Colors
.
lightBlue
:
_swatch
=
Colors
.
cyan
;
break
;
else
if
(
_swatch
==
Colors
.
deepPurple
)
case
Colors
.
cyan
:
_swatch
=
Colors
.
teal
;
break
;
_swatch
=
Colors
.
indigo
;
case
Colors
.
teal
:
_swatch
=
Colors
.
green
;
break
;
else
if
(
_swatch
==
Colors
.
indigo
)
case
Colors
.
green
:
_swatch
=
Colors
.
lightGreen
;
break
;
_swatch
=
Colors
.
blue
;
case
Colors
.
lightGreen
:
_swatch
=
Colors
.
lime
;
break
;
else
if
(
_swatch
==
Colors
.
blue
)
case
Colors
.
lime
:
_swatch
=
Colors
.
yellow
;
break
;
_swatch
=
Colors
.
lightBlue
;
case
Colors
.
yellow
:
_swatch
=
Colors
.
amber
;
break
;
else
if
(
_swatch
==
Colors
.
lightBlue
)
case
Colors
.
amber
:
_swatch
=
Colors
.
orange
;
break
;
_swatch
=
Colors
.
cyan
;
case
Colors
.
orange
:
_swatch
=
Colors
.
deepOrange
;
break
;
else
if
(
_swatch
==
Colors
.
teal
)
case
Colors
.
deepOrange
:
_swatch
=
Colors
.
brown
;
break
;
_swatch
=
Colors
.
green
;
case
Colors
.
brown
:
_swatch
=
Colors
.
grey
;
break
;
else
if
(
_swatch
==
Colors
.
green
)
case
Colors
.
grey
:
_swatch
=
Colors
.
blueGrey
;
break
;
_swatch
=
Colors
.
lightGreen
;
default
:
assert
(
false
);
else
if
(
_swatch
==
Colors
.
lightGreen
)
}
_swatch
=
Colors
.
lime
;
else
if
(
_swatch
==
Colors
.
lime
)
_swatch
=
Colors
.
yellow
;
else
if
(
_swatch
==
Colors
.
yellow
)
_swatch
=
Colors
.
amber
;
else
if
(
_swatch
==
Colors
.
amber
)
_swatch
=
Colors
.
orange
;
else
if
(
_swatch
==
Colors
.
orange
)
_swatch
=
Colors
.
deepOrange
;
else
if
(
_swatch
==
Colors
.
deepOrange
)
_swatch
=
Colors
.
brown
;
else
if
(
_swatch
==
Colors
.
brown
)
_swatch
=
Colors
.
grey
;
else
if
(
_swatch
==
Colors
.
grey
)
_swatch
=
Colors
.
blueGrey
;
});
});
}
}
...
...
packages/flutter/lib/src/material/colors.dart
View file @
031e042e
...
@@ -2,9 +2,85 @@
...
@@ -2,9 +2,85 @@
// 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
'dart:ui'
show
Color
;
import
'dart:ui'
show
Color
,
hashValues
;
/// [Color] constants which represent Material design's
/// A color that has a small table of related colors called a "swatch".
///
/// See also:
///
/// * [MaterialColor] and [MaterialAccentColor], which define material design
/// primary and accent color swatches.
/// * [Colors], which defines all of the standard material design colors.
class
ColorSwatch
extends
Color
{
// Creates a color that has a small table of related colors called a "swatch".
const
ColorSwatch
(
int
primary
,
this
.
_swatch
)
:
super
(
primary
);
final
Map
<
int
,
Color
>
_swatch
;
/// Returns an element of the [swatch] table.
Color
operator
[](
int
index
)
=>
_swatch
[
index
];
@override
bool
operator
==(
dynamic
other
)
{
if
(
identical
(
this
,
other
))
return
true
;
if
(
other
.
runtimeType
!=
runtimeType
)
return
false
;
final
ColorSwatch
typedOther
=
other
;
return
super
==(
other
)
&&
_swatch
==
typedOther
.
_swatch
;
}
@override
int
get
hashCode
=>
hashValues
(
runtimeType
,
value
,
_swatch
);
@override
String
toString
()
=>
'
$runtimeType
(primary value:
${super.toString()}
)'
;
}
/// Defines a single color as well a color swatch with ten shades of the color.
///
/// The color's shades are referred to by index. The greater the index, the
/// darker the color. There are 10 valid indices: 50, 100, 200, ..., 900.
/// The value of this color should the same the value of index 500 and [shade500].
///
/// See also:
///
/// * [Colors], which defines all of the standard material colors.
class
MaterialColor
extends
ColorSwatch
{
const
MaterialColor
(
int
primary
,
Map
<
int
,
Color
>
swatch
)
:
super
(
primary
,
swatch
);
Color
get
shade50
=>
_swatch
[
50
];
Color
get
shade100
=>
_swatch
[
100
];
Color
get
shade200
=>
_swatch
[
200
];
Color
get
shade300
=>
_swatch
[
300
];
Color
get
shade400
=>
_swatch
[
400
];
Color
get
shade500
=>
_swatch
[
500
];
Color
get
shade600
=>
_swatch
[
600
];
Color
get
shade700
=>
_swatch
[
700
];
Color
get
shade800
=>
_swatch
[
800
];
Color
get
shade900
=>
_swatch
[
900
];
}
/// Defines a single accent color as well a swatch of four shades of the
/// accent color.
///
/// The color's shades are referred to by index, the colors with smaller
/// indices are lighter, larger indices are darker. There are four valid
/// indices: 100, 200, 400, and 700. The value of this color should be the
/// same as the value of index 200 and [shade200].
///
/// See also:
///
/// * [Colors], which defines all of the standard material colors.
class
MaterialAccentColor
extends
ColorSwatch
{
const
MaterialAccentColor
(
int
primary
,
Map
<
int
,
Color
>
swatch
)
:
super
(
primary
,
swatch
);
Color
get
shade100
=>
_swatch
[
100
];
Color
get
shade200
=>
_swatch
[
200
];
Color
get
shade400
=>
_swatch
[
400
];
Color
get
shade700
=>
_swatch
[
700
];
}
/// [Color] and [ColorSwatch] constants which represent Material design's
/// [color palette](http://material.google.com/style/color.html).
/// [color palette](http://material.google.com/style/color.html).
///
///
/// Instead of using an absolute color from these palettes, consider using
/// Instead of using an absolute color from these palettes, consider using
...
@@ -19,6 +95,14 @@ import 'dart:ui' show Color;
...
@@ -19,6 +95,14 @@ import 'dart:ui' show Color;
/// Colors.green[400] // Selects a mid-range green.
/// Colors.green[400] // Selects a mid-range green.
/// ```
/// ```
///
///
/// Each ColorSwatch constant is a color and can used directly. For example
///
/// ```dart
/// new Container(
/// color: Colors.blue, // same as Colors.blue[500] or Colors.blue.shade500
/// )
/// ```
///
/// Most swatches have colors from 100 to 900 in increments of one hundred, plus
/// Most swatches have colors from 100 to 900 in increments of one hundred, plus
/// the color 50. The smaller the number, the more pale the color. The greater
/// the color 50. The smaller the number, the more pale the color. The greater
/// the number, the darker the color. The accent swatches (e.g. [redAccent]) only
/// the number, the darker the color. The accent swatches (e.g. [redAccent]) only
...
@@ -128,7 +212,7 @@ class Colors {
...
@@ -128,7 +212,7 @@ class Colors {
static
const
Color
white10
=
const
Color
(
0x1AFFFFFF
);
static
const
Color
white10
=
const
Color
(
0x1AFFFFFF
);
/// The red primary swatch.
/// The red primary
color and
swatch.
///
///
/// ```dart
/// ```dart
/// new Icon(
/// new Icon(
...
@@ -142,18 +226,22 @@ class Colors {
...
@@ -142,18 +226,22 @@ class Colors {
/// * [redAccent], the corresponding accent colors.
/// * [redAccent], the corresponding accent colors.
/// * [Theme.of], which allows you to select colors from the current theme
/// * [Theme.of], which allows you to select colors from the current theme
/// rather than hard-coding colors in your build methods.
/// rather than hard-coding colors in your build methods.
static
const
Map
<
int
,
Color
>
red
=
const
<
int
,
Color
>{
static
const
int
_redPrimaryValue
=
0xFFF44336
;
50
:
const
Color
(
0xFFFFEBEE
),
static
const
MaterialColor
red
=
const
MaterialColor
(
100
:
const
Color
(
0xFFFFCDD2
),
_redPrimaryValue
,
200
:
const
Color
(
0xFFEF9A9A
),
const
<
int
,
Color
>{
300
:
const
Color
(
0xFFE57373
),
50
:
const
Color
(
0xFFFFEBEE
),
400
:
const
Color
(
0xFFEF5350
),
100
:
const
Color
(
0xFFFFCDD2
),
500
:
const
Color
(
0xFFF44336
),
200
:
const
Color
(
0xFFEF9A9A
),
600
:
const
Color
(
0xFFE53935
),
300
:
const
Color
(
0xFFE57373
),
700
:
const
Color
(
0xFFD32F2F
),
400
:
const
Color
(
0xFFEF5350
),
800
:
const
Color
(
0xFFC62828
),
500
:
const
Color
(
_redPrimaryValue
),
900
:
const
Color
(
0xFFB71C1C
),
600
:
const
Color
(
0xFFE53935
),
};
700
:
const
Color
(
0xFFD32F2F
),
800
:
const
Color
(
0xFFC62828
),
900
:
const
Color
(
0xFFB71C1C
),
},
);
/// The red accent swatch.
/// The red accent swatch.
///
///
...
@@ -169,14 +257,18 @@ class Colors {
...
@@ -169,14 +257,18 @@ class Colors {
/// * [red], the corresponding primary colors.
/// * [red], the corresponding primary colors.
/// * [Theme.of], which allows you to select colors from the current theme
/// * [Theme.of], which allows you to select colors from the current theme
/// rather than hard-coding colors in your build methods.
/// rather than hard-coding colors in your build methods.
static
const
Map
<
int
,
Color
>
redAccent
=
const
<
int
,
Color
>{
static
const
int
_redAccentValue
=
0xFFFF5252
;
100
:
const
Color
(
0xFFFF8A80
),
static
const
MaterialAccentColor
redAccent
=
const
MaterialAccentColor
(
200
:
const
Color
(
0xFFFF5252
),
_redAccentValue
,
400
:
const
Color
(
0xFFFF1744
),
const
<
int
,
Color
>{
700
:
const
Color
(
0xFFD50000
),
100
:
const
Color
(
0xFFFF8A80
),
};
200
:
const
Color
(
_redAccentValue
),
400
:
const
Color
(
0xFFFF1744
),
700
:
const
Color
(
0xFFD50000
),
},
);
/// The pink primary swatch.
/// The pink primary
color and
swatch.
///
///
/// ```dart
/// ```dart
/// new Icon(
/// new Icon(
...
@@ -190,20 +282,24 @@ class Colors {
...
@@ -190,20 +282,24 @@ class Colors {
/// * [pinkAccent], the corresponding accent colors.
/// * [pinkAccent], the corresponding accent colors.
/// * [Theme.of], which allows you to select colors from the current theme
/// * [Theme.of], which allows you to select colors from the current theme
/// rather than hard-coding colors in your build methods.
/// rather than hard-coding colors in your build methods.
static
const
Map
<
int
,
Color
>
pink
=
const
<
int
,
Color
>{
static
const
int
_pinkPrimaryValue
=
0xFFE91E63
;
50
:
const
Color
(
0xFFFCE4EC
),
static
const
MaterialColor
pink
=
const
MaterialColor
(
100
:
const
Color
(
0xFFF8BBD0
),
_pinkPrimaryValue
,
200
:
const
Color
(
0xFFF48FB1
),
const
<
int
,
Color
>{
300
:
const
Color
(
0xFFF06292
),
50
:
const
Color
(
0xFFFCE4EC
),
400
:
const
Color
(
0xFFEC407A
),
100
:
const
Color
(
0xFFF8BBD0
),
500
:
const
Color
(
0xFFE91E63
),
200
:
const
Color
(
0xFFF48FB1
),
600
:
const
Color
(
0xFFD81B60
),
300
:
const
Color
(
0xFFF06292
),
700
:
const
Color
(
0xFFC2185B
),
400
:
const
Color
(
0xFFEC407A
),
800
:
const
Color
(
0xFFAD1457
),
500
:
const
Color
(
_pinkPrimaryValue
),
900
:
const
Color
(
0xFF880E4F
),
600
:
const
Color
(
0xFFD81B60
),
};
700
:
const
Color
(
0xFFC2185B
),
800
:
const
Color
(
0xFFAD1457
),
/// The pink accent swatch.
900
:
const
Color
(
0xFF880E4F
),
},
);
/// The pink accent color swatch.
///
///
/// ```dart
/// ```dart
/// new Icon(
/// new Icon(
...
@@ -217,14 +313,18 @@ class Colors {
...
@@ -217,14 +313,18 @@ class Colors {
/// * [pink], the corresponding primary colors.
/// * [pink], the corresponding primary colors.
/// * [Theme.of], which allows you to select colors from the current theme
/// * [Theme.of], which allows you to select colors from the current theme
/// rather than hard-coding colors in your build methods.
/// rather than hard-coding colors in your build methods.
static
const
Map
<
int
,
Color
>
pinkAccent
=
const
<
int
,
Color
>{
static
const
int
_pinkAccentPrimaryValue
=
0xFFFF4081
;
100
:
const
Color
(
0xFFFF80AB
),
static
const
MaterialAccentColor
pinkAccent
=
const
MaterialAccentColor
(
200
:
const
Color
(
0xFFFF4081
),
_pinkAccentPrimaryValue
,
400
:
const
Color
(
0xFFF50057
),
const
<
int
,
Color
>{
700
:
const
Color
(
0xFFC51162
),
100
:
const
Color
(
0xFFFF80AB
),
};
200
:
const
Color
(
_pinkAccentPrimaryValue
),
400
:
const
Color
(
0xFFF50057
),
700
:
const
Color
(
0xFFC51162
),
},
);
/// The purple primary swatch.
/// The purple primary
color and
swatch.
///
///
/// ```dart
/// ```dart
/// new Icon(
/// new Icon(
...
@@ -238,20 +338,24 @@ class Colors {
...
@@ -238,20 +338,24 @@ class Colors {
/// * [purpleAccent], the corresponding accent colors.
/// * [purpleAccent], the corresponding accent colors.
/// * [Theme.of], which allows you to select colors from the current theme
/// * [Theme.of], which allows you to select colors from the current theme
/// rather than hard-coding colors in your build methods.
/// rather than hard-coding colors in your build methods.
static
const
Map
<
int
,
Color
>
purple
=
const
<
int
,
Color
>{
static
const
int
_purplePrimaryValue
=
0xFF9C27B0
;
50
:
const
Color
(
0xFFF3E5F5
),
static
const
MaterialColor
purple
=
const
MaterialColor
(
100
:
const
Color
(
0xFFE1BEE7
),
_purplePrimaryValue
,
200
:
const
Color
(
0xFFCE93D8
),
const
<
int
,
Color
>{
300
:
const
Color
(
0xFFBA68C8
),
50
:
const
Color
(
0xFFF3E5F5
),
400
:
const
Color
(
0xFFAB47BC
),
100
:
const
Color
(
0xFFE1BEE7
),
500
:
const
Color
(
0xFF9C27B0
),
200
:
const
Color
(
0xFFCE93D8
),
600
:
const
Color
(
0xFF8E24AA
),
300
:
const
Color
(
0xFFBA68C8
),
700
:
const
Color
(
0xFF7B1FA2
),
400
:
const
Color
(
0xFFAB47BC
),
800
:
const
Color
(
0xFF6A1B9A
),
500
:
const
Color
(
_purplePrimaryValue
),
900
:
const
Color
(
0xFF4A148C
),
600
:
const
Color
(
0xFF8E24AA
),
};
700
:
const
Color
(
0xFF7B1FA2
),
800
:
const
Color
(
0xFF6A1B9A
),
/// The purple accent swatch.
900
:
const
Color
(
0xFF4A148C
),
},
);
/// The purple accent color and swatch.
///
///
/// ```dart
/// ```dart
/// new Icon(
/// new Icon(
...
@@ -265,14 +369,18 @@ class Colors {
...
@@ -265,14 +369,18 @@ class Colors {
/// * [purple], the corresponding primary colors.
/// * [purple], the corresponding primary colors.
/// * [Theme.of], which allows you to select colors from the current theme
/// * [Theme.of], which allows you to select colors from the current theme
/// rather than hard-coding colors in your build methods.
/// rather than hard-coding colors in your build methods.
static
const
Map
<
int
,
Color
>
purpleAccent
=
const
<
int
,
Color
>{
static
const
int
_purpleAccentPrimaryValue
=
0xFFE040FB
;
100
:
const
Color
(
0xFFEA80FC
),
static
const
MaterialAccentColor
purpleAccent
=
const
MaterialAccentColor
(
200
:
const
Color
(
0xFFE040FB
),
_purpleAccentPrimaryValue
,
400
:
const
Color
(
0xFFD500F9
),
const
<
int
,
Color
>{
700
:
const
Color
(
0xFFAA00FF
),
100
:
const
Color
(
0xFFEA80FC
),
};
200
:
const
Color
(
_purpleAccentPrimaryValue
),
400
:
const
Color
(
0xFFD500F9
),
700
:
const
Color
(
0xFFAA00FF
),
},
);
/// The deep purple primary swatch.
/// The deep purple primary
color and
swatch.
///
///
/// ```dart
/// ```dart
/// new Icon(
/// new Icon(
...
@@ -286,20 +394,24 @@ class Colors {
...
@@ -286,20 +394,24 @@ class Colors {
/// * [deepPurpleAccent], the corresponding accent colors.
/// * [deepPurpleAccent], the corresponding accent colors.
/// * [Theme.of], which allows you to select colors from the current theme
/// * [Theme.of], which allows you to select colors from the current theme
/// rather than hard-coding colors in your build methods.
/// rather than hard-coding colors in your build methods.
static
const
Map
<
int
,
Color
>
deepPurple
=
const
<
int
,
Color
>{
static
const
int
_deepPurplePrimaryValue
=
0xFF673AB7
;
50
:
const
Color
(
0xFFEDE7F6
),
static
const
MaterialColor
deepPurple
=
const
MaterialColor
(
100
:
const
Color
(
0xFFD1C4E9
),
_deepPurplePrimaryValue
,
200
:
const
Color
(
0xFFB39DDB
),
const
<
int
,
Color
>{
300
:
const
Color
(
0xFF9575CD
),
50
:
const
Color
(
0xFFEDE7F6
),
400
:
const
Color
(
0xFF7E57C2
),
100
:
const
Color
(
0xFFD1C4E9
),
500
:
const
Color
(
0xFF673AB7
),
200
:
const
Color
(
0xFFB39DDB
),
600
:
const
Color
(
0xFF5E35B1
),
300
:
const
Color
(
0xFF9575CD
),
700
:
const
Color
(
0xFF512DA8
),
400
:
const
Color
(
0xFF7E57C2
),
800
:
const
Color
(
0xFF4527A0
),
500
:
const
Color
(
_deepPurplePrimaryValue
),
900
:
const
Color
(
0xFF311B92
),
600
:
const
Color
(
0xFF5E35B1
),
};
700
:
const
Color
(
0xFF512DA8
),
800
:
const
Color
(
0xFF4527A0
),
/// The deep purple accent swatch.
900
:
const
Color
(
0xFF311B92
),
},
);
/// The deep purple accent color and swatch.
///
///
/// ```dart
/// ```dart
/// new Icon(
/// new Icon(
...
@@ -313,14 +425,18 @@ class Colors {
...
@@ -313,14 +425,18 @@ class Colors {
/// * [deepPurple], the corresponding primary colors.
/// * [deepPurple], the corresponding primary colors.
/// * [Theme.of], which allows you to select colors from the current theme
/// * [Theme.of], which allows you to select colors from the current theme
/// rather than hard-coding colors in your build methods.
/// rather than hard-coding colors in your build methods.
static
const
Map
<
int
,
Color
>
deepPurpleAccent
=
const
<
int
,
Color
>{
static
const
int
_deepPurpleAccentPrimaryValue
=
0xFF7C4DFF
;
100
:
const
Color
(
0xFFB388FF
),
static
const
MaterialAccentColor
deepPurpleAccent
=
const
MaterialAccentColor
(
200
:
const
Color
(
0xFF7C4DFF
),
_deepPurpleAccentPrimaryValue
,
400
:
const
Color
(
0xFF651FFF
),
const
<
int
,
Color
>{
700
:
const
Color
(
0xFF6200EA
),
100
:
const
Color
(
0xFFB388FF
),
};
200
:
const
Color
(
_deepPurpleAccentPrimaryValue
),
400
:
const
Color
(
0xFF651FFF
),
700
:
const
Color
(
0xFF6200EA
),
},
);
/// The indigo primary swatch.
/// The indigo primary
color and
swatch.
///
///
/// ```dart
/// ```dart
/// new Icon(
/// new Icon(
...
@@ -334,20 +450,24 @@ class Colors {
...
@@ -334,20 +450,24 @@ class Colors {
/// * [indigoAccent], the corresponding accent colors.
/// * [indigoAccent], the corresponding accent colors.
/// * [Theme.of], which allows you to select colors from the current theme
/// * [Theme.of], which allows you to select colors from the current theme
/// rather than hard-coding colors in your build methods.
/// rather than hard-coding colors in your build methods.
static
const
Map
<
int
,
Color
>
indigo
=
const
<
int
,
Color
>{
static
const
int
_indigoPrimaryValue
=
0xFF3F51B5
;
50
:
const
Color
(
0xFFE8EAF6
),
static
const
MaterialColor
indigo
=
const
MaterialColor
(
100
:
const
Color
(
0xFFC5CAE9
),
_indigoPrimaryValue
,
200
:
const
Color
(
0xFF9FA8DA
),
const
<
int
,
Color
>{
300
:
const
Color
(
0xFF7986CB
),
50
:
const
Color
(
0xFFE8EAF6
),
400
:
const
Color
(
0xFF5C6BC0
),
100
:
const
Color
(
0xFFC5CAE9
),
500
:
const
Color
(
0xFF3F51B5
),
200
:
const
Color
(
0xFF9FA8DA
),
600
:
const
Color
(
0xFF3949AB
),
300
:
const
Color
(
0xFF7986CB
),
700
:
const
Color
(
0xFF303F9F
),
400
:
const
Color
(
0xFF5C6BC0
),
800
:
const
Color
(
0xFF283593
),
500
:
const
Color
(
_indigoPrimaryValue
),
900
:
const
Color
(
0xFF1A237E
),
600
:
const
Color
(
0xFF3949AB
),
};
700
:
const
Color
(
0xFF303F9F
),
800
:
const
Color
(
0xFF283593
),
/// The indigo accent swatch.
900
:
const
Color
(
0xFF1A237E
),
},
);
/// The indigo accent color and swatch.
///
///
/// ```dart
/// ```dart
/// new Icon(
/// new Icon(
...
@@ -361,14 +481,18 @@ class Colors {
...
@@ -361,14 +481,18 @@ class Colors {
/// * [indigo], the corresponding primary colors.
/// * [indigo], the corresponding primary colors.
/// * [Theme.of], which allows you to select colors from the current theme
/// * [Theme.of], which allows you to select colors from the current theme
/// rather than hard-coding colors in your build methods.
/// rather than hard-coding colors in your build methods.
static
const
Map
<
int
,
Color
>
indigoAccent
=
const
<
int
,
Color
>{
static
const
int
_indigoAccentPrimaryValue
=
0xFF536DFE
;
100
:
const
Color
(
0xFF8C9EFF
),
static
const
MaterialAccentColor
indigoAccent
=
const
MaterialAccentColor
(
200
:
const
Color
(
0xFF536DFE
),
_indigoAccentPrimaryValue
,
400
:
const
Color
(
0xFF3D5AFE
),
const
<
int
,
Color
>{
700
:
const
Color
(
0xFF304FFE
),
100
:
const
Color
(
0xFF8C9EFF
),
};
200
:
const
Color
(
_indigoAccentPrimaryValue
),
400
:
const
Color
(
0xFF3D5AFE
),
700
:
const
Color
(
0xFF304FFE
),
},
);
/// The blue primary swatch.
/// The blue primary
color and
swatch.
///
///
/// ```dart
/// ```dart
/// new Icon(
/// new Icon(
...
@@ -382,20 +506,24 @@ class Colors {
...
@@ -382,20 +506,24 @@ class Colors {
/// * [blueAccent], the corresponding accent colors.
/// * [blueAccent], the corresponding accent colors.
/// * [Theme.of], which allows you to select colors from the current theme
/// * [Theme.of], which allows you to select colors from the current theme
/// rather than hard-coding colors in your build methods.
/// rather than hard-coding colors in your build methods.
static
const
Map
<
int
,
Color
>
blue
=
const
<
int
,
Color
>{
static
const
int
_bluePrimaryValue
=
0xFF2196F3
;
50
:
const
Color
(
0xFFE3F2FD
),
static
const
MaterialColor
blue
=
const
MaterialColor
(
100
:
const
Color
(
0xFFBBDEFB
),
_bluePrimaryValue
,
200
:
const
Color
(
0xFF90CAF9
),
const
<
int
,
Color
>{
300
:
const
Color
(
0xFF64B5F6
),
50
:
const
Color
(
0xFFE3F2FD
),
400
:
const
Color
(
0xFF42A5F5
),
100
:
const
Color
(
0xFFBBDEFB
),
500
:
const
Color
(
0xFF2196F3
),
200
:
const
Color
(
0xFF90CAF9
),
600
:
const
Color
(
0xFF1E88E5
),
300
:
const
Color
(
0xFF64B5F6
),
700
:
const
Color
(
0xFF1976D2
),
400
:
const
Color
(
0xFF42A5F5
),
800
:
const
Color
(
0xFF1565C0
),
500
:
const
Color
(
_bluePrimaryValue
),
900
:
const
Color
(
0xFF0D47A1
),
600
:
const
Color
(
0xFF1E88E5
),
};
700
:
const
Color
(
0xFF1976D2
),
800
:
const
Color
(
0xFF1565C0
),
/// The blue accent swatch.
900
:
const
Color
(
0xFF0D47A1
),
},
);
/// The blue accent color and swatch.
///
///
/// ```dart
/// ```dart
/// new Icon(
/// new Icon(
...
@@ -409,14 +537,18 @@ class Colors {
...
@@ -409,14 +537,18 @@ class Colors {
/// * [blue], the corresponding primary colors.
/// * [blue], the corresponding primary colors.
/// * [Theme.of], which allows you to select colors from the current theme
/// * [Theme.of], which allows you to select colors from the current theme
/// rather than hard-coding colors in your build methods.
/// rather than hard-coding colors in your build methods.
static
const
Map
<
int
,
Color
>
blueAccent
=
const
<
int
,
Color
>{
static
const
int
_blueAccentPrimaryValue
=
0xFF448AFF
;
100
:
const
Color
(
0xFF82B1FF
),
static
const
MaterialAccentColor
blueAccent
=
const
MaterialAccentColor
(
200
:
const
Color
(
0xFF448AFF
),
_blueAccentPrimaryValue
,
400
:
const
Color
(
0xFF2979FF
),
const
<
int
,
Color
>{
700
:
const
Color
(
0xFF2962FF
),
100
:
const
Color
(
0xFF82B1FF
),
};
200
:
const
Color
(
_blueAccentPrimaryValue
),
400
:
const
Color
(
0xFF2979FF
),
700
:
const
Color
(
0xFF2962FF
),
},
);
/// The light blue primary swatch.
/// The light blue primary
color and
swatch.
///
///
/// ```dart
/// ```dart
/// new Icon(
/// new Icon(
...
@@ -430,18 +562,22 @@ class Colors {
...
@@ -430,18 +562,22 @@ class Colors {
/// * [lightBlueAccent], the corresponding accent colors.
/// * [lightBlueAccent], the corresponding accent colors.
/// * [Theme.of], which allows you to select colors from the current theme
/// * [Theme.of], which allows you to select colors from the current theme
/// rather than hard-coding colors in your build methods.
/// rather than hard-coding colors in your build methods.
static
const
Map
<
int
,
Color
>
lightBlue
=
const
<
int
,
Color
>{
static
const
int
_lightBluePrimaryValue
=
0xFF03A9F4
;
50
:
const
Color
(
0xFFE1F5FE
),
static
const
MaterialColor
lightBlue
=
const
MaterialColor
(
100
:
const
Color
(
0xFFB3E5FC
),
_lightBluePrimaryValue
,
200
:
const
Color
(
0xFF81D4FA
),
const
<
int
,
Color
>{
300
:
const
Color
(
0xFF4FC3F7
),
50
:
const
Color
(
0xFFE1F5FE
),
400
:
const
Color
(
0xFF29B6F6
),
100
:
const
Color
(
0xFFB3E5FC
),
500
:
const
Color
(
0xFF03A9F4
),
200
:
const
Color
(
0xFF81D4FA
),
600
:
const
Color
(
0xFF039BE5
),
300
:
const
Color
(
0xFF4FC3F7
),
700
:
const
Color
(
0xFF0288D1
),
400
:
const
Color
(
0xFF29B6F6
),
800
:
const
Color
(
0xFF0277BD
),
500
:
const
Color
(
_lightBluePrimaryValue
),
900
:
const
Color
(
0xFF01579B
),
600
:
const
Color
(
0xFF039BE5
),
};
700
:
const
Color
(
0xFF0288D1
),
800
:
const
Color
(
0xFF0277BD
),
900
:
const
Color
(
0xFF01579B
),
},
);
/// The light blue accent swatch.
/// The light blue accent swatch.
///
///
...
@@ -457,14 +593,18 @@ class Colors {
...
@@ -457,14 +593,18 @@ class Colors {
/// * [lightBlue], the corresponding primary colors.
/// * [lightBlue], the corresponding primary colors.
/// * [Theme.of], which allows you to select colors from the current theme
/// * [Theme.of], which allows you to select colors from the current theme
/// rather than hard-coding colors in your build methods.
/// rather than hard-coding colors in your build methods.
static
const
Map
<
int
,
Color
>
lightBlueAccent
=
const
<
int
,
Color
>{
static
const
int
_lightBlueAccentPrimaryValue
=
0xFF40C4FF
;
100
:
const
Color
(
0xFF80D8FF
),
static
const
MaterialAccentColor
lightBlueAccent
=
const
MaterialAccentColor
(
200
:
const
Color
(
0xFF40C4FF
),
_lightBlueAccentPrimaryValue
,
400
:
const
Color
(
0xFF00B0FF
),
const
<
int
,
Color
>{
700
:
const
Color
(
0xFF0091EA
),
100
:
const
Color
(
0xFF80D8FF
),
};
200
:
const
Color
(
_lightBlueAccentPrimaryValue
),
400
:
const
Color
(
0xFF00B0FF
),
700
:
const
Color
(
0xFF0091EA
),
},
);
/// The cyan primary swatch.
/// The cyan primary
color and
swatch.
///
///
/// ```dart
/// ```dart
/// new Icon(
/// new Icon(
...
@@ -478,20 +618,24 @@ class Colors {
...
@@ -478,20 +618,24 @@ class Colors {
/// * [cyanAccent], the corresponding accent colors.
/// * [cyanAccent], the corresponding accent colors.
/// * [Theme.of], which allows you to select colors from the current theme
/// * [Theme.of], which allows you to select colors from the current theme
/// rather than hard-coding colors in your build methods.
/// rather than hard-coding colors in your build methods.
static
const
Map
<
int
,
Color
>
cyan
=
const
<
int
,
Color
>{
static
const
int
_cyanPrimaryValue
=
0xFF00BCD4
;
50
:
const
Color
(
0xFFE0F7FA
),
static
const
MaterialColor
cyan
=
const
MaterialColor
(
100
:
const
Color
(
0xFFB2EBF2
),
_cyanPrimaryValue
,
200
:
const
Color
(
0xFF80DEEA
),
const
<
int
,
Color
>{
300
:
const
Color
(
0xFF4DD0E1
),
50
:
const
Color
(
0xFFE0F7FA
),
400
:
const
Color
(
0xFF26C6DA
),
100
:
const
Color
(
0xFFB2EBF2
),
500
:
const
Color
(
0xFF00BCD4
),
200
:
const
Color
(
0xFF80DEEA
),
600
:
const
Color
(
0xFF00ACC1
),
300
:
const
Color
(
0xFF4DD0E1
),
700
:
const
Color
(
0xFF0097A7
),
400
:
const
Color
(
0xFF26C6DA
),
800
:
const
Color
(
0xFF00838F
),
500
:
const
Color
(
_cyanPrimaryValue
),
900
:
const
Color
(
0xFF006064
),
600
:
const
Color
(
0xFF00ACC1
),
};
700
:
const
Color
(
0xFF0097A7
),
800
:
const
Color
(
0xFF00838F
),
/// The cyan accent swatch.
900
:
const
Color
(
0xFF006064
),
},
);
/// The cyan accent color and swatch.
///
///
/// ```dart
/// ```dart
/// new Icon(
/// new Icon(
...
@@ -505,14 +649,18 @@ class Colors {
...
@@ -505,14 +649,18 @@ class Colors {
/// * [cyan], the corresponding primary colors.
/// * [cyan], the corresponding primary colors.
/// * [Theme.of], which allows you to select colors from the current theme
/// * [Theme.of], which allows you to select colors from the current theme
/// rather than hard-coding colors in your build methods.
/// rather than hard-coding colors in your build methods.
static
const
Map
<
int
,
Color
>
cyanAccent
=
const
<
int
,
Color
>{
static
const
int
_cyanAccentPrimaryValue
=
0xFF18FFFF
;
100
:
const
Color
(
0xFF84FFFF
),
static
const
MaterialAccentColor
cyanAccent
=
const
MaterialAccentColor
(
200
:
const
Color
(
0xFF18FFFF
),
_cyanAccentPrimaryValue
,
400
:
const
Color
(
0xFF00E5FF
),
const
<
int
,
Color
>{
700
:
const
Color
(
0xFF00B8D4
),
100
:
const
Color
(
0xFF84FFFF
),
};
200
:
const
Color
(
_cyanAccentPrimaryValue
),
400
:
const
Color
(
0xFF00E5FF
),
700
:
const
Color
(
0xFF00B8D4
),
},
);
/// The teal primary swatch.
/// The teal primary
color and
swatch.
///
///
/// ```dart
/// ```dart
/// new Icon(
/// new Icon(
...
@@ -526,20 +674,24 @@ class Colors {
...
@@ -526,20 +674,24 @@ class Colors {
/// * [tealAccent], the corresponding accent colors.
/// * [tealAccent], the corresponding accent colors.
/// * [Theme.of], which allows you to select colors from the current theme
/// * [Theme.of], which allows you to select colors from the current theme
/// rather than hard-coding colors in your build methods.
/// rather than hard-coding colors in your build methods.
static
const
Map
<
int
,
Color
>
teal
=
const
<
int
,
Color
>{
static
const
int
_tealPrimaryValue
=
0xFF009688
;
50
:
const
Color
(
0xFFE0F2F1
),
static
const
MaterialColor
teal
=
const
MaterialColor
(
100
:
const
Color
(
0xFFB2DFDB
),
_tealPrimaryValue
,
200
:
const
Color
(
0xFF80CBC4
),
const
<
int
,
Color
>{
300
:
const
Color
(
0xFF4DB6AC
),
50
:
const
Color
(
0xFFE0F2F1
),
400
:
const
Color
(
0xFF26A69A
),
100
:
const
Color
(
0xFFB2DFDB
),
500
:
const
Color
(
0xFF009688
),
200
:
const
Color
(
0xFF80CBC4
),
600
:
const
Color
(
0xFF00897B
),
300
:
const
Color
(
0xFF4DB6AC
),
700
:
const
Color
(
0xFF00796B
),
400
:
const
Color
(
0xFF26A69A
),
800
:
const
Color
(
0xFF00695C
),
500
:
const
Color
(
_tealPrimaryValue
),
900
:
const
Color
(
0xFF004D40
),
600
:
const
Color
(
0xFF00897B
),
};
700
:
const
Color
(
0xFF00796B
),
800
:
const
Color
(
0xFF00695C
),
/// The teal accent swatch.
900
:
const
Color
(
0xFF004D40
),
},
);
/// The teal accent color and swatch.
///
///
/// ```dart
/// ```dart
/// new Icon(
/// new Icon(
...
@@ -553,14 +705,18 @@ class Colors {
...
@@ -553,14 +705,18 @@ class Colors {
/// * [teal], the corresponding primary colors.
/// * [teal], the corresponding primary colors.
/// * [Theme.of], which allows you to select colors from the current theme
/// * [Theme.of], which allows you to select colors from the current theme
/// rather than hard-coding colors in your build methods.
/// rather than hard-coding colors in your build methods.
static
const
Map
<
int
,
Color
>
tealAccent
=
const
<
int
,
Color
>{
static
const
int
_tealAccentPrimaryValue
=
0xFF64FFDA
;
100
:
const
Color
(
0xFFA7FFEB
),
static
const
MaterialAccentColor
tealAccent
=
const
MaterialAccentColor
(
200
:
const
Color
(
0xFF64FFDA
),
_tealAccentPrimaryValue
,
400
:
const
Color
(
0xFF1DE9B6
),
const
<
int
,
Color
>{
700
:
const
Color
(
0xFF00BFA5
),
100
:
const
Color
(
0xFFA7FFEB
),
};
200
:
const
Color
(
_tealAccentPrimaryValue
),
400
:
const
Color
(
0xFF1DE9B6
),
700
:
const
Color
(
0xFF00BFA5
),
},
);
/// The green primary swatch.
/// The green primary
color and
swatch.
///
///
/// ```dart
/// ```dart
/// new Icon(
/// new Icon(
...
@@ -574,20 +730,24 @@ class Colors {
...
@@ -574,20 +730,24 @@ class Colors {
/// * [greenAccent], the corresponding accent colors.
/// * [greenAccent], the corresponding accent colors.
/// * [Theme.of], which allows you to select colors from the current theme
/// * [Theme.of], which allows you to select colors from the current theme
/// rather than hard-coding colors in your build methods.
/// rather than hard-coding colors in your build methods.
static
const
Map
<
int
,
Color
>
green
=
const
<
int
,
Color
>{
static
const
int
_greenPrimaryValue
=
0xFF4CAF50
;
50
:
const
Color
(
0xFFE8F5E9
),
static
const
MaterialColor
green
=
const
MaterialColor
(
100
:
const
Color
(
0xFFC8E6C9
),
_greenPrimaryValue
,
200
:
const
Color
(
0xFFA5D6A7
),
const
<
int
,
Color
>{
300
:
const
Color
(
0xFF81C784
),
50
:
const
Color
(
0xFFE8F5E9
),
400
:
const
Color
(
0xFF66BB6A
),
100
:
const
Color
(
0xFFC8E6C9
),
500
:
const
Color
(
0xFF4CAF50
),
200
:
const
Color
(
0xFFA5D6A7
),
600
:
const
Color
(
0xFF43A047
),
300
:
const
Color
(
0xFF81C784
),
700
:
const
Color
(
0xFF388E3C
),
400
:
const
Color
(
0xFF66BB6A
),
800
:
const
Color
(
0xFF2E7D32
),
500
:
const
Color
(
_greenPrimaryValue
),
900
:
const
Color
(
0xFF1B5E20
),
600
:
const
Color
(
0xFF43A047
),
};
700
:
const
Color
(
0xFF388E3C
),
800
:
const
Color
(
0xFF2E7D32
),
/// The green accent swatch.
900
:
const
Color
(
0xFF1B5E20
),
},
);
/// The green accent color and swatch.
///
///
/// ```dart
/// ```dart
/// new Icon(
/// new Icon(
...
@@ -601,14 +761,18 @@ class Colors {
...
@@ -601,14 +761,18 @@ class Colors {
/// * [green], the corresponding primary colors.
/// * [green], the corresponding primary colors.
/// * [Theme.of], which allows you to select colors from the current theme
/// * [Theme.of], which allows you to select colors from the current theme
/// rather than hard-coding colors in your build methods.
/// rather than hard-coding colors in your build methods.
static
const
Map
<
int
,
Color
>
greenAccent
=
const
<
int
,
Color
>{
static
const
int
_greenAccentPrimaryValue
=
0xFF69F0AE
;
100
:
const
Color
(
0xFFB9F6CA
),
static
const
MaterialAccentColor
greenAccent
=
const
MaterialAccentColor
(
200
:
const
Color
(
0xFF69F0AE
),
_greenAccentPrimaryValue
,
400
:
const
Color
(
0xFF00E676
),
const
<
int
,
Color
>{
700
:
const
Color
(
0xFF00C853
),
100
:
const
Color
(
0xFFB9F6CA
),
};
200
:
const
Color
(
_greenAccentPrimaryValue
),
400
:
const
Color
(
0xFF00E676
),
700
:
const
Color
(
0xFF00C853
),
},
);
/// The light green primary swatch.
/// The light green primary
color and
swatch.
///
///
/// ```dart
/// ```dart
/// new Icon(
/// new Icon(
...
@@ -622,20 +786,24 @@ class Colors {
...
@@ -622,20 +786,24 @@ class Colors {
/// * [lightGreenAccent], the corresponding accent colors.
/// * [lightGreenAccent], the corresponding accent colors.
/// * [Theme.of], which allows you to select colors from the current theme
/// * [Theme.of], which allows you to select colors from the current theme
/// rather than hard-coding colors in your build methods.
/// rather than hard-coding colors in your build methods.
static
const
Map
<
int
,
Color
>
lightGreen
=
const
<
int
,
Color
>{
static
const
int
_lightGreenPrimaryValue
=
0xFF8BC34A
;
50
:
const
Color
(
0xFFF1F8E9
),
static
const
MaterialColor
lightGreen
=
const
MaterialColor
(
100
:
const
Color
(
0xFFDCEDC8
),
_lightGreenPrimaryValue
,
200
:
const
Color
(
0xFFC5E1A5
),
const
<
int
,
Color
>{
300
:
const
Color
(
0xFFAED581
),
50
:
const
Color
(
0xFFF1F8E9
),
400
:
const
Color
(
0xFF9CCC65
),
100
:
const
Color
(
0xFFDCEDC8
),
500
:
const
Color
(
0xFF8BC34A
),
200
:
const
Color
(
0xFFC5E1A5
),
600
:
const
Color
(
0xFF7CB342
),
300
:
const
Color
(
0xFFAED581
),
700
:
const
Color
(
0xFF689F38
),
400
:
const
Color
(
0xFF9CCC65
),
800
:
const
Color
(
0xFF558B2F
),
500
:
const
Color
(
_lightGreenPrimaryValue
),
900
:
const
Color
(
0xFF33691E
),
600
:
const
Color
(
0xFF7CB342
),
};
700
:
const
Color
(
0xFF689F38
),
800
:
const
Color
(
0xFF558B2F
),
/// The light green accent swatch.
900
:
const
Color
(
0xFF33691E
),
},
);
/// The light green accent color and swatch.
///
///
/// ```dart
/// ```dart
/// new Icon(
/// new Icon(
...
@@ -649,14 +817,18 @@ class Colors {
...
@@ -649,14 +817,18 @@ class Colors {
/// * [lightGreen], the corresponding primary colors.
/// * [lightGreen], the corresponding primary colors.
/// * [Theme.of], which allows you to select colors from the current theme
/// * [Theme.of], which allows you to select colors from the current theme
/// rather than hard-coding colors in your build methods.
/// rather than hard-coding colors in your build methods.
static
const
Map
<
int
,
Color
>
lightGreenAccent
=
const
<
int
,
Color
>{
static
const
int
_lightGreenAccentPrimaryValue
=
0xFFB2FF59
;
100
:
const
Color
(
0xFFCCFF90
),
static
const
MaterialAccentColor
lightGreenAccent
=
const
MaterialAccentColor
(
200
:
const
Color
(
0xFFB2FF59
),
_lightGreenAccentPrimaryValue
,
400
:
const
Color
(
0xFF76FF03
),
const
<
int
,
Color
>{
700
:
const
Color
(
0xFF64DD17
),
100
:
const
Color
(
0xFFCCFF90
),
};
200
:
const
Color
(
_lightGreenAccentPrimaryValue
),
400
:
const
Color
(
0xFF76FF03
),
700
:
const
Color
(
0xFF64DD17
),
},
);
/// The lime primary swatch.
/// The lime primary
color and
swatch.
///
///
/// ```dart
/// ```dart
/// new Icon(
/// new Icon(
...
@@ -670,20 +842,24 @@ class Colors {
...
@@ -670,20 +842,24 @@ class Colors {
/// * [limeAccent], the corresponding accent colors.
/// * [limeAccent], the corresponding accent colors.
/// * [Theme.of], which allows you to select colors from the current theme
/// * [Theme.of], which allows you to select colors from the current theme
/// rather than hard-coding colors in your build methods.
/// rather than hard-coding colors in your build methods.
static
const
Map
<
int
,
Color
>
lime
=
const
<
int
,
Color
>{
static
const
int
_limePrimaryValue
=
0xFFCDDC39
;
50
:
const
Color
(
0xFFF9FBE7
),
static
const
MaterialColor
lime
=
const
MaterialColor
(
100
:
const
Color
(
0xFFF0F4C3
),
_limePrimaryValue
,
200
:
const
Color
(
0xFFE6EE9C
),
const
<
int
,
Color
>{
300
:
const
Color
(
0xFFDCE775
),
50
:
const
Color
(
0xFFF9FBE7
),
400
:
const
Color
(
0xFFD4E157
),
100
:
const
Color
(
0xFFF0F4C3
),
500
:
const
Color
(
0xFFCDDC39
),
200
:
const
Color
(
0xFFE6EE9C
),
600
:
const
Color
(
0xFFC0CA33
),
300
:
const
Color
(
0xFFDCE775
),
700
:
const
Color
(
0xFFAFB42B
),
400
:
const
Color
(
0xFFD4E157
),
800
:
const
Color
(
0xFF9E9D24
),
500
:
const
Color
(
_limePrimaryValue
),
900
:
const
Color
(
0xFF827717
),
600
:
const
Color
(
0xFFC0CA33
),
};
700
:
const
Color
(
0xFFAFB42B
),
800
:
const
Color
(
0xFF9E9D24
),
/// The lime accent primary swatch.
900
:
const
Color
(
0xFF827717
),
},
);
/// The lime accent primary color and swatch.
///
///
/// ```dart
/// ```dart
/// new Icon(
/// new Icon(
...
@@ -697,14 +873,18 @@ class Colors {
...
@@ -697,14 +873,18 @@ class Colors {
/// * [lime], the corresponding primary colors.
/// * [lime], the corresponding primary colors.
/// * [Theme.of], which allows you to select colors from the current theme
/// * [Theme.of], which allows you to select colors from the current theme
/// rather than hard-coding colors in your build methods.
/// rather than hard-coding colors in your build methods.
static
const
Map
<
int
,
Color
>
limeAccent
=
const
<
int
,
Color
>{
static
const
int
_limeAccentPrimaryValue
=
0xFFEEFF41
;
100
:
const
Color
(
0xFFF4FF81
),
static
const
MaterialAccentColor
limeAccent
=
const
MaterialAccentColor
(
200
:
const
Color
(
0xFFEEFF41
),
_limeAccentPrimaryValue
,
400
:
const
Color
(
0xFFC6FF00
),
const
<
int
,
Color
>{
700
:
const
Color
(
0xFFAEEA00
),
100
:
const
Color
(
0xFFF4FF81
),
};
200
:
const
Color
(
_limeAccentPrimaryValue
),
400
:
const
Color
(
0xFFC6FF00
),
700
:
const
Color
(
0xFFAEEA00
),
},
);
/// The yellow primary swatch.
/// The yellow primary
color and
swatch.
///
///
/// ```dart
/// ```dart
/// new Icon(
/// new Icon(
...
@@ -718,20 +898,24 @@ class Colors {
...
@@ -718,20 +898,24 @@ class Colors {
/// * [yellowAccentAccent], the corresponding accent colors.
/// * [yellowAccentAccent], the corresponding accent colors.
/// * [Theme.of], which allows you to select colors from the current theme
/// * [Theme.of], which allows you to select colors from the current theme
/// rather than hard-coding colors in your build methods.
/// rather than hard-coding colors in your build methods.
static
const
Map
<
int
,
Color
>
yellow
=
const
<
int
,
Color
>{
static
const
int
_yellowPrimaryValue
=
0xFFFFEB3B
;
50
:
const
Color
(
0xFFFFFDE7
),
static
const
MaterialColor
yellow
=
const
MaterialColor
(
100
:
const
Color
(
0xFFFFF9C4
),
_yellowPrimaryValue
,
200
:
const
Color
(
0xFFFFF59D
),
const
<
int
,
Color
>{
300
:
const
Color
(
0xFFFFF176
),
50
:
const
Color
(
0xFFFFFDE7
),
400
:
const
Color
(
0xFFFFEE58
),
100
:
const
Color
(
0xFFFFF9C4
),
500
:
const
Color
(
0xFFFFEB3B
),
200
:
const
Color
(
0xFFFFF59D
),
600
:
const
Color
(
0xFFFDD835
),
300
:
const
Color
(
0xFFFFF176
),
700
:
const
Color
(
0xFFFBC02D
),
400
:
const
Color
(
0xFFFFEE58
),
800
:
const
Color
(
0xFFF9A825
),
500
:
const
Color
(
_yellowPrimaryValue
),
900
:
const
Color
(
0xFFF57F17
),
600
:
const
Color
(
0xFFFDD835
),
};
700
:
const
Color
(
0xFFFBC02D
),
800
:
const
Color
(
0xFFF9A825
),
/// The yellow accent swatch.
900
:
const
Color
(
0xFFF57F17
),
},
);
/// The yellow accent color and swatch.
///
///
/// ```dart
/// ```dart
/// new Icon(
/// new Icon(
...
@@ -745,14 +929,18 @@ class Colors {
...
@@ -745,14 +929,18 @@ class Colors {
/// * [yellow], the corresponding primary colors.
/// * [yellow], the corresponding primary colors.
/// * [Theme.of], which allows you to select colors from the current theme
/// * [Theme.of], which allows you to select colors from the current theme
/// rather than hard-coding colors in your build methods.
/// rather than hard-coding colors in your build methods.
static
const
Map
<
int
,
Color
>
yellowAccent
=
const
<
int
,
Color
>{
static
const
int
_yellowAccentPrimaryValue
=
0xFFFFFF00
;
100
:
const
Color
(
0xFFFFFF8D
),
static
const
MaterialAccentColor
yellowAccent
=
const
MaterialAccentColor
(
200
:
const
Color
(
0xFFFFFF00
),
_yellowAccentPrimaryValue
,
400
:
const
Color
(
0xFFFFEA00
),
const
<
int
,
Color
>{
700
:
const
Color
(
0xFFFFD600
),
100
:
const
Color
(
0xFFFFFF8D
),
};
200
:
const
Color
(
_yellowAccentPrimaryValue
),
400
:
const
Color
(
0xFFFFEA00
),
700
:
const
Color
(
0xFFFFD600
),
},
);
/// The amber primary swatch.
/// The amber primary
color and
swatch.
///
///
/// ```dart
/// ```dart
/// new Icon(
/// new Icon(
...
@@ -766,20 +954,24 @@ class Colors {
...
@@ -766,20 +954,24 @@ class Colors {
/// * [amberAccent], the corresponding accent colors.
/// * [amberAccent], the corresponding accent colors.
/// * [Theme.of], which allows you to select colors from the current theme
/// * [Theme.of], which allows you to select colors from the current theme
/// rather than hard-coding colors in your build methods.
/// rather than hard-coding colors in your build methods.
static
const
Map
<
int
,
Color
>
amber
=
const
<
int
,
Color
>{
static
const
int
_amberPrimaryValue
=
0xFFFFC107
;
50
:
const
Color
(
0xFFFFF8E1
),
static
const
MaterialColor
amber
=
const
MaterialColor
(
100
:
const
Color
(
0xFFFFECB3
),
_amberPrimaryValue
,
200
:
const
Color
(
0xFFFFE082
),
const
<
int
,
Color
>{
300
:
const
Color
(
0xFFFFD54F
),
50
:
const
Color
(
0xFFFFF8E1
),
400
:
const
Color
(
0xFFFFCA28
),
100
:
const
Color
(
0xFFFFECB3
),
500
:
const
Color
(
0xFFFFC107
),
200
:
const
Color
(
0xFFFFE082
),
600
:
const
Color
(
0xFFFFB300
),
300
:
const
Color
(
0xFFFFD54F
),
700
:
const
Color
(
0xFFFFA000
),
400
:
const
Color
(
0xFFFFCA28
),
800
:
const
Color
(
0xFFFF8F00
),
500
:
const
Color
(
_amberPrimaryValue
),
900
:
const
Color
(
0xFFFF6F00
),
600
:
const
Color
(
0xFFFFB300
),
};
700
:
const
Color
(
0xFFFFA000
),
800
:
const
Color
(
0xFFFF8F00
),
/// The amber accent swatch.
900
:
const
Color
(
0xFFFF6F00
),
},
);
/// The amber accent color and swatch.
///
///
/// ```dart
/// ```dart
/// new Icon(
/// new Icon(
...
@@ -793,14 +985,18 @@ class Colors {
...
@@ -793,14 +985,18 @@ class Colors {
/// * [amber], the corresponding primary colors.
/// * [amber], the corresponding primary colors.
/// * [Theme.of], which allows you to select colors from the current theme
/// * [Theme.of], which allows you to select colors from the current theme
/// rather than hard-coding colors in your build methods.
/// rather than hard-coding colors in your build methods.
static
const
Map
<
int
,
Color
>
amberAccent
=
const
<
int
,
Color
>{
static
const
int
_amberAccentPrimaryValue
=
0xFFFFD740
;
100
:
const
Color
(
0xFFFFE57F
),
static
const
MaterialAccentColor
amberAccent
=
const
MaterialAccentColor
(
200
:
const
Color
(
0xFFFFD740
),
_amberAccentPrimaryValue
,
400
:
const
Color
(
0xFFFFC400
),
const
<
int
,
Color
>{
700
:
const
Color
(
0xFFFFAB00
),
100
:
const
Color
(
0xFFFFE57F
),
};
200
:
const
Color
(
_amberAccentPrimaryValue
),
400
:
const
Color
(
0xFFFFC400
),
700
:
const
Color
(
0xFFFFAB00
),
},
);
/// The orange primary swatch.
/// The orange primary
color and
swatch.
///
///
/// ```dart
/// ```dart
/// new Icon(
/// new Icon(
...
@@ -814,20 +1010,24 @@ class Colors {
...
@@ -814,20 +1010,24 @@ class Colors {
/// * [orangeAccent], the corresponding accent colors.
/// * [orangeAccent], the corresponding accent colors.
/// * [Theme.of], which allows you to select colors from the current theme
/// * [Theme.of], which allows you to select colors from the current theme
/// rather than hard-coding colors in your build methods.
/// rather than hard-coding colors in your build methods.
static
const
Map
<
int
,
Color
>
orange
=
const
<
int
,
Color
>{
static
const
int
_orangePrimaryValue
=
0xFFFF9800
;
50
:
const
Color
(
0xFFFFF3E0
),
static
const
MaterialColor
orange
=
const
MaterialColor
(
100
:
const
Color
(
0xFFFFE0B2
),
_orangePrimaryValue
,
200
:
const
Color
(
0xFFFFCC80
),
const
<
int
,
Color
>{
300
:
const
Color
(
0xFFFFB74D
),
50
:
const
Color
(
0xFFFFF3E0
),
400
:
const
Color
(
0xFFFFA726
),
100
:
const
Color
(
0xFFFFE0B2
),
500
:
const
Color
(
0xFFFF9800
),
200
:
const
Color
(
0xFFFFCC80
),
600
:
const
Color
(
0xFFFB8C00
),
300
:
const
Color
(
0xFFFFB74D
),
700
:
const
Color
(
0xFFF57C00
),
400
:
const
Color
(
0xFFFFA726
),
800
:
const
Color
(
0xFFEF6C00
),
500
:
const
Color
(
_orangePrimaryValue
),
900
:
const
Color
(
0xFFE65100
),
600
:
const
Color
(
0xFFFB8C00
),
};
700
:
const
Color
(
0xFFF57C00
),
800
:
const
Color
(
0xFFEF6C00
),
/// The orange accent swatch.
900
:
const
Color
(
0xFFE65100
),
},
);
/// The orange accent color and swatch.
///
///
/// ```dart
/// ```dart
/// new Icon(
/// new Icon(
...
@@ -841,14 +1041,18 @@ class Colors {
...
@@ -841,14 +1041,18 @@ class Colors {
/// * [orange], the corresponding primary colors.
/// * [orange], the corresponding primary colors.
/// * [Theme.of], which allows you to select colors from the current theme
/// * [Theme.of], which allows you to select colors from the current theme
/// rather than hard-coding colors in your build methods.
/// rather than hard-coding colors in your build methods.
static
const
Map
<
int
,
Color
>
orangeAccent
=
const
<
int
,
Color
>{
static
const
int
_orangeAccentPrimaryValue
=
0xFFFFAB40
;
100
:
const
Color
(
0xFFFFD180
),
static
const
MaterialAccentColor
orangeAccent
=
const
MaterialAccentColor
(
200
:
const
Color
(
0xFFFFAB40
),
_orangeAccentPrimaryValue
,
400
:
const
Color
(
0xFFFF9100
),
const
<
int
,
Color
>{
700
:
const
Color
(
0xFFFF6D00
),
100
:
const
Color
(
0xFFFFD180
),
};
200
:
const
Color
(
_orangeAccentPrimaryValue
),
400
:
const
Color
(
0xFFFF9100
),
700
:
const
Color
(
0xFFFF6D00
),
},
);
/// The deep orange primary swatch.
/// The deep orange primary
color and
swatch.
///
///
/// ```dart
/// ```dart
/// new Icon(
/// new Icon(
...
@@ -862,20 +1066,24 @@ class Colors {
...
@@ -862,20 +1066,24 @@ class Colors {
/// * [deepOrangeAccent], the corresponding accent colors.
/// * [deepOrangeAccent], the corresponding accent colors.
/// * [Theme.of], which allows you to select colors from the current theme
/// * [Theme.of], which allows you to select colors from the current theme
/// rather than hard-coding colors in your build methods.
/// rather than hard-coding colors in your build methods.
static
const
Map
<
int
,
Color
>
deepOrange
=
const
<
int
,
Color
>{
static
const
int
_deepOrangePrimaryValue
=
0xFFFF5722
;
50
:
const
Color
(
0xFFFBE9E7
),
static
const
MaterialColor
deepOrange
=
const
MaterialColor
(
100
:
const
Color
(
0xFFFFCCBC
),
_deepOrangePrimaryValue
,
200
:
const
Color
(
0xFFFFAB91
),
const
<
int
,
Color
>{
300
:
const
Color
(
0xFFFF8A65
),
50
:
const
Color
(
0xFFFBE9E7
),
400
:
const
Color
(
0xFFFF7043
),
100
:
const
Color
(
0xFFFFCCBC
),
500
:
const
Color
(
0xFFFF5722
),
200
:
const
Color
(
0xFFFFAB91
),
600
:
const
Color
(
0xFFF4511E
),
300
:
const
Color
(
0xFFFF8A65
),
700
:
const
Color
(
0xFFE64A19
),
400
:
const
Color
(
0xFFFF7043
),
800
:
const
Color
(
0xFFD84315
),
500
:
const
Color
(
_deepOrangePrimaryValue
),
900
:
const
Color
(
0xFFBF360C
),
600
:
const
Color
(
0xFFF4511E
),
};
700
:
const
Color
(
0xFFE64A19
),
800
:
const
Color
(
0xFFD84315
),
/// The deep orange accent swatch.
900
:
const
Color
(
0xFFBF360C
),
},
);
/// The deep orange accent color and swatch.
///
///
/// ```dart
/// ```dart
/// new Icon(
/// new Icon(
...
@@ -889,14 +1097,18 @@ class Colors {
...
@@ -889,14 +1097,18 @@ class Colors {
/// * [deepOrange], the corresponding primary colors.
/// * [deepOrange], the corresponding primary colors.
/// * [Theme.of], which allows you to select colors from the current theme
/// * [Theme.of], which allows you to select colors from the current theme
/// rather than hard-coding colors in your build methods.
/// rather than hard-coding colors in your build methods.
static
const
Map
<
int
,
Color
>
deepOrangeAccent
=
const
<
int
,
Color
>{
static
const
int
_deepOrangeAccentPrimaryValue
=
0xFFFF6E40
;
100
:
const
Color
(
0xFFFF9E80
),
static
const
MaterialAccentColor
deepOrangeAccent
=
const
MaterialAccentColor
(
200
:
const
Color
(
0xFFFF6E40
),
_deepOrangeAccentPrimaryValue
,
400
:
const
Color
(
0xFFFF3D00
),
const
<
int
,
Color
>{
700
:
const
Color
(
0xFFDD2C00
),
100
:
const
Color
(
0xFFFF9E80
),
};
200
:
const
Color
(
_deepOrangeAccentPrimaryValue
),
400
:
const
Color
(
0xFFFF3D00
),
700
:
const
Color
(
0xFFDD2C00
),
},
);
/// The brown primary swatch.
/// The brown primary
color and
swatch.
///
///
/// ```dart
/// ```dart
/// new Icon(
/// new Icon(
...
@@ -905,26 +1117,30 @@ class Colors {
...
@@ -905,26 +1117,30 @@ class Colors {
/// ),
/// ),
/// ```
/// ```
///
///
/// This swatch has no corresponding accent swatch.
/// This swatch has no corresponding accent
color and
swatch.
///
///
/// See also:
/// See also:
///
///
/// * [Theme.of], which allows you to select colors from the current theme
/// * [Theme.of], which allows you to select colors from the current theme
/// rather than hard-coding colors in your build methods.
/// rather than hard-coding colors in your build methods.
static
const
Map
<
int
,
Color
>
brown
=
const
<
int
,
Color
>{
static
const
int
_brownPrimaryValue
=
0xFF795548
;
50
:
const
Color
(
0xFFEFEBE9
),
static
const
MaterialColor
brown
=
const
MaterialColor
(
100
:
const
Color
(
0xFFD7CCC8
),
_brownPrimaryValue
,
200
:
const
Color
(
0xFFBCAAA4
),
const
<
int
,
Color
>{
300
:
const
Color
(
0xFFA1887F
),
50
:
const
Color
(
0xFFEFEBE9
),
400
:
const
Color
(
0xFF8D6E63
),
100
:
const
Color
(
0xFFD7CCC8
),
500
:
const
Color
(
0xFF795548
),
200
:
const
Color
(
0xFFBCAAA4
),
600
:
const
Color
(
0xFF6D4C41
),
300
:
const
Color
(
0xFFA1887F
),
700
:
const
Color
(
0xFF5D4037
),
400
:
const
Color
(
0xFF8D6E63
),
800
:
const
Color
(
0xFF4E342E
),
500
:
const
Color
(
_brownPrimaryValue
),
900
:
const
Color
(
0xFF3E2723
),
600
:
const
Color
(
0xFF6D4C41
),
};
700
:
const
Color
(
0xFF5D4037
),
800
:
const
Color
(
0xFF4E342E
),
/// The grey primary swatch.
900
:
const
Color
(
0xFF3E2723
),
},
);
/// The grey primary color and swatch.
///
///
/// ```dart
/// ```dart
/// new Icon(
/// new Icon(
...
@@ -944,22 +1160,26 @@ class Colors {
...
@@ -944,22 +1160,26 @@ class Colors {
///
///
/// * [Theme.of], which allows you to select colors from the current theme
/// * [Theme.of], which allows you to select colors from the current theme
/// rather than hard-coding colors in your build methods.
/// rather than hard-coding colors in your build methods.
static
const
Map
<
int
,
Color
>
grey
=
const
<
int
,
Color
>{
static
const
int
_greyPrimaryValue
=
0xFF9E9E9E
;
50
:
const
Color
(
0xFFFAFAFA
),
static
const
MaterialColor
grey
=
const
MaterialColor
(
100
:
const
Color
(
0xFFF5F5F5
),
_greyPrimaryValue
,
200
:
const
Color
(
0xFFEEEEEE
),
const
<
int
,
Color
>{
300
:
const
Color
(
0xFFE0E0E0
),
50
:
const
Color
(
0xFFFAFAFA
),
350
:
const
Color
(
0xFFD6D6D6
),
// only for raised button while pressed in light theme
100
:
const
Color
(
0xFFF5F5F5
),
400
:
const
Color
(
0xFFBDBDBD
),
200
:
const
Color
(
0xFFEEEEEE
),
500
:
const
Color
(
0xFF9E9E9E
),
300
:
const
Color
(
0xFFE0E0E0
),
600
:
const
Color
(
0xFF757575
),
350
:
const
Color
(
0xFFD6D6D6
),
// only for raised button while pressed in light theme
700
:
const
Color
(
0xFF616161
),
400
:
const
Color
(
0xFFBDBDBD
),
800
:
const
Color
(
0xFF424242
),
500
:
const
Color
(
_greyPrimaryValue
),
850
:
const
Color
(
0xFF303030
),
// only for background color in dark theme
600
:
const
Color
(
0xFF757575
),
900
:
const
Color
(
0xFF212121
),
700
:
const
Color
(
0xFF616161
),
};
800
:
const
Color
(
0xFF424242
),
850
:
const
Color
(
0xFF303030
),
// only for background color in dark theme
/// The blue-grey primary swatch.
900
:
const
Color
(
0xFF212121
),
},
);
/// The blue-grey primary color and swatch.
///
///
/// ```dart
/// ```dart
/// new Icon(
/// new Icon(
...
@@ -974,21 +1194,25 @@ class Colors {
...
@@ -974,21 +1194,25 @@ class Colors {
///
///
/// * [Theme.of], which allows you to select colors from the current theme
/// * [Theme.of], which allows you to select colors from the current theme
/// rather than hard-coding colors in your build methods.
/// rather than hard-coding colors in your build methods.
static
const
Map
<
int
,
Color
>
blueGrey
=
const
<
int
,
Color
>{
static
const
int
_blueGreyPrimaryValue
=
0xFF607D8B
;
50
:
const
Color
(
0xFFECEFF1
),
static
const
MaterialColor
blueGrey
=
const
MaterialColor
(
100
:
const
Color
(
0xFFCFD8DC
),
_blueGreyPrimaryValue
,
200
:
const
Color
(
0xFFB0BEC5
),
const
<
int
,
Color
>{
300
:
const
Color
(
0xFF90A4AE
),
50
:
const
Color
(
0xFFECEFF1
),
400
:
const
Color
(
0xFF78909C
),
100
:
const
Color
(
0xFFCFD8DC
),
500
:
const
Color
(
0xFF607D8B
),
200
:
const
Color
(
0xFFB0BEC5
),
600
:
const
Color
(
0xFF546E7A
),
300
:
const
Color
(
0xFF90A4AE
),
700
:
const
Color
(
0xFF455A64
),
400
:
const
Color
(
0xFF78909C
),
800
:
const
Color
(
0xFF37474F
),
500
:
const
Color
(
_blueGreyPrimaryValue
),
900
:
const
Color
(
0xFF263238
),
600
:
const
Color
(
0xFF546E7A
),
};
700
:
const
Color
(
0xFF455A64
),
800
:
const
Color
(
0xFF37474F
),
900
:
const
Color
(
0xFF263238
),
},
);
/// The material design primary color swatches (except grey).
/// The material design primary color swatches (except grey).
static
const
List
<
Ma
p
<
int
,
Color
>>
primaries
=
const
<
Map
<
int
,
Color
>
>[
static
const
List
<
Ma
terialColor
>
primaries
=
const
<
MaterialColor
>[
red
,
red
,
pink
,
pink
,
purple
,
purple
,
...
@@ -1011,7 +1235,7 @@ class Colors {
...
@@ -1011,7 +1235,7 @@ class Colors {
];
];
/// The material design accent color swatches.
/// The material design accent color swatches.
static
const
List
<
Ma
p
<
int
,
Color
>>
accents
=
const
<
Map
<
int
,
Color
>
>[
static
const
List
<
Ma
terialAccentColor
>
accents
=
const
<
MaterialAccentColor
>[
redAccent
,
redAccent
,
pinkAccent
,
pinkAccent
,
purpleAccent
,
purpleAccent
,
...
...
packages/flutter/lib/src/material/flutter_logo.dart
View file @
031e042e
...
@@ -22,7 +22,7 @@ class FlutterLogo extends StatelessWidget {
...
@@ -22,7 +22,7 @@ class FlutterLogo extends StatelessWidget {
const
FlutterLogo
({
const
FlutterLogo
({
Key
key
,
Key
key
,
this
.
size
,
this
.
size
,
this
.
swatch
:
Colors
.
blue
,
this
.
colors
,
this
.
textColor
:
const
Color
(
0xFF616161
),
this
.
textColor
:
const
Color
(
0xFF616161
),
this
.
style
:
FlutterLogoStyle
.
markOnly
,
this
.
style
:
FlutterLogoStyle
.
markOnly
,
this
.
duration
:
const
Duration
(
milliseconds:
750
),
this
.
duration
:
const
Duration
(
milliseconds:
750
),
...
@@ -38,20 +38,16 @@ class FlutterLogo extends StatelessWidget {
...
@@ -38,20 +38,16 @@ class FlutterLogo extends StatelessWidget {
/// 24.0.
/// 24.0.
final
double
size
;
final
double
size
;
/// The colors to use to paint the logo. This map should contain at least two
/// The color swatch to use to paint the logo, Colors.blue by default.
/// values, one for 400 and one for 900.
///
///
/// If possible, the default should be used. It corresponds to the
/// If for some reason the default colors are impractical, then one
/// [Colors.blue] swatch.
/// of [Colors.amber], [Colors.red], or [Colors.indigo] swatches can be used.
///
/// These are Flutter's secondary colors.
/// If for some reason that color scheme is impractical, the [Colors.amber],
/// [Colors.red], or [Colors.indigo] swatches can be used. These are Flutter's
/// secondary colors.
///
///
/// In extreme cases where none of those four color schemes will work,
/// In extreme cases where none of those four color schemes will work,
/// [Colors.pink], [Colors.purple], or [Colors.cyan] swatches can be used.
/// [Colors.pink], [Colors.purple], or [Colors.cyan] swatches can be used.
/// These are Flutter's tertiary colors.
/// These are Flutter's tertiary colors.
final
Ma
p
<
int
,
Color
>
swatch
;
final
Ma
terialColor
colors
;
/// The color used to paint the "Flutter" text on the logo, if [style] is
/// The color used to paint the "Flutter" text on the logo, if [style] is
/// [FlutterLogoStyle.horizontal] or [FlutterLogoStyle.stacked]. The
/// [FlutterLogoStyle.horizontal] or [FlutterLogoStyle.stacked]. The
...
@@ -75,13 +71,15 @@ class FlutterLogo extends StatelessWidget {
...
@@ -75,13 +71,15 @@ class FlutterLogo extends StatelessWidget {
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
final
IconThemeData
iconTheme
=
IconTheme
.
of
(
context
);
final
IconThemeData
iconTheme
=
IconTheme
.
of
(
context
);
final
double
iconSize
=
size
??
iconTheme
.
size
;
final
double
iconSize
=
size
??
iconTheme
.
size
;
final
MaterialColor
logoColors
=
colors
??
Colors
.
blue
;
return
new
AnimatedContainer
(
return
new
AnimatedContainer
(
width:
iconSize
,
width:
iconSize
,
height:
iconSize
,
height:
iconSize
,
duration:
duration
,
duration:
duration
,
curve:
curve
,
curve:
curve
,
decoration:
new
FlutterLogoDecoration
(
decoration:
new
FlutterLogoDecoration
(
swatch:
swatch
,
lightColor:
logoColors
.
shade400
,
darkColor:
logoColors
.
shade900
,
style:
style
,
style:
style
,
textColor:
textColor
,
textColor:
textColor
,
),
),
...
...
packages/flutter/lib/src/material/list_tile.dart
View file @
031e042e
...
@@ -76,7 +76,7 @@ Map<MaterialListType, double> kListTileExtent = const <MaterialListType, double>
...
@@ -76,7 +76,7 @@ Map<MaterialListType, double> kListTileExtent = const <MaterialListType, double>
/// * [CircleAvatar], which shows an icon representing a person and is often
/// * [CircleAvatar], which shows an icon representing a person and is often
/// used as the [leading] element of a ListTile.
/// used as the [leading] element of a ListTile.
/// * [Divider], which can be used to separate [ListTile]s.
/// * [Divider], which can be used to separate [ListTile]s.
/// * [ListTile.divideTiles], a utility for inserting [Divider]s in between [ListTile
s
]s.
/// * [ListTile.divideTiles], a utility for inserting [Divider]s in between [ListTile]s.
/// * <https://material.google.com/components/lists.html>
/// * <https://material.google.com/components/lists.html>
class
ListTile
extends
StatelessWidget
{
class
ListTile
extends
StatelessWidget
{
/// Creates a list tile.
/// Creates a list tile.
...
...
packages/flutter/lib/src/material/theme_data.dart
View file @
031e042e
...
@@ -70,7 +70,7 @@ class ThemeData {
...
@@ -70,7 +70,7 @@ class ThemeData {
/// more discussion on how to pick the right colors.
/// more discussion on how to pick the right colors.
factory
ThemeData
({
factory
ThemeData
({
Brightness
brightness
,
Brightness
brightness
,
Ma
p
<
int
,
Color
>
primarySwatch
,
Ma
terialColor
primarySwatch
,
Color
primaryColor
,
Color
primaryColor
,
Brightness
primaryColorBrightness
,
Brightness
primaryColorBrightness
,
Color
accentColor
,
Color
accentColor
,
...
...
packages/flutter/lib/src/painting/flutter_logo.dart
View file @
031e042e
...
@@ -31,24 +31,19 @@ enum FlutterLogoStyle {
...
@@ -31,24 +31,19 @@ enum FlutterLogoStyle {
stacked
,
stacked
,
}
}
const
int
_lightShade
=
400
;
const
int
_darkShade
=
900
;
const
Map
<
int
,
Color
>
_kDefaultSwatch
=
const
<
int
,
Color
>{
_lightShade:
const
Color
(
0xFF42A5F5
),
_darkShade:
const
Color
(
0xFF0D47A1
)
};
/// An immutable description of how to paint Flutter's logo.
/// An immutable description of how to paint Flutter's logo.
class
FlutterLogoDecoration
extends
Decoration
{
class
FlutterLogoDecoration
extends
Decoration
{
/// Creates a decoration that knows how to paint Flutter's logo.
/// Creates a decoration that knows how to paint Flutter's logo.
///
///
/// The [
swatch] controls the color used for the logo. The [style] controls
/// The [
lightColor] and [darkColor] are used to fill the logo. The [style]
///
whether and where to draw the "Flutter" label. If one is shown, the
///
controls whether and where to draw the "Flutter" label. If one is shown,
/// [textColor] controls the color of the label.
///
the
[textColor] controls the color of the label.
///
///
/// The [swatch], [textColor], and [style] arguments must not be null.
/// The [lightColor], [darkColor], [textColor], and [style] arguments must not
/// be null.
const
FlutterLogoDecoration
({
const
FlutterLogoDecoration
({
this
.
swatch
:
_kDefaultSwatch
,
this
.
lightColor
:
const
Color
(
0xFF42A5F5
),
// Colors.blue[400]
this
.
darkColor
:
const
Color
(
0xFF0D47A1
),
// Colors.blue[900]
this
.
textColor
:
const
Color
(
0xFF616161
),
this
.
textColor
:
const
Color
(
0xFF616161
),
this
.
style
:
FlutterLogoStyle
.
markOnly
,
this
.
style
:
FlutterLogoStyle
.
markOnly
,
this
.
margin
:
EdgeInsets
.
zero
,
this
.
margin
:
EdgeInsets
.
zero
,
...
@@ -56,22 +51,26 @@ class FlutterLogoDecoration extends Decoration {
...
@@ -56,22 +51,26 @@ class FlutterLogoDecoration extends Decoration {
// (see https://github.com/dart-lang/sdk/issues/26980 for details about that ignore statement)
// (see https://github.com/dart-lang/sdk/issues/26980 for details about that ignore statement)
_opacity
=
1.0
;
_opacity
=
1.0
;
FlutterLogoDecoration
.
_
(
this
.
swatch
,
this
.
textColor
,
this
.
style
,
this
.
_position
,
this
.
_opacity
,
this
.
margin
);
FlutterLogoDecoration
.
_
(
this
.
lightColor
,
this
.
darkColor
,
this
.
textColor
,
this
.
style
,
this
.
_position
,
this
.
_opacity
,
this
.
margin
);
/// The colors to use to paint the logo. This map should contain at least two
/// The lighter of the two colors used to paint the logo.
/// values, one for 400 and one for 900.
///
///
/// If possible, the default should be used. It corresponds to the
/// If possible, the default should be used. It corresponds to the
400 and 900
///
[Colors.blue] swatch
from the Material library.
///
values of [Colors.blue]
from the Material library.
///
///
/// If for some reason that color scheme is impractical, the
[Colors.amber],
/// If for some reason that color scheme is impractical, the
same entries from
/// [Colors.
red], or [Colors.indigo] swatches can be used. These are Flutter's
/// [Colors.
amber], [Colors.red], or [Colors.indigo] colors can be used. These
/// secondary colors.
///
are Flutter's
secondary colors.
///
///
/// In extreme cases where none of those four color schemes will work,
/// In extreme cases where none of those four color schemes will work,
/// [Colors.pink], [Colors.purple], or [Colors.cyan]
swatches
can be used.
/// [Colors.pink], [Colors.purple], or [Colors.cyan] can be used.
/// These are Flutter's tertiary colors.
/// These are Flutter's tertiary colors.
final
Map
<
int
,
Color
>
swatch
;
final
Color
lightColor
;
/// The darker of the two colors used to paint the logo.
///
/// See [lightColor] for more information about selecting the logo's colors.
final
Color
darkColor
;
/// The color used to paint the "Flutter" text on the logo, if [style] is
/// The color used to paint the "Flutter" text on the logo, if [style] is
/// [FlutterLogoStyle.horizontal] or [FlutterLogoStyle.stacked]. The
/// [FlutterLogoStyle.horizontal] or [FlutterLogoStyle.stacked]. The
...
@@ -97,9 +96,8 @@ class FlutterLogoDecoration extends Decoration {
...
@@ -97,9 +96,8 @@ class FlutterLogoDecoration extends Decoration {
@override
@override
bool
debugAssertIsValid
()
{
bool
debugAssertIsValid
()
{
assert
(
swatch
!=
null
assert
(
lightColor
!=
null
&&
swatch
[
_lightShade
]
!=
null
&&
darkColor
!=
null
&&
swatch
[
_darkShade
]
!=
null
&&
textColor
!=
null
&&
textColor
!=
null
&&
style
!=
null
&&
style
!=
null
&&
_position
!=
null
&&
_position
!=
null
...
@@ -126,7 +124,8 @@ class FlutterLogoDecoration extends Decoration {
...
@@ -126,7 +124,8 @@ class FlutterLogoDecoration extends Decoration {
return
null
;
return
null
;
if
(
a
==
null
)
{
if
(
a
==
null
)
{
return
new
FlutterLogoDecoration
.
_
(
return
new
FlutterLogoDecoration
.
_
(
b
.
swatch
,
b
.
lightColor
,
b
.
darkColor
,
b
.
textColor
,
b
.
textColor
,
b
.
style
,
b
.
style
,
b
.
_position
,
b
.
_position
,
...
@@ -136,7 +135,8 @@ class FlutterLogoDecoration extends Decoration {
...
@@ -136,7 +135,8 @@ class FlutterLogoDecoration extends Decoration {
}
}
if
(
b
==
null
)
{
if
(
b
==
null
)
{
return
new
FlutterLogoDecoration
.
_
(
return
new
FlutterLogoDecoration
.
_
(
a
.
swatch
,
a
.
lightColor
,
a
.
darkColor
,
a
.
textColor
,
a
.
textColor
,
a
.
style
,
a
.
style
,
a
.
_position
,
a
.
_position
,
...
@@ -145,7 +145,8 @@ class FlutterLogoDecoration extends Decoration {
...
@@ -145,7 +145,8 @@ class FlutterLogoDecoration extends Decoration {
);
);
}
}
return
new
FlutterLogoDecoration
.
_
(
return
new
FlutterLogoDecoration
.
_
(
_lerpSwatch
(
a
.
swatch
,
b
.
swatch
,
t
),
Color
.
lerp
(
a
.
lightColor
,
b
.
lightColor
,
t
),
Color
.
lerp
(
a
.
darkColor
,
b
.
darkColor
,
t
),
Color
.
lerp
(
a
.
textColor
,
b
.
textColor
,
t
),
Color
.
lerp
(
a
.
textColor
,
b
.
textColor
,
t
),
t
<
0.5
?
a
.
style
:
b
.
style
,
t
<
0.5
?
a
.
style
:
b
.
style
,
a
.
_position
+
(
b
.
_position
-
a
.
_position
)
*
t
,
a
.
_position
+
(
b
.
_position
-
a
.
_position
)
*
t
,
...
@@ -154,15 +155,6 @@ class FlutterLogoDecoration extends Decoration {
...
@@ -154,15 +155,6 @@ class FlutterLogoDecoration extends Decoration {
);
);
}
}
static
Map
<
int
,
Color
>
_lerpSwatch
(
Map
<
int
,
Color
>
a
,
Map
<
int
,
Color
>
b
,
double
t
)
{
assert
(
a
!=
null
);
assert
(
b
!=
null
);
return
<
int
,
Color
>{
_lightShade:
Color
.
lerp
(
a
[
_lightShade
],
b
[
_lightShade
],
t
),
_darkShade:
Color
.
lerp
(
a
[
_darkShade
],
b
[
_darkShade
],
t
),
};
}
@override
@override
FlutterLogoDecoration
lerpFrom
(
Decoration
a
,
double
t
)
{
FlutterLogoDecoration
lerpFrom
(
Decoration
a
,
double
t
)
{
assert
(
debugAssertIsValid
());
assert
(
debugAssertIsValid
());
...
@@ -199,8 +191,8 @@ class FlutterLogoDecoration extends Decoration {
...
@@ -199,8 +191,8 @@ class FlutterLogoDecoration extends Decoration {
if
(
other
is
!
FlutterLogoDecoration
)
if
(
other
is
!
FlutterLogoDecoration
)
return
false
;
return
false
;
final
FlutterLogoDecoration
typedOther
=
other
;
final
FlutterLogoDecoration
typedOther
=
other
;
return
swatch
[
_lightShade
]
==
typedOther
.
swatch
[
_lightShade
]
return
lightColor
==
typedOther
.
lightColor
&&
swatch
[
_darkShade
]
==
typedOther
.
swatch
[
_darkShade
]
&&
darkColor
==
typedOther
.
darkColor
&&
textColor
==
typedOther
.
textColor
&&
textColor
==
typedOther
.
textColor
&&
_position
==
typedOther
.
_position
&&
_position
==
typedOther
.
_position
&&
_opacity
==
typedOther
.
_opacity
;
&&
_opacity
==
typedOther
.
_opacity
;
...
@@ -210,8 +202,8 @@ class FlutterLogoDecoration extends Decoration {
...
@@ -210,8 +202,8 @@ class FlutterLogoDecoration extends Decoration {
int
get
hashCode
{
int
get
hashCode
{
assert
(
debugAssertIsValid
());
assert
(
debugAssertIsValid
());
return
hashValues
(
return
hashValues
(
swatch
[
_lightShade
]
,
lightColor
,
swatch
[
_darkShade
]
,
darkColor
,
textColor
,
textColor
,
_position
,
_position
,
_opacity
_opacity
...
@@ -221,9 +213,7 @@ class FlutterLogoDecoration extends Decoration {
...
@@ -221,9 +213,7 @@ class FlutterLogoDecoration extends Decoration {
@override
@override
String
toString
([
String
prefix
=
''
,
String
prefixIndent
])
{
String
toString
([
String
prefix
=
''
,
String
prefixIndent
])
{
final
String
extra
=
_inTransition
?
', transition
$_position
:
$_opacity
'
:
''
;
final
String
extra
=
_inTransition
?
', transition
$_position
:
$_opacity
'
:
''
;
if
(
swatch
==
null
)
return
'
$prefix$runtimeType
(
$lightColor
/
$darkColor
on
$textColor
,
$style$extra
)'
;
return
'
$prefix$runtimeType
(null,
$style$extra
)'
;
return
'
$prefix$runtimeType
(
${swatch[_lightShade]}
/
${swatch[_darkShade]}
on
$textColor
,
$style$extra
)'
;
}
}
}
}
...
@@ -279,11 +269,11 @@ class _FlutterLogoPainter extends BoxPainter {
...
@@ -279,11 +269,11 @@ class _FlutterLogoPainter extends BoxPainter {
// Set up the styles.
// Set up the styles.
final
Paint
lightPaint
=
new
Paint
()
final
Paint
lightPaint
=
new
Paint
()
..
color
=
_config
.
swatch
[
_lightShade
]
.
withOpacity
(
0.8
);
..
color
=
_config
.
lightColor
.
withOpacity
(
0.8
);
final
Paint
mediumPaint
=
new
Paint
()
final
Paint
mediumPaint
=
new
Paint
()
..
color
=
_config
.
swatch
[
_lightShade
]
;
..
color
=
_config
.
lightColor
;
final
Paint
darkPaint
=
new
Paint
()
final
Paint
darkPaint
=
new
Paint
()
..
color
=
_config
.
swatch
[
_darkShade
]
;
..
color
=
_config
.
darkColor
;
final
ui
.
Gradient
triangleGradient
=
new
ui
.
Gradient
.
linear
(
final
ui
.
Gradient
triangleGradient
=
new
ui
.
Gradient
.
linear
(
const
<
Point
>[
const
<
Point
>[
...
...
packages/flutter/test/material/colors_test.dart
0 → 100644
View file @
031e042e
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import
'package:test/test.dart'
;
import
'package:flutter/material.dart'
;
const
List
<
int
>
primaryKeys
=
const
<
int
>[
50
,
100
,
200
,
300
,
400
,
500
,
600
,
700
,
800
,
900
];
const
List
<
int
>
accentKeys
=
const
<
int
>[
100
,
200
,
400
,
700
];
void
main
(
)
{
test
(
'MaterialColor basic functionality'
,
()
{
final
MaterialColor
color
=
new
MaterialColor
(
500
,
const
<
int
,
Color
>{
50
:
const
Color
(
50
),
100
:
const
Color
(
100
),
200
:
const
Color
(
200
),
300
:
const
Color
(
300
),
400
:
const
Color
(
400
),
500
:
const
Color
(
500
),
600
:
const
Color
(
600
),
700
:
const
Color
(
700
),
800
:
const
Color
(
800
),
900
:
const
Color
(
900
),
},
);
expect
(
color
.
value
,
500
);
expect
(
color
[
50
].
value
,
50
);
expect
(
color
[
100
].
value
,
100
);
expect
(
color
[
200
].
value
,
200
);
expect
(
color
[
300
].
value
,
300
);
expect
(
color
[
400
].
value
,
400
);
expect
(
color
[
500
].
value
,
500
);
expect
(
color
[
600
].
value
,
600
);
expect
(
color
[
700
].
value
,
700
);
expect
(
color
[
800
].
value
,
800
);
expect
(
color
[
900
].
value
,
900
);
expect
(
color
.
shade50
.
value
,
50
);
expect
(
color
.
shade100
.
value
,
100
);
expect
(
color
.
shade200
.
value
,
200
);
expect
(
color
.
shade300
.
value
,
300
);
expect
(
color
.
shade400
.
value
,
400
);
expect
(
color
.
shade500
.
value
,
500
);
expect
(
color
.
shade600
.
value
,
600
);
expect
(
color
.
shade700
.
value
,
700
);
expect
(
color
.
shade800
.
value
,
800
);
expect
(
color
.
shade900
.
value
,
900
);
});
test
(
'Colors swatches do not contain duplicates'
,
()
{
for
(
MaterialColor
color
in
Colors
.
primaries
)
expect
(
primaryKeys
.
map
((
int
key
)
=>
color
[
key
]).
toSet
().
length
,
primaryKeys
.
length
);
expect
(
primaryKeys
.
map
((
int
key
)
=>
Colors
.
grey
[
key
]).
toSet
().
length
,
primaryKeys
.
length
);
for
(
MaterialAccentColor
color
in
Colors
.
accents
)
expect
(
accentKeys
.
map
((
int
key
)
=>
color
[
key
]).
toSet
().
length
,
accentKeys
.
length
);
});
test
(
'All color swatch colors are opaque and equal their primary color'
,
()
{
for
(
MaterialColor
color
in
Colors
.
primaries
)
{
expect
(
color
.
value
,
color
.
shade500
.
value
);
for
(
int
key
in
primaryKeys
)
{
expect
(
color
[
key
].
alpha
,
0xFF
);
}
}
expect
(
Colors
.
grey
.
value
,
Colors
.
grey
.
shade500
.
value
);
for
(
int
key
in
primaryKeys
)
{
expect
(
Colors
.
grey
[
key
].
alpha
,
0xFF
);
}
for
(
MaterialAccentColor
color
in
Colors
.
accents
)
{
expect
(
color
.
value
,
color
.
shade200
.
value
);
for
(
int
key
in
accentKeys
)
{
expect
(
color
[
key
].
alpha
,
0xFF
);
}
}
});
}
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