flutter_css_style

Last updated:

0 purchases

flutter_css_style Image
flutter_css_style Images
Add to Cart

Description:

flutter css style

flutter css style #




用于Flutter主题的css样式库
flutter_css_style 是一个类css样式变量, 用于快速将web css样式引入flutter.
使用 #
🔩 安装
在 pubspec.yaml 添加依赖
dependencies:
flutter_css_style: <last_version>
copied to clipboard
首先创建 StyleData 实例. 你可以创建多个 StyleData 实例, 然后将他们注入一个总的 StyleData.
StyleData cardStyle = StyleData({
"card-color": Color(0xFF129892),
"card-border-radius": BorderRadius.circular(16.0),
"card-border-color": "app-primary-color",
});

StyleData appStyle = StyleData({
"app-primary-color": Colors.blue.shade500,
})..inject(cardStyle)
copied to clipboard
然后,在你的应用程序中应用 StaticStyle.
return StaticStyle(
style: appStyle,
child: MaterialApp(...),
);
copied to clipboard
现在你可以通过 Style.of(context) 调用样式.
final style = Style.of(context);

// 自动解析 "app-primary-color" 并获取颜色.
final cardBorderColor = style.get<Color>("card-border-color");
copied to clipboard
已知问题 #
使用css类样式, 将无法通过类来定制样式,失去了一定的便捷性。

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.