佈局類Widget 彈性佈局Flex

例:假若有三個按鈕,想讓三個按鈕佔據一行,則flex

          body: Row(
            children: <Widget>[
                Expanded(
                  child: new RaisedButton(
                    onPressed: (){
                      
                    },
                    color:Colors.redAccent,
                    child:new Text('紅色按鈕')
                  ),
                ),
                Expanded(
                  child:new RaisedButton(
                    onPressed: (){
                  
                    },
                    color:Colors.orangeAccent,
                    child: new Text('黃色按鈕'),
                  ),
                ),
                Expanded(
                  child:new RaisedButton(
                    onPressed: (){
                    
                    },
                    color:Colors.pinkAccent,
                    child:new Text('粉色按鈕')
                  ) 
                )
              ],
            ),
expanded(
  child:,
  flex:1
)
相關文章
相關標籤/搜索