4.一些知识

Text widget

import 'package:flutter/material.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Text widget',
      home: Scaffold(
        body: Center(
          child: Text('Hello Widget!',
              textAlign: TextAlign.center,
              maxLines: 2,
              overflow: TextOverflow.ellipsis,
              style: TextStyle(
                fontSize: 25.0,
                color: Color.fromARGB(255, 255, 125, 125),
                decoration: TextDecoration.underline,
                decorationStyle: TextDecorationStyle.solid,
              )),
        ),
      ),
    );
  }
}

Container

import 'package:flutter/material.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Text widget',
      home: Scaffold(
        body: Center(
            child: Container(
                child: new Text('Hello kkk', style: TextStyle(fontSize: 40.0)),
                alignment: Alignment.center,
                width: 500.0,
                height: 400.0,
                color: Colors.lightBlue)),
      ),
    );
  }
}
import 'package:flutter/material.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Text widget',
      home: Scaffold(
        body: Center(
            child: Container(
          alignment: Alignment.topLeft,
          width: 500.0,
          height: 400.0,
          // color: Colors.lightBlue,
          padding: const EdgeInsets.fromLTRB(10, 100, 0, 0),
          margin: const EdgeInsets.all(10),
          decoration: new BoxDecoration(
            gradient: const LinearGradient(
                colors: [Colors.lightBlue, Colors.greenAccent, Colors.purple]),
            border: Border.all(width: 2, color: Colors.red),
          ),
          child: new Text('Hello kkk', style: TextStyle(fontSize: 40.0)),
        )),
      ),
    );
  }
}

Image

import 'package:flutter/material.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Text widget',
      home: Scaffold(
        body: Center(
            child: Container(
          child: new Image.network(
            'http://www.kongxiangbo.com/wp-content/uploads/2019/12/timg.gif',
          ),
          width: 300,
          height: 200,
          color: Colors.lightBlue,
        )),
      ),
    );
  }
}

ListView