Skip to content
This repository has been archived by the owner on Feb 25, 2024. It is now read-only.

example: present complete color palettes #158

Merged
merged 1 commit into from
Apr 21, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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