YT link:

https://youtu.be/C5lpPjoivaw?si=fri5Cj9SA9wW831K

import 'package:flutter/material.dart';

void main() => runApp(MaterialApp(
  home: Scaffold(
    appBar: AppBar(
      title: Text('my first app'),
      centerTitle: true,
    ),
    body: Center(
      child: Text('hello, ninjas!'),
    ),
    floatingActionButton: FloatingActionButton(
      child: Text('click'),
			onPressed: null;
    ),
  ),
));

MaterialApp has been used already in the previous code.

Now, we use the widget ‘Scaffold’ for the ‘home’ property.

Note that, for property name, first letter is small, and capital letter is used for separate words in property name. Eg: centerTitle but for widget (or class) we write starting with capital letter.

Here, we see, we set the ‘appBar’ property to the widget ‘AppBar’ itself.

We also add a button by ‘floatingActionButton’.

#Note: For FloatingActionButton, you must specify the value of the property onPressed.

It might be:

onPressed: null;

OR

onPressed: () {};

(I kept onpressed: null at first. I tried to give hoverColor to the button, but although I defined the property and specified a colour, I could not see any colour change upon hovering, also I didn’t get an error. I then tried the second option onPressed: () {}; then it worked and colour change could be seen)

IMPORTANT:

To define one widget inside another, see FloatingActionButton, we use the child property of the parent widget. Here we add one text on the button.