flutterratingbar

How to display rating in SmoothStarRating from sqlite in flutter


I have a starsmoothrating bar in flutter. I save the rating in my note table. How can I display the same while updating the note?

 Padding(
                padding: const EdgeInsets.all(10.0),
                child: Row(mainAxisAlignment: MainAxisAlignment.start,
                    children:<Widget>[
                      Text("Priority",style: TextStyle(fontSize: 20.0),),
                      Padding(
                        padding: const EdgeInsets.only(left:20.0),
                        child: Container(
                          child: SmoothStarRating(
                            size: height=50.0,
                            allowHalfRating: false,
                            onRated: (value) {
                              this.note.prty=value;
                            },
                          ),
                        ),
                      )]),
              ),

Solution

  • Yes thanku Krish Bhanushali it worked I just used the rating parameter.

    SmoothStarRating(
                                size: height=50.0,
                                allowHalfRating: false,
                                rating: note.prty ?? 0,
                                onRated: (v) {
                                  setState(() {
                                    this.note.prty=v;
    
                                  });
                                  
                                },
                              ),