Padding(
padding: EdgeInsets.symmetric(horizontal: 20, vertical: 18),
child: Container(
height: 50,
child: SwipingButton(
// backgroundColor: Colors.white,
text: btnTitle,
backgroundColor: btnColor,
onSwipeCallback: () async {
if (status == "accepted") {
status = "arrived";
String rideRequestId =
widget.rideDetails.ride_request_id;
newRequestsRef
.child(rideRequestId)
.child("status")
.set(status);
setState(() {
btnTitle = "Start trip";
btnColor = Colors.green;
});
showDialog(
context: context,
barrierDismissible: false,
builder: (BuildContext context) =>
ProgressDialogue(message: "Please wait..."),
);
await getPlaceDirection(widget.rideDetails.pickup,
widget.rideDetails.dropoff);
Navigator.pop(context);
} else if (status == "arrived") {
status = "onride";
String rideRequestId =
widget.rideDetails.ride_request_id;
newRequestsRef
.child(rideRequestId)
.child("status")
.set(status);
setState(() {
btnTitle = "End trip";
btnColor = Colors.red;
});
initTimer();
} else if (status == "onride") {
endTheTrip();
}
}
),
),
),
If you read my code on each swipe I wanted to change the color and text of the button based on status which found online and when I do that nothing works still it sows me the color and the text that was earlier initialized with.
not sure but i think it not rebuilding,
but if I use a button it works fine
please bro enlighten me