[Flutter]超出部分用省略号表示的其中一种方法

  1. 可以用Expanded
constraints:BoxConstraints(
	maxWidth: Get.width * 0.7,
),
Row(
                  children: [
                    Container(
                      margin: EdgeInsets.only(top: 5,bottom: 10),
                      decoration: BoxDecoration(
                        border: Border.all(
                            width: 0.5,
                            color: Colors.green
                        ),
                        borderRadius: BorderRadius.all(Radius.circular(4)),
                      ),
                      child: Text('  ${ item['DeviceCode']} | ${item['DeviceName']}  ',style: TextStyle(color: Colors.green,fontSize: 10),),
                    ),
                    Container(
                      height: Get.height * 0.025,
                      constraints:BoxConstraints(
                        maxWidth: Get.width * 0.7,
                      ),
                      margin: EdgeInsets.only(top: 5,left: 5,bottom: 10),
                      decoration: BoxDecoration(
                        border: Border.all(
                            width: 0.5,
                            color: Colors.blue[800]
                        ),
                        borderRadius: BorderRadius.all(Radius.circular(4)),
                      ),
                      child: Text('  ${ item['InvCode']} | ${item['InvName']}  ',style: TextStyle(color: Colors.blue[800],fontSize: 10),overflow: TextOverflow.ellipsis,maxLines: 1),
                    )
                  ],
                )

版权声明:本文为weixin_42545230原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。