You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am one of the flutter beginners. so I have been studing flutter-folio, and I think it is very nice for me.
but I have a idea , and can not figure out.
first take a look at flutter-folio's code.
class Fonts {
static const String raleway = "Raleway";
static const String fraunces = "Fraunces";
}
/// TextStyles - All the core text styles for the app should be declared here.
/// Don't try and create every variant in existence here, just the high level ones.
/// More specific variants can be created on the fly using `style.copyWith()`
/// `newStyle = TextStyles.body1.copyWith(lineHeight: 2, color: Colors.red)`
class TextStyles {
/// Declare a base style for each Family
static const TextStyle raleway = const TextStyle(fontFamily: Fonts.raleway, fontWeight: FontWeight.w400, height: 1);
static const TextStyle fraunces = const TextStyle(fontFamily: Fonts.fraunces, fontWeight: FontWeight.w400, height: 1);
static TextStyle get h1 =>
inter.copyWith(fontWeight: FontWeight.w600, fontSize: FontSizes.s48, letterSpacing: -1, height: 1.17);
static TextStyle get h2 => h1.copyWith(fontSize: FontSizes.s24, letterSpacing: -.5, height: 1.16);
...
}
in this code, now I have two fonts, one is English font, another one is Japanese font.
When App Started, in Material app 's builder method,and I checked current locale language code.
if it is en, then copy themeData with english font, else it is jp, then copy with japanese font. and then return themeData.
now , I want to use TextStyles.h2 with english font, like 'raleway' when app locale is english,
and I want to use TextStyles.h2 with japanese font, too, like 'xxx' when app locale is japanese,
now problem is, when I using TextStyles.h2, its fontFamily property is raleway.
how could I improve this ?
so guys, could you give me some guides about this , thanks
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I am one of the flutter beginners. so I have been studing flutter-folio, and I think it is very nice for me.
but I have a idea , and can not figure out.
first take a look at
flutter-folio
's code.in this code, now I have two fonts, one is English font, another one is Japanese font.
When App Started, in Material app 's
builder
method,and I checked current locale language code.if it is
en
, then copy themeData with english font, else it isjp
, then copy with japanese font. and then return themeData.now , I want to use
TextStyles.h2
with english font, like 'raleway' when app locale is english,and I want to use
TextStyles.h2
with japanese font, too, like 'xxx' when app locale is japanese,now problem is, when I using
TextStyles.h2
, its fontFamily property israleway
.how could I improve this ?
so guys, could you give me some guides about this , thanks
Beta Was this translation helpful? Give feedback.
All reactions