使用将来的构建器时未显示循环进度指示器

时间:2019-12-18 09:55:10

标签: flutter future

我是flutter.noobi的用户。我正在尝试通过单击按钮显示从api加载数据的循环进度。我从api得到响应。但我不是要进入未来的构建者快照中……

/*
 * Intel ACPI Component Architecture
 * AML/ASL+ Disassembler version 20190509 (64-bit version)
 * Copyright (c) 2000 - 2019 Intel Corporation
 * 
 * Disassembling to symbolic ASL+ operators
 *
 * Disassembly of application.bin, Mon Dec 16 18:14:02 2019
 *
 * Original Table Header:
 *     Signature        "SSDT"
 *     Length           0x000000A1 (161)
 *     Revision         0x01
 *     Checksum         0xF4
 *     OEM ID           "BOCHS"
 *     OEM Table ID     "BXPCSSDT"
 *     OEM Revision     0x00000001 (1)
 *     Compiler ID      "INTL"
 *     Compiler Version 0x20191018 (538513432)
 */
DefinitionBlock ("", "SSDT", 1, "BOCHS", "BXPCSSDT", 0x00000001)
{
    External (_SB_.PCI0, DeviceObj)

    Scope (_SB.PCI0)
    {
        Device (BAT0)
        {
            Name (_HID, EisaId ("PNP0C0A") /* Control Method Battery */)  // _HID: Hardware ID
            Name (_UID, Zero)  // _UID: Unique ID
            Method (_STA, 0, NotSerialized)  // _STA: Status
            {
                Return (0x1F)
            }

            Method (_BIF, 0, NotSerialized)  // _BIF: Battery Information
            {
                Return (Package (0x0D)
                {
                    One, 
                    0x1770, 
                    0x1770, 
                    One, 
                    0x39D0, 
                    0x0258, 
                    0x012C, 
                    0x3C, 
                    0x3C, 
                    "", 
                    "", 
                    "LION", 
                    ""
                })
            }

            Method (_BST, 0, NotSerialized)  // _BST: Battery Status
            {
                Return (Package (0x04)
                {
                    Zero, 
                    Zero, 
                    0x1770, 
                    0x39D0
                })
            }
        }
    }
}

}

我正在使用的未来是

_onPressed(){
  setState(() {
  _textCCodeValues=myCCodeController.text;
  _textPhoneNumberValues=myPhoneNumberController.text;
  _textPasswordValues=myPasswordController.text;
  log("mobile",name: _textCCodeValues+" "+_textPhoneNumberValues);
  log("Password",name: _textPasswordValues);
  requestMap={
    'ccode':_textCCodeValues,
    'mobile':_textPhoneNumberValues,
    'password':_textPasswordValues,
    'app_Version':"1.1",
  };
  //_isOtpFieldVisible =!_isOtpFieldVisible;
  requestJson=json.encode(requestMap);
  //StringWidget(future: makeLoginRequest(requestJson));

  //makeLoginRequest(requestJson);

});
FutureBuilder(
  future: makeLoginRequest(requestJson),
  builder: (BuildContext context,AsyncSnapshot snapshot){
    _logData(snapshot.connectionState.toString());
    if(snapshot.connectionState == ConnectionState.waiting){
      _logData("in waiting");
      return SpinKitRotatingCircle(
        color: Colors.blue,
        size: 50.0,
      );
    }
    return null;
  },

);

我不知道出了什么问题。请有人帮我。

1 个答案:

答案 0 :(得分:0)

只需尝试更改您的代码,

FutureBuilder(
  future: makeLoginRequest(requestJson),
  builder: (BuildContext context,AsyncSnapshot snapshot){
    if (snapshot.hasData) {
      return Text("Data");
    } else if(snapshot.hasError) {
        return Text("Error");
    } else {
        return SpinKitRotatingCircle(
        color: Colors.blue,
        size: 50.0,
      );
    }
  },
);