iT邦幫忙

0

Flutter 02

##Scaffold & AppBar Widgets

In the code below, we use Scaffold as the root Widget.

import 'package:flutter/material.dart';

void main() => runApp(MaterialApp(
  home: Scaffold( //ROOT WIDGET
    appBar: AppBar(    
      title: Text('my first app'), //SET THE TITLE TEXT
      centerTitle: true,    //SET THE PROPERTIES, WHERE THE TEXT SHOWED AT THE CENTRE
    ),
    body: Center( //LOCATED IN THE MIDDLE
      child: Text('hello, ninjas!'),
    ),
    floatingActionButton: FloatingActionButton( //CREATE A FLOATING BUTTON
      child: Text('click'),
    ),
  ),
));

Result:

Flutter Tutorial for Beginners #5 - Scaffold & AppBar Widgets


尚未有邦友留言

立即登入留言