Create First Flutter Application: Flutter Dart Tutorial
|
ProgrammingCodeTech
|
1.Add dependencies google_fonts: ^1.1.0 in pubspec.yaml
dependencies: flutter: sdk: flutter
cupertino_icons: ^0.1.3 google_fonts: ^1.1.0
|
2.Create main.dart
import 'package:flutter/material.dart'; import 'my_home_page.dart';
void main() { runApp(MyApp()); }
class MyApp extends StatelessWidget { // This widget is the root of your application. @override Widget build(BuildContext context) { return MaterialApp( title: 'Flutter Demo', theme: ThemeData( primarySwatch: Colors.blue, visualDensity: VisualDensity.adaptivePlatformDensity, ), home: MyHomePage(title: 'Home Page'), ); } }
|
3.Create my_home_page.dart
import 'package:flutter/material.dart'; import 'package:flutter/widgets.dart'; import 'package:google_fonts/google_fonts.dart';
class MyHomePage extends StatelessWidget { MyHomePage({Key key, this.title}) : super(key: key); final String title;
@override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text(this.title), ), body: Center( child: Text( 'ProgrammingCodeTech', style: GoogleFonts.lato( textStyle: TextStyle( color: Colors.red[800], fontWeight: FontWeight.bold, fontSize: 30, fontStyle: FontStyle.italic)), ), ), ); } }
|
No comments:
Post a Comment