Now that YOU’re familiar with the DART syntax, you don’t need the new keyword to create objects. Creating Text is not easy.

import 'package:flutter/material.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo', theme: ThemeData( primarySwatch: Colors.blue, ), home: Text(), ); }}Copy the code

What! An error? I can’t create an empty Text.

You need a parameter, but I didn’t give it. CTRL +P (Window shortcut)

Well, it’s a mandatory argument. You need a string.

Hello world.

Done!!

What the hell?? The status bar is covered, the letters are this big, and there are two bars underneath.

ctrl+p

Adjust the font, only you — style. Need one, one… CTRL + mouse… — — TextStyle

What does TextStyle need

ctrl+P

CTRL + mouse

Need to…

ctrl+p

CTRL + mouse

Study done.

import 'package:flutter/material.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: Text("hello world", style: TextStyle(fontSize: 12, color: Colors.yellow)), ); }}Copy the code

Conclusion: Mastering CTRL + P and CTRL + mouse is the key. There are so many parameters in a component, it is impossible to learn them one by one. There are so many components, you can’t learn one by one.

Feeling the stones across the river feels good, can feel the depth of the water, not to see the fear of the water. Come on, study!