美文网首页
flutter Text组件

flutter Text组件

作者: 前端新阳 | 来源:发表于2020-05-14 17:57 被阅读0次
    • main.dart 代码:
    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: 'Text widget',
          home: Scaffold(
            body: Center(
              child:Container(
                child: new Text('Hello World!',style:TextStyle(fontSize: 40.0,color: Colors.white)),
                alignment: Alignment.center,
                width: 500.0,
                height: 400.0,
                padding: const EdgeInsets.fromLTRB(10.0, 20.0, 0.0, 20.0),
                margin: const EdgeInsets.all(10.0),
                decoration: new BoxDecoration(
                  gradient: const LinearGradient(
                    colors: [Colors.lightBlueAccent,Colors.greenAccent,Colors.purple]
                  ),
                  border: Border.all(width: 1.0,color: Colors.pink) // 边框
                ),
              )
            )
          ),
        );
      }
    }
    
    

    效果:


    image.png

    相关文章

      网友评论

          本文标题:flutter Text组件

          本文链接:https://www.haomeiwen.com/subject/txfxohtx.html