MultiListmap项目显示在列表视图中

时间:2019-10-28 06:31:06

标签: flutter dart

我有一个MultiListmap,我需要这个地图,因为我需要具有多个值的相同键,因此在视图中,这个键将是标题,并且项将位于此标题下,当下一个键出现时,它将成为标题并然后将该键的值显示为其子键并继续。

我不能像上面提到的那样做。有人可以帮忙吗? 我的UI看起来像[1、2、3]

ListView.builder(
            shrinkWrap: true,
            physics: ScrollPhysics(),
            itemBuilder: (context, position) {
              String key = widget.selectedHeaderItem.keys.elementAt(position);
              String value = widget.selectedHeaderItem.values.elementAt(position);


              //for
              var keys = widget.selectedHeaderItem.keys.toList();
              List<String> values = widget.selectedHeaderItem[keys[position]];

              print("FROM ORDER PAGE key"+keys.length.toString());
              print("FROM ORDER PAGE value"+values.length.toString());

              return Row(mainAxisAlignment: MainAxisAlignment.spaceBetween,

                children: <Widget>[


                  Expanded(
                    child:  Padding(
                      padding: const EdgeInsets.only(left: 15.0,right:8.0 ,top:8.0 ,bottom:8.0 ),
                      child: Text("${widget.selectedHeaderItem[keys[position]]}",style: TextStyle(fontSize: 20)),
                    ),
                  ),


                  Expanded(
                    child: Padding(
                      padding: const EdgeInsets.all(8.0),
                      child: SizedBox(
                        width: 200,
                        child:TextFormField(
                          textAlign: TextAlign.center,
                          decoration: new InputDecoration(
                              border: new OutlineInputBorder(
                                borderRadius: const BorderRadius.all(
                                  const Radius.circular(10.0),
                                ),
                              ),
                              filled: true,

                              hintStyle: new TextStyle(
                                  fontFamily: 'futura',

                                  color: Colors.grey[800]),
                              hintText: "QTY",

                              fillColor: Colors.white70),
                        ),
                      ),
                    ),
                  ),



                ],);



            },
            itemCount: widget.selectedHeaderItem.length,
          )

0 个答案:

没有答案