pubspec.yaml 文件主要用于三方插件的引入
在最底下
flutter:
uses-material-design: true
assets:
- assets/image/ //这样子图片就不用一张一张的一引了 项目里面直接用
fonts:
- family: DINAlternate-Bold
fonts:
- asset: assets/font/DIN-Alternate-Bold.ttf //引入三方字体
weight: 400 //默认大小
用法
图片
Image.asset(
'assets/images/bind_user_icon.png',
fit: BoxFit.contain,
height: ScreenUtil().setWidth(68),
width: ScreenUtil().setWidth(68),
),
//字体
final fontFamily = 'DINAlternate-Bold';
static TextStyle textStyle({ FontWeight fontWeight = FontWeight.normal ,Color color = Colors.black,double fontSize = 15}){
return TextStyle(
fontSize: fontSize,
color: color,
fontFamily: fontFamily,
fontWeight: fontWeight,
);
}