小编pra*_*ale的帖子

在 Flutter 中使用 ListViewBuilder 中的动态 TextField

我正在尝试在 flutter 中构建一个动态 TextField 列表,但不明白我如何处理它。

我的清单如下:

我的代码结构是:

在此处输入图片说明

ListView.builder(
            shrinkWrap: true,
            itemCount: itemList.length,
            itemBuilder: (context, index) {

              if(itemList.length == null) {
                return _buildProgressIndicator();
              } else {
                return singleItemList(index);
              }
          })




Widget singleItemList(int index) {

if((itemList.length -1) < index)
{
  return Container(child: null); 
} else {

  dynamic singleItem = itemList[index];
  String counter = (index+1).toString();

  return 
     Container(

        decoration: BoxDecoration(
          color: Colors.white,
        ),

      child: Row(    

        children:[

          Expanded(
            flex: 1,
            child: Text(counter,style: orderBookItemListCounter(),)
          ),



          Expanded(
            flex: 3,
            child: TextField(
                controller: _addProductToCart(counter),
                decoration: InputDecoration(
                  labelText: "Qty", …
Run Code Online (Sandbox Code Playgroud)

dart flutter

9
推荐指数
2
解决办法
1万
查看次数

在颤动中格式化文本小部件的部分文本

我的文本小部件看起来像Text("Last Active: some location area..").

我可以使用样式更改完整文本的文本样式。但我只是喜欢将 Last active 更改为粗体。Text("<b>Last Active</b> some location area name..")

如果我将 Row 用于单独的文本,它将起作用,但会出现间距问题。

什么是最好的解决方案。并使其大胆是唯一的要求。

谢谢

flutter

6
推荐指数
2
解决办法
3314
查看次数

错误:flutter/shell/common/shell.cc(181)] Dart错误:未处理的异常

我的应用程序工作正常所有http服务工作良好.突然发生了什么事在此输入图像描述 现在向我的任何http服务显示此错误.

尝试挖掘问题但失败了.

感谢您的帮助

dart flutter

5
推荐指数
0
解决办法
1430
查看次数

即使安装了VSCode,也显示没有安装

我只是随波逐流.我已经成功安装了它.

但是当我尝试运行它失败了.

以下是颤振医生-v的输出

PS C:\android-app\flutter-app\flutter_first_app> flutter doctor -v
Run Code Online (Sandbox Code Playgroud)
[?] Flutter (Channel master, v0.5.5-pre.9, on Microsoft Windows [Version 10.0.16299.461], locale en-US)
    • Flutter version 0.5.5-pre.9 at C:\android-app\flutter
    • Framework revision 587569337e (7 hours ago), 2018-06-13 00:02:21 +0200
    • Engine revision a328531402
    • Dart version 2.0.0-dev.60.0.flutter-a5e41681e5

[!] Android toolchain - develop for Android devices (Android SDK 28.0.0)
    • Android SDK at C:\Users\Sreyah Admin\AppData\Local\Android\Sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-28, build-tools 28.0.0
    • ANDROID_HOME …
Run Code Online (Sandbox Code Playgroud)

visual-studio-code flutter

4
推荐指数
1
解决办法
2231
查看次数

flutter中http.post返回307错误代码

我正在使用 http 客户端进行 flutter 网络调用。

  1. 我的要求是让邮递员得到正确的回应,
  2. 但是在尝试使用 http.post 时,它返回错误代码 307-临时重定向,

方法体:

static Future<http.Response> httpPost(
  Map postParam, String serviceURL) async {
Map tempParam = {"id": "username", "pwd": "password"};
var param = json.encode(tempParam);
serviceURL = "http:xxxx/Login/Login";

// temp check
Map<String, String> headers = {
  'Content-Type': 'application/json',
  'cache-control': 'no-cache',
};
await http.post(serviceURL, headers: headers, body: param).then((response) {
  return response;
});
}
Run Code Online (Sandbox Code Playgroud)

此外,相同的代码会返回对其他请求和 URL 的正确响应。首先,我尝试使用 chopper 客户端,但遇到了同样的问题。

我无法从服务器端检测到该问题。

任何帮助/提示都会有帮助

flutter

2
推荐指数
1
解决办法
4469
查看次数

如果声明甚至不能正常发挥作用

这里有一个有趣的问题:

简单的代码块if-else bock.在其他地方阻止if-else阶梯.虽然我写了一个真实的,但如果Color _orderStatus = Colors.blue;这仍然不起作用.

  1. 我谷歌没有解决方案.

2.如果我们打印,orderItem['order_status'].toString() == "DELIVERED"这是显示的.

 if((orderList.length -1) < index)
{
  return Container(child: null); 
} else {

  dynamic orderItem = orderList[index];
  Color _orderStatus = Colors.yellow;

  if(true) 
  {
    Color _orderStatus = Colors.blue;  
  } else if(orderItem['order_status'].toString() == "DELIVERED") {
    Color _orderStatus = Colors.green;  
  } else if(orderItem['order_status'].toString() == "DISPATCHED") {
    Color _orderStatus = Colors.purple;  
  } else if(orderItem['order_status'].toString() == "CANCEL") {
    Color _orderStatus = Colors.red;  
  }

return Container(
Run Code Online (Sandbox Code Playgroud)

dart flutter

0
推荐指数
1
解决办法
158
查看次数

标签 统计

flutter ×6

dart ×3

visual-studio-code ×1