Flutter之TextWidget

    xiaoxiao2022-07-04  176

    `import 'package:flutter/material.dart'; void main() => runApp(MyApp()); class MyApp extends StatelessWidget { // This widget is the root of your application. @override Widget build(BuildContext context) { return MaterialApp( title: 'Flutter', theme: ThemeData( primarySwatch: Colors.blue, ), home: Scaffold( appBar: AppBar( title: Text("Hell Word"), ), body: Center( child: Text( //设置内容 "Hello Word2Hello Word2Hello Word2Hello Word2Hello Word2Hello Word2Hello Word2Hello Word2Hello Word2", //对齐方式 textAlign: TextAlign.left, // 设置字体样式 style: TextStyle( //设置字体大小 fontSize: 20.0, //字体颜色 color: Color.fromARGB(255, 255, 0, 0), //添加下划线 decoration: TextDecoration.underline, //下划线颜色 decorationColor: Color.fromARGB(200, 100, 255, 20), //下划线样式 decorationStyle: TextDecorationStyle.solid), ), ), )); } }
    最新回复(0)