22902902
2/17/2020 - 8:34 AM

Text Widget | Flutter | 基本语法

import 'package:flutter/material.dart';

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

class MyApp extends StatelessWidget {

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Welcome to Flutter',
      home: Scaffold (
        appBar: AppBar(
          title: Text('Welcome Flutter')
        ),
        body: Center(
          child: Text('hello world',
            textAlign: TextAlign.left,
            maxLines: 1,
            overflow: TextOverflow.ellipsis,
            style: TextStyle(
              fontSize: 25.0,
              color: Color.fromARGB(255,255,125,125),
              decoration: TextDecoration.underline,
              decorationStyle: TextDecorationStyle.solid,
            )
          ),
        ),
      ),
    );
  }
}