ant_color 0.0.2
ant_color: ^0.0.2 copied to clipboard
ant design colors. includes 120 colors & provider a way to self generated.
import 'package:ant_color/ant_color.dart';
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return const MaterialApp(
title: 'Ant Color Demo',
home: MyHomePage(),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({super.key});
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
// Here we take the value from the MyHomePage object that was created by
// the App.build method, and use it to set our appbar title.
title: const Text('Ant Color Demo'),
),
body: SingleChildScrollView(
child: Wrap(
children: [
for (var element in AntColors.items) ColorItem(color: element)
],
),
),
);
}
}
class ColorItem extends StatelessWidget {
const ColorItem({super.key, required this.color});
final AntColor color;
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.all(12),
child: Material(
elevation: 4,
borderRadius: BorderRadius.circular(8),
child: Padding(
padding: const EdgeInsets.all(8),
child: SizedBox(
width: 260,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text('${color.primary}'),
for (int i = 1; i <= 10; i++)
Material(
color: color[i * 100],
child: Row(
children: [
Text('shade-${i * 100}'),
const Spacer(),
Text('${color[i * 100]}'),
],
),
),
],
),
),
),
),
);
}
}