v1.1.1
strcolor
Flutter 包,用于将颜色名称转换为 Flutter 中的 Color。提供了一种便捷的方法,可以通过颜色名称使用颜色,而不是使用 Colors 常量。
25喜欢 11近 30 天下载30Pub 分数
平台暂无数据
将字符串颜色名称转换为 Color 和 MaterialColors 的 Flutter 包
{"sdk":"flutter"}{"sdk":"flutter"}以下为英文项目原文快照,最新内容请访问 GitHub。
Flutter package to convert color names to Color in Flutter.
Offers a handful way to use colors using their names instead of using Colors constants.
It is specialy useful when you need to place color in a component comming dynamically from server.
All Flutter Colors constants supported.
Hexa Colors supported.
In your flutter project add the dependency:
dependencies:
...
strcolor: ^1.1.1
import 'package:strcolor/strcolor.dart';
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: "purple".color(), // write the color name. When you receive dynamic color name from server this is much more useful.
visualDensity: VisualDensity.adaptivePlatformDensity,
),
home: MyHomePage(title: 'Flutter Demo Home Page'),
);
}
}