Как показать круговой прогрессиндикатор вместе с нижним листом во флаттере? - PullRequest
0 голосов
/ 26 апреля 2020

Я использую нижний лист в своем коде, и поэтому он не показывает мой циркулярный прогрессиндикатор, когда isLoading имеет значение true, но в остальном часть троичного оператора работает отлично. Есть ли другой способ сделать это. Или где я делаю не так в коде?

  (isLoading==true) ? Center(
    child: Container(
      height: 24,
      width: 24,
      child: CircularProgressIndicator(
        backgroundColor: CommonColors.primaryColor,
        strokeWidth: 1,
      ),
    ),
  )
      :
  Column(
    children: <Widget>[
      Expanded(
        child: ListView.separated(
          itemCount: clist.cartlist.length,
          itemBuilder: (BuildContext context, int index) {
            return _buildCartProduct(index);
          },
          separatorBuilder: (context, index) {
            return Divider(
              color: Colors.grey[300],
            );
          },
        ),
      ),
      SizedBox(
        height: 80,
      )
    ],
  ),
  bottomSheet: isLoading?Container():Container(
    height: 80.0,
    color: CommonColors.secondaryBackgroundColor,
    child: Column(crossAxisAlignment: CrossAxisAlignment.end,
      children: <Widget>[
        Container(margin: EdgeInsets.symmetric(horizontal: 16),child:
        Text('Total: \$${clist.getSubTotal()}',
          style: TextStyle(fontWeight: FontWeight.bold,fontSize: 16),)),
        Expanded(
          child: FlatButton(onPressed: (){},
            color: CommonColors.primaryColor,
            child: Row(mainAxisAlignment: MainAxisAlignment.center,
              children: <Widget>[
                Text(
                  'PLACE',
                  style: TextStyle(
                    color: CommonColors.secondaryBackgroundColor,
                    fontSize: 20.0,
                    fontWeight: FontWeight.bold,
                  ),
                ),
              ],
            ),
          ),
        ),
      ],
    ),
  ),

1 Ответ

0 голосов
/ 26 апреля 2020

в этой части вы показываете пустой контейнер, если загружаете

bottomSheet: isLoading?Container():Container(

, поэтому измените его на CircularProgressIndicator

bottomSheet: isLoading ? CircularProgressIndicator():Container(
...