v1.1.1
strcolor
用於將顏色名稱轉換為 Flutter 中 Color 的 Flutter 套件。提供了一種方便的方式,可以透過顏色名稱使用顏色,而非使用 Colors 常數。
25喜歡 10近 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'),
);
}
}