不确定如何消除这个错误(An InputDecorator, which is typically created by a TextField, cannot have an unbounded width.),但也要让两个内部文本字段占据整个列的宽度.

Column(mainAxisSize: MainAxisSize.min, children: [
                      Container(
                        margin: const EdgeInsets.only(left: 50, right: 50),
                        child: AutoCompleteTextView(
                          suggestionsApiFetchDelay: 300,
                          focusGained: () {},
                          onTapCallback: (_) async {

                          },
                          focusLost: () {

                          },
                          onValueChanged: (String text) {

                          },
                          controller: startEditingController,
                          suggestionStyle:
                              Theme.of(context).textTheme.bodyText2,
                          getSuggestionsMethod: getLocationSuggestionsList,
                          tfTextAlign: TextAlign.left,
                          tfStyle: TextStyle(
                            fontSize: 16,
                            color: Theme.of(context).textTheme.bodyText2.color,
                          ),
                          tfTextDecoration: InputDecoration(
                            contentPadding: EdgeInsets.only(top: 0, left: 8.0),
                            filled: true,
                            fillColor: Colors.white,
                            focusedBorder: OutlineInputBorder(
                              borderSide: BorderSide(
                                  color: Colors.grey[800], width: 1.0),
                              borderRadius: BorderRadius.zero,
                            ),
                            enabledBorder: OutlineInputBorder(
                              borderSide: BorderSide(
                                  color: Colors.deepPurple[600], width: 1.0),
                              borderRadius: BorderRadius.zero,
                            ),
                            hintText: "Current Location",
                            labelText: 'Start',
                            labelStyle: kcarPurpleLabelStyle,
                          ),
                        ),
                      ),
                      Container(
                        margin:
                            const EdgeInsets.only(top: 5, left: 50, right: 50),
                        child: AutoCompleteTextView(
                          suggestionsApiFetchDelay: 300,
                          focusGained: () {},
                          onTapCallback: (_) async {

                          },
                          focusLost: () {

                          },
                          onValueChanged: (String text) {

                          },
                          controller: startEditingController,
                          suggestionStyle:
                              Theme.of(context).textTheme.bodyText2,
                          getSuggestionsMethod: getLocationSuggestionsList,
                          tfTextAlign: TextAlign.left,
                          tfStyle: TextStyle(
                            fontSize: 16,
                            color: Theme.of(context).textTheme.bodyText2.color,
                          ),
                          tfTextDecoration: InputDecoration(
                            contentPadding: EdgeInsets.only(top: 0, left: 8.0),
                            filled: true,
                            fillColor: Colors.white,
                            focusedBorder: OutlineInputBorder(
                              borderSide: BorderSide(
                                  color: Colors.grey[800], width: 1.0),
                              borderRadius: BorderRadius.zero,
                            ),
                            enabledBorder: OutlineInputBorder(
                              borderSide: BorderSide(
                                  color: Colors.deepPurple[600], width: 1.0),
                              borderRadius: BorderRadius.zero,
                            ),
                            hintText: "Current Location",
                            labelText: 'Destination',
                            labelStyle: kcarPurpleLabelStyle,
                          ),
                        ),
                      )
                    ]),

推荐答案

保留您的列,但将每个文本字段包装在Expanded小部件中.理由来自官方文件:

一种小部件,用于扩展行、列或Flex的子级,以便

使用扩展的小部件生成行、列或Flex的子对象

资料来源:Expanded Class

Dart相关问答推荐

Dart 可空记录与模式匹配:(String, int)?类型的匹配值无法分配给所需类型(Object?, Object?)

dart 中的 Function() 和 Function 有什么区别?

如何使用 dart 将 Uint8list 转换为 List

Dart:使用正则表达式从字符串中删除空格

FlutterError (setState() 在 dispose() 之后调用:(生命周期状态:defunct,not mounted)

SliverList / SliverChildBuilderDelegate 提供初始索引或允许负索引

如何处理 ListView 滚动方向

如何在Flatter中zoom 两个谷歌 map 标记

Flutter-创建value和name数组

如何在Flatter中更改复选框边框 colored颜色 ?默认情况下,它显示为黑色,但我希望它显示为灰色

未定义命名参数child.在 Center() 构造函数中

在 TextInputType 更改后控制器重置的 Flutter TextField

如何创建带有固定页脚和Flutter的滚动视图?

如何在 Visual Studio Code 中禁用fake右括号注释?

如何在 Dart 中调用超类的构造函数和其他语句?

如何在dart中获得一周的开始或结束

如何在 timeLimit 之后使future 的计算超时?

如何在 Dart 中使用 char 类型?

dart:io 中带有 json 内容类型的 Http POST 请求

Dart: 必须取消 Stream 订阅并关闭 StreamSinks 吗?