Friday, 29 March 2019

Hello world flutter app by using UI Widgets

  1. Select File > New Flutter Project.
  2. Select Flutter application as the project type, and press Next.
  3. Make sure that the Flutter SDK Path text field specifies the location of the SDK. Install the SDK if you haven’t yet done so.
  4. Enter a project name (for example, myapp), and press Next.
  5. Click Finish.
  6. Wait for Android Studio to install the SDK, and create the project.
In the project structure find lib folder and open main.dart file.

replace the below code in main.dart file 
import 'package:flutter/material.dart';

void main()=> runApp( new MyflutterApp());

class MyflutterApp extends StatelessWidget
{
  @override  Widget build(BuildContext context) {
    return  MaterialApp(
      debugShowCheckedModeBanner: false,
      title: "My Flutter App",
      home : Scaffold(
          appBar: AppBar(title:Text("My First App Screen"),),
          body:   Material(
            color: Colors.lightBlueAccent,
            child:   Center(
              child:  Text(
                "Hello World",
                textDirection: TextDirection.ltr,
                style: TextStyle(color: Colors.white,fontSize: 40.0,fontFamily: 'Raleway' ),
              ),
            ),
          )
      ),
    );
  }
}

Run the app

  1. Locate the main Android Studio toolbar: Main IntelliJ toolbar
  2. In the target selector, select an Android device for running the app. If none are listed as available, select Tools> Android > AVD Manager and create one there. For details, see Managing AVDs.
  3. Click the run icon in the toolbar, or invoke the menu item Run > Run.

No comments:

Post a Comment

Error While embed the video in Your website page

Error:- Refused to display '<URL>' in a frame because it set 'X-Frame-Options' to 'sameorigin Solution:- if ...