Menu

waiting answer September 16, 2020

How to create your first Flutter app?

Anyone pls help me to create a program in flutter. I have installed Android Studio, Flutter and Dart Plugins. Iam familiar with object-oriented code and basic programming concepts such as loops conditions etc.

Answers
September 16, 2020

Delete all the contents of lib/main.dart. Replace with the following code, which displays a message in the center of the screen.

	import 'package:flutter/material.dart'; 
  
	void main() { 
	  runApp(MaterialApp( 
	    title: 'This is a testing Title', 
	    theme: ThemeData( 
	      primarySwatch: Colors.yellow 
	    ), 
	    home: Scaffold( 
	      appBar: AppBar( 
	        title:Text( 
	          'Your App Bar Title'
	        ) 
	      ), 
	      body: Center(child: Text( 'This is for testing', )), 
	    ), 
	  )); 
	} 
0 0
September 16, 2020

A sample flutter program to print Hello World

    import 'package:flutter/material.dart'; 
	  
	void main() { 
	  runApp(MaterialApp( 
	    title: 'Hello World', 
	    home: Scaffold( 
	      body: Container(
	        child: Center(
	          child:Text("Hello World"),
	        ),
	      ),
	    ), 
	  )); 
	} 

 

  • MaterialApp is a widget and a class
  • Two main named parameters of MaterialApp are title and home
  • the title is a string type named parameter
  • home is a named parameter and is a widget type. Widget type is a datatype like string, number, etc.
  • Each widget is a class 
0 0

Please Login to Post the answer

Leave an Answer