简体   繁体   English

如何在 flutter/dart 中仅向 TextButton 添加顶部和底部边框?

[英]How do you add only a top and bottom border to a TextButton in flutter/dart?

How do you add only a top and bottom border to a TextButton in flutter/dart?如何在 flutter/dart 中仅向 TextButton 添加顶部和底部边框?

TextButton(
      onPressed: () {},
      child: Text('Button'),
    );

You can wrap the TextButton with a Container and set the decoration :您可以用Container包装TextButton并设置decoration

Container(
      decoration: BoxDecoration(
        border: Border(
          top: BorderSide(width: 1.0, color: Colors.grey),
          bottom: BorderSide(width: 1.0, color: Colors.grey),
        ),
      ),
      child: TextButton(
        onPressed: () {},
        child: Text('Button'),
      ),
    )

在此处输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM