10.2 Incorporating the Google fonts package
.
.
.
dependencies:
flutter:
sdk: flutter
cupertino_icon: ^ 1.0 .2
google_fonts: 2.2 .0
import 'package:flutter/material.dart' ;
import 'package:google_fonts/google_fonts.dart' ;
void main () => runApp (MyApp ());
class MyApp extends StatelessWidget {
@override
Widget build (BuildContext context) {
return MaterialApp (
title: 'Google Fonts Demo' ,
debugShowCheckedModeBanner: false ,
theme: ThemeData (
primarySwatch: Colors .blue,
textTheme: TextTheme (
bodyText1: GoogleFonts .aBeeZee (fontSize: 30 , color: Colors .deepOrange),
bodyText2: GoogleFonts .aBeeZee (fontSize: 30 , color: Colors .white60))
),
home: const MyHomePage (title: 'Flutterand Dart Cookbook' ),
);
}
}
class MyHomePage extends StatelessWidget {
final String title;
const MyHomePage ({
Key ? key,
required this .title,
}) : super (key: key);
@override
Widget build (BuildContext context) {
return Scaffold (
backgroundColor: Colors .black,
body: Column (children: [
const Text ('Yo MTV Raps' ),
Text ('Yo MTV Raps' , style: GoogleFonts .coiny (fontSize: 30 , color: Colors .blueGrey),),
Text ('Yo MTV Raps' , style: GoogleFonts .actor (fontSize: 30 , color: Colors .indigo),),
]),
);
}
}