我已经使用本机Design System开发了一个Android(Java),现在我将开始使用Flutter开发一个新的Design System,但是我对Flutter不太熟悉,我有一些问题没有通过在互联网上得到回答。
安卓上的我有
<?xml version="1.0" encoding="utf-8"?>
<resources>
//Brand Primary colors
<color name="color_primary" category="color">#FDE6E3</color>
<color name="color_secondary" category="color">#FE918D</color>
</resources>如何使这个color文件在Flutter中
安卓上的我有
<resources>
//Font Sizes
<dimen name="font_XXS" category="font-size">12sp</dimen>
<dimen name="font_size_XS" category="font-size">16sp</dimen>
//Spacing Inline
<dimen name="spacing_XS" category="spacing-inline">4dp</dimen>
<dimen name="spacing_XXS" category="spacing-inline">8dp</dimen>
//Border Radius
<dimen name="border_radius_none" category="radius">0dp</dimen>
<dimen name="border_radius_XS" category="radius">4dp</dimen>
//Border Width
<dimen name="border_width_none" category="border-width">0dp</dimen>
<dimen name="border_width_medium" category="border-width">2dp</dimen>
</resources>如何使这个dimen文件在Flutter中
在Android上,我把所有这些都放在一起来创建一个Link组件。
public class CustomLink extends AppCompatTextView {
private Context mContext;
public CustomLink(Context context) {
super(context);
this.mContext = context;
}
public CustomLink(Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
this.mContext = context;
TypedArray attrsArray = context.obtainStyledAttributes(attrs, R.styleable.CustomLink,
0, 0);
initializeCustomLink();
attrsArray.recycle();
}
private void initializeCustomLink() {
initializeLinkContainer();
}
private void initializeLinkContainer() {
float scale = getResources().getDisplayMetrics().density;
this.setLinkTextColor(getResources().getColor(R.color.color_primary)); //Here I use a Design feature
this.setTextColor(getResources().getColor(R.color.color_secondary)); //Here I use a Design System feature
this.setTextSize((getResources.getDimension.font_XXS) / (int) scale); //Here I use a Design System feature
this.setMovementMethod(LinkMovementMethod.getInstance());
}
}我如何在Flutter**?** 中做这些基本的事情?
发布于 2021-12-14 20:55:43
在公用文件夹下,应保留常量数据。

在这里,链接:https://github.com/dicodingacademy/a199-flutter-expert-project/tree/main/lib
https://stackoverflow.com/questions/70355390
复制相似问题