Skip to content

Commit

Permalink
example: present complete color palettes (#158)
Browse files Browse the repository at this point in the history
  • Loading branch information
jpnurmi committed Apr 21, 2022
1 parent 2534554 commit a021b63
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions example/lib/view/colors_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@ class ColorsView extends StatelessWidget {
child: colorPaletteExample(
'prussianGreen', YaruColors.prussianGreen)),
SizedBox(width: 25.0),
Expanded(
child: colorPaletteExample('warmGrey', YaruColors.warmGrey)),
Spacer(),
SizedBox(width: 25.0),
Spacer(),
],
Expand Down Expand Up @@ -93,18 +92,17 @@ class ColorsView extends StatelessWidget {

Widget colorPaletteExample(String colorName, MaterialColor color) {
Map<String, MaterialColor> _color = {colorName: color};
int _shade = 0;
int _shade = 50;
TextStyle _textStyle(int _shade) => TextStyle(
color: (_color.values.first[_shade]!.computeLuminance() > 0.4)
? Colors.black
: Colors.white,
fontSize: 9.0,
);
List<Widget> _colorItem = [];
for (int i = 0; i < 5; i++) {
_shade += 100;
for (int i = 1; i <= 10; i++) {
_colorItem.add(Container(
height: 45.0,
height: 40.0,
color: _color.values.first[_shade],
child: Padding(
padding: const EdgeInsets.all(8.0),
Expand Down Expand Up @@ -133,6 +131,7 @@ class ColorsView extends StatelessWidget {
),
),
));
_shade = i * 100;
}
return Column(
children: _colorItem,
Expand Down

0 comments on commit a021b63

Please sign in to comment.