无法在浮动中调整行小部件的大小

时间:2020-04-24 17:13:21

标签: flutter layout resize agora.io

如果有人可以帮助,我只是想减小布局的大小:

return Container(
            child: Row(
              children: <Widget>[
                MainAxisSize.max(){
                _expandedVideoRow([views[0]]);},
                MainAxisSize.min(){
                _expandedVideoRow([views[1]]);}
              ],
            ));

大小不变。

1 个答案:

答案 0 :(得分:0)

像下面的示例一样向容器添加宽度

import 'package:flutter/material.dart';

void main() => runApp(MyApp());

class MyApp extends StatefulWidget {
  @override
  State<StatefulWidget> createState() {
    return MyAppState();
  }
}

class MyAppState extends State<MyApp> {
 @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: Text("Width sizing"),
        ),
        body: Container(
          width: 70.0,
            child: Row(
              children: <Widget>[
                Container(
                  width: 35.0,
                  height: 35.0,
                  color: Colors.blue),
                 Container(
                  width: 35.0,
                  height: 35.0,
                  color: Colors.green),
              ],
            ),),
        ),
    );
  }
}

快乐编码!!!