ReorderableColumn не отображается при запуске приложения - PullRequest
0 голосов
/ 22 января 2020

Я разрабатываю приложение, в котором оно загружается из валют фида, поэтому я перечисляю их на домашней странице, поэтому при первой загрузке информация не отображается.

i Использую этот пакет: reorderables

Вот пример: Вот когда приложение запускается

А вот когда появляется информация: При открытии ящика

Вот мой FutureBuilder, который загружает информацию из функции getData ()

FutureBuilder(
              future: this.getData(),
              builder: (BuildContext context, AsyncSnapshot snapshot) {

                if (snapshot.connectionState == ConnectionState.waiting) {

                  return Center(
                    child: CircularProgressIndicator(),
                  );
                }
                if (snapshot.hasData) {
                  print('Data.');
                  this.buildItems();
                return Container(
                  child: Column(
                    children: <Widget>[
                       ReorderableColumn(
                      children: _rows,
                      onReorder: _onReorder,

                      )),

Th Функция buildItems генерирует список со значениями getData найдено:

this._rows = List<Widget>.generate(this.myCurrencies.length, (int index) {
  var format =
      NumberFormat.simpleCurrency(name: this.myCurrencies[index].currencie);
  return Container(
    height: 120,
    margin: EdgeInsets.only(top: 5),
    key: ValueKey(index),
    width: double.infinity,
    child: Row(
      children: <Widget>[
        this.edit
            ? Container(
                width: 50,
                height: 120,
                color: Theme.of(context).accentColor,
                child: Icon(EvaIcons.trash2Outline),
              )
            : Container(),
        Container(
          height: 120,
          color: Theme.of(context).cardColor,
          padding: EdgeInsets.all(15),
          child: Column(
            mainAxisAlignment: MainAxisAlignment.center,
            children: <Widget>[
              Container(
                height: 50,
                width: 50,
                margin: EdgeInsets.only(bottom: 20),
                child: CircleAvatar(
                  backgroundImage: AssetImage(
                      'assets/flags/${this.myCurrencies[index].currencie.toLowerCase()}.png'),
                ),
              ),
              Text(
                  '${this.myCurrencies[index].currencie} - ${format.currencySymbol}')
            ],
          ),
        ),
        Expanded(
          child: Container(
            height: 120,
            color: Theme.of(context).accentColor,
            child: Stack(
              children: <Widget>[
                Container(
                    padding: EdgeInsets.all(10),
                    child: Text(format.currencyName)),
                Container(
                  padding: EdgeInsets.all(10),
                  alignment: !this.edit
                      ? Alignment.bottomRight
                      : Alignment.centerRight,
                  child: !this.edit
                      ? Text(
                          '${this.myCurrencies[index].value}',
                          style: TextStyle(
                              fontSize: 28,
                              color:
                                  Theme.of(context).textTheme.body2.color),
                        )
                      : Icon(EvaIcons.menuOutline),
                )
              ],
            ),
          ),
        )
      ],
    ),
  );
});

И функция getData:

getData() async {


this.list.forEach((value) async {
  await databaseReference
      .child('lastest')
      .child('currencies')
      .child(value.toString().toUpperCase())
      .once()
      .then((v) {
    for (var i = 0; i < this.myCurrencies.length; i++) {
      if (this.myCurrencies[i].currencie == value) {

        return;
      }
    }

    this
        .myCurrencies
        .add(MyCurrencies(currencie: value, value: v.value.toString()));
  });
});

return this.myCurrencies;

}

Любая помощь будет оценена.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...