美文网首页
Flutter学习之-Text & Button

Flutter学习之-Text & Button

作者: CocoaJason | 来源:发表于2021-06-09 20:58 被阅读0次

    Text学习

    
    class TextDemo extends StatelessWidget {
      @override
      Widget build(BuildContext context) {
        return Container(
          width: double.infinity,
          color: Colors.green,
          child: Text(
            "文本",
            maxLines: 1,
            overflow: TextOverflow.ellipsis,
            textDirection: TextDirection.rtl,
            textAlign: TextAlign.center,
            style: TextStyle(color: Colors.white),
          ),
        );
      }
    }
    
    Simulator Screen Shot - iPad Pro (12.9-inch) (5th generation) - 2021-06-09 at 20.59.17.png

    Button学习

    class ButtonDemo extends StatelessWidget {
      @override
      Widget build(BuildContext context) {
        return Column(
          children: [
            ElevatedButton(
              onPressed: () {},
              child: Text('漂浮按钮'),
            ),
            TextButton(
              onPressed: () {},
              child: Text("漂浮按钮"),
            ),
            TextButton.icon(
                label: Text("data"),
                onPressed: () {},
                icon: Icon(Icons.add),
                style: TextButton.styleFrom(backgroundColor: Colors.red)),
            OutlinedButton(onPressed: () {}, child: Text("OutlinedButton")),
            IconButton(onPressed: () {}, icon: Icon(Icons.home))
          ],
        );
      }
    }
    
    Simulator Screen Shot - iPad Pro (12.9-inch) (5th generation) - 2021-06-09 at 20.59.29.png

    相关文章

      网友评论

          本文标题:Flutter学习之-Text & Button

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