NashFontConfig typedef
NashFontConfig = FontConfig
Flexible font configuration that supports separate fonts for LTR and RTL layouts, using Google Fonts, local asset fonts, or the system font.
Quick examples
// Both from Google Fonts
FontConfig.google(ltr: 'Inter', rtl: 'Cairo')
// Both from local assets (declared in pubspec.yaml)
FontConfig.asset(ltr: 'MyFont', rtl: 'MyArabicFont')
// Mixed: LTR from Google, RTL from local asset
FontConfig.mixed(ltrGoogle: 'Inter', rtlAsset: 'Cairo')
// Same font for both directions (Google Fonts)
FontConfig.google(ltr: 'Poppins')
// System font (no external dependency)
FontConfig.system()
Pass to Theme.light / Theme.dark / ThemeBuilder.fromSeed:
MaterialApp(
theme: Theme.light(fontConfig: FontConfig.google(ltr: 'Inter', rtl: 'Cairo')),
)
Or use FontConfig.textStyleFor inside a widget to get a direction-aware TextStyle at any point:
Text(
'مرحبا',
style: fontConfig.textStyleFor(context, base: TextStyle(fontSize: 16)),
)
A backwards-compatible alias for [FontConfig].
Implementation
typedef NashFontConfig = FontConfig;