Skip to content

Instantly share code, notes, and snippets.

@moritzmorgenroth
Created December 31, 2019 11:42
Show Gist options
  • Save moritzmorgenroth/5c5ccf433d888ed0fafe0b6c5f388793 to your computer and use it in GitHub Desktop.
Save moritzmorgenroth/5c5ccf433d888ed0fafe0b6c5f388793 to your computer and use it in GitHub Desktop.
import 'package:flutter/material.dart';
class PaletteSample extends StatelessWidget {
@override
Widget build(BuildContext context) {
MaterialColor primarySwatch = generateMaterialColor(Palette.primary);
return Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
Container(
height: 50,
color: primarySwatch.shade50,
child: Center(
child: Text(
"50",
style:
Theme.of(context).textTheme.title.copyWith(color: Colors.white),
)),
),
Container(
height: 50,
color: primarySwatch.shade100,
child: Center(
child: Text(
"100",
style:
Theme.of(context).textTheme.title.copyWith(color: Colors.white),
)),
),
Container(
height: 50,
color: primarySwatch.shade200,
child: Center(
child: Text(
"200",
style:
Theme.of(context).textTheme.title.copyWith(color: Colors.white),
)),
),
Container(
height: 50,
color: primarySwatch.shade300,
child: Center(
child: Text(
"300",
style:
Theme.of(context).textTheme.title.copyWith(color: Colors.white),
)),
),
Container(
height: 50,
color: primarySwatch.shade400,
child: Center(
child: Text(
"400",
style:
Theme.of(context).textTheme.title.copyWith(color: Colors.white),
)),
),
Container(
height: 50,
color: primarySwatch.shade500,
child: Center(
child: Text(
"500",
style:
Theme.of(context).textTheme.title.copyWith(color: Colors.white),
)),
),
Container(
height: 50,
color: primarySwatch.shade600,
child: Center(
child: Text(
"600",
style:
Theme.of(context).textTheme.title.copyWith(color: Colors.white),
)),
),
Container(
height: 50,
color: primarySwatch.shade700,
child: Center(
child: Text(
"700",
style:
Theme.of(context).textTheme.title.copyWith(color: Colors.white),
)),
),
Container(
height: 50,
color: primarySwatch.shade800,
child: Center(
child: Text(
"800",
style:
Theme.of(context).textTheme.title.copyWith(color: Colors.white),
)),
),
Container(
height: 50,
color: primarySwatch.shade900,
child: Center(
child: Text(
"900",
style:
Theme.of(context).textTheme.title.copyWith(color: Colors.white),
)),
),
],
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment