我正在尝试将文本设置为超级粗体,就像我的小部件树中的粗体一样。
这是我尝试过的代码:
Widget _buildWelcomeTitleWidget() {
final titleTextStyle = Theme.of(context).textTheme.bodyLarge!.copyWith(
fontWeight: FontWeight.bold, // Not bold enough
fontSize: 50,
color: Colors.white,
);
return Padding(
padding: const EdgeInsets.all(8.0),
child: PlatformText(
"welcome".tr(),
style: titleTextStyle,
textAlign: TextAlign.center,
),
);
}
但是还不够大胆。
同时,我正在使用
google_fonts
包作为我的字体,我已将其定义并附加到主题文件中的所有小部件,如下所示:
static final ThemeData themeData = ThemeData.light().copyWith(
scaffoldBackgroundColor: LightTheme.backgroundColor,
brightness: Brightness.light,
primaryColor: AppTheme.primaryColor,
primaryColorDark: AppTheme.primaryColorDark,
cardColor: LightTheme.cardBackgroundColor,
canvasColor: Colors.transparent,
textTheme: GoogleFonts.ubuntuTextTheme()
.apply(displayColor: Colors.black, bodyColor: AppTheme.gray900),
....
是否还有另一个技巧可以将超厚且非常粗体的字体应用于我可能缺少的这个特定的欢迎文本小部件?
感谢您的任何想法
我认为你可以使用
Font Weight
,就像下面的例子:
Text(
'BOLDER',
style: TextStyle(
fontWeight: FontWeight.w900,
),
);