🚗🏍️ Welcome to Motoshare!

Turning Idle Vehicles into Shared Rides & New Earnings.
Why let your bike or car sit idle when it can earn for you and move someone else forward?

From Idle to Income. From Parked to Purpose.
Earn by Sharing, Ride by Renting.
Where Owners Earn, Riders Move.
Owners Earn. Riders Move. Motoshare Connects.

With Motoshare, every parked vehicle finds a purpose. Partners earn. Renters ride. Everyone wins.

Start Your Journey with Motoshare

How to apply checkbox in flutter

Uncategorized

step 1

set variable in class


String myflight;

bool Flight = false;

Implement in Route in onpress()

                                    onPressed: () {
                                      setState(() async {
                                        _controllerCategory.text =
                                            widget.Category;
                                            String myflights= 
                                             myflight.toString(); 
                                            ;
                                            widget._isLoading = true;
            
                                            _isallLoading == true
                                                ? _storemytrip(
                                                    myflights,
                                                  );
                                          });
                                        }
                                      });
                                    }

Implement cheakbox

  Widget _buildCheckboxFlight() => ListTile(
        title: Text(
          'Flight',
          style: TextStyle(
            color: Colors.black54,
            fontSize: 16,
          ),
        ),
        trailing: Checkbox(
          value: Flight,
          onChanged: (bool? value) {
            setState(() {
              this.Flight = value!;
              if(Flight==true){
              myflight=1.toString();
              print("myflight");
              print(myflight);
              }
                else{
              myflight=0.toString();
              print(" else myflight");
              print(myflight);
              }
              print(Flight);
              print(this.Flight);
            });
          },
        ),
      );

Output

And if want to know to ternary operator in flutter.If you want more clarity output please click here.

0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x