首页 > 解决方案 > 我正在使用 MLkit,并希望将返回的原始值放入 Dropbox/组合框

问题描述

我正在使用 MLkit,并希望将返回的原始值放入 Dropbox/组合框。目前我列出了它们。

请看下面的代码:

return Expanded(
          flex: 1,
          child: Container(
        child: ListView.builder(
            padding: const EdgeInsets.all(1.0),
            itemCount: barcodes.length,
            itemBuilder: (context, i) {
              var text;

              final barcode = barcodes[i];
              switch (widget._scannerType) {
                case BARCODE_SCANNER:
                  VisionBarcode res = barcode as VisionBarcode;
                  text = "Detected Attribute: ${res.rawValue}";
                  break;
                case LABEL_SCANNER:
                  VisionLabel res = barcode as VisionLabel;
                  text = "Detected Attribute: ${res.label}";
                  break;
              }
return _buildTextRow(text);

Widget _buildTextRow(text) {
return ListTile(
  title: Text(
    "$text",
  ),
  dense: true,
);
}

标签: androiddartflutterfirebase-mlkit

解决方案


推荐阅读