Salim
Salim

Reputation: 67

How can I use slider inside dynamic list and send them value to the database in flutter UPDATE #3

I felt flutter staff here either they can't help us or don't want that :( , I feel despair

I have app need to show list of duties each duty have default value of degree show as slider ,I want after i change the all sliders shown and when i click a button send the new values to server How can i do that ? this is the list map show the slider

in this code below i have just one problem ,the slider indicator don't move but their data sent to database and inserted correctly

Container(
                              decoration: BoxDecoration(
                                  borderRadius: BorderRadius.circular(15),
                                  border: Border.all(
                                      width: 2, color: Colors.white),
                                  color:
                                      Color.fromRGBO(230, 200, 200, 0.2)),
                              width: widthView,
                              padding: EdgeInsets.all(25),
                              margin: EdgeInsets.fromLTRB(0, 25, 0, 25),
                              child: Column(
                                children: <Widget>[
                                  Text(
                                    lang == 'k'
                                        ? item.activity_k
                                        : item.activity_a,
                                    textAlign: TextAlign.justify,
                                    style: TextStyle(
                                        fontSize: 28, color: Colors.white),
                                  ),
                                  SizedBox(
                                    height: 15,
                                  ),
                                  Container(
                                      decoration: BoxDecoration(
                                          boxShadow: [
                                            BoxShadow(
                                              color: Colors.yellow[200]
                                                  .withOpacity(0.2),
                                              spreadRadius: 2,
                                              blurRadius: 20,
                                            )
                                          ],
                                          borderRadius:
                                              BorderRadius.circular(15),
                                          color:
                                              Color.fromRGBO(0, 0, 0, 0.4)),
                                      width: widthView,
                                      padding: EdgeInsets.all(10),
                                      child: Slider(
                                        max: 100,
                                        min: 0,
                                        divisions: 20,
                                        value: _value,
                                        label: _value.toString(),
                                        onChanged: (double val) {},
                                        onChangeEnd: (val) {
                                          create_list(u_id, m_id, w_id, did,
                                              item.act_id, val);
                                        },
                                      )),
                                  SizedBox(
                                    height: 10,
                                  ),
                                  Text(_value.toString(),
                                      style: TextStyle(
                                          fontSize: 26,
                                          color: Colors.white))
                                ],
                              ),
                            )
                          ],
                        ),
                      );
                    }).toList()),

my app is finished just i need to solve thsis issue

Upvotes: 1

Views: 342

Answers (1)

Salim
Salim

Reputation: 67

I changed my way to solve problem ,I deleted the insert button and made the values inserted automatically after move the slider. and it works correctly 100%

Upvotes: 1

Related Questions