v1.1.1
strcolor
Flutterで色の名前をColorに変換するためのパッケージ。Colors定数を使用する代わりに、色の名前を使って色を使用する便利な方法を提供します。
25いいね 1130日間ダウンロード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'),
);
}
}