← ClaudeAtlas

flutter-google-fontslisted

Applying fonts using google_fonts
noory-code/noory-ai · ★ 0 · AI & Automation · score 74
Install: claude install-skill noory-code/noory-ai
# Flutter Google Fonts Download and apply Google Fonts at runtime. --- ## Installation ```bash flutter pub add google_fonts ``` --- ## Quick Reference ```dart import 'package:google_fonts/google_fonts.dart'; // basic usage (static method) Text( 'Hello World', style: GoogleFonts.lato(), ) // customize style Text( 'Hello World', style: GoogleFonts.lato( fontSize: 24, fontWeight: FontWeight.bold, color: Colors.black, ), ) // dynamic font name Text( 'Hello World', style: GoogleFonts.getFont('Noto Sans KR'), ) // apply font on top of an existing TextStyle Text( 'Hello World', style: GoogleFonts.lato(textStyle: existingStyle), ) ``` ### App-wide Application ```dart MaterialApp( theme: ThemeData( textTheme: GoogleFonts.latoTextTheme(), ), ) // apply font while preserving the existing theme's styles MaterialApp( theme: ThemeData( textTheme: GoogleFonts.latoTextTheme( Theme.of(context).textTheme, ), ), ) ``` ### Font Preloading ```dart // main.dart void main() async { WidgetsFlutterBinding.ensureInitialized(); // preload fonts before the app starts await GoogleFonts.pendingFonts([ GoogleFonts.lato(), GoogleFonts.notoSansKr(), ]); runApp(MyApp()); } ``` ### Offline Usage (Asset Bundling) ```yaml # pubspec.yaml flutter: assets: - google_fonts/ ``` ``` # folder structure assets/ └── google_fonts/ ├── Lato-Regular.ttf ├── Lato-Bold.ttf └── NotoSansKR-Regular.otf ``` > When inc