flutter-超出部分隐藏


第一种写法

 1 ConstrainedBox(
 2   constraints: BoxConstraints(
 3     maxHeight: 100
 4   ),
 5   child: Stack(
 6     overflow: Overflow.clip,
 7     children: <Widget>[
 8       Container(
 9         width: 100,
10         height: 200,
11         color: Colors.greenAccent,
12       )
13     ],
14   ),
15 ),

第二种写法

Container(
  color: KColor.redBg,
  constraints: BoxConstraints(maxWidth: 500.w),
  child: Stack(
    overflow: Overflow.clip,
    children: [
      Container(
        width: 600.w,
        color: KColor.blackTextColor,
       ),
       ],
    ),
),

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM