This commit is contained in:
Hamza-Ayed
2024-01-25 02:10:41 +03:00
parent cbd6b45245
commit 9a58d59f4e
9 changed files with 153 additions and 47 deletions

View File

@@ -39,6 +39,7 @@ class RideBeginPassenger extends StatelessWidget {
),
Stack(
children: [
// StreamCounter(),
LinearProgressIndicator(
backgroundColor: AppColor.accentColor,
color: controller.remainingTimeTimerRideBegin < 60
@@ -200,3 +201,39 @@ class RideBeginPassenger extends StatelessWidget {
});
}
}
class StreamCounter extends StatelessWidget {
const StreamCounter({Key? key}) : super(key: key);
@override
// Build the UI based on the timer value
Widget build(BuildContext context) {
Get.put(MapPassengerController());
return GetBuilder<MapPassengerController>(builder: (controller) {
return StreamBuilder<int>(
initialData: 0,
stream: controller.timerController.stream,
builder: (context, snapshot) {
// Calculate the remaining time based on the current tick
final remainingTime = controller.durationToRide - snapshot.data!;
// Format the remaining time as a string
final formattedRemainingTime =
'${(remainingTime / 60).floor()}:${(remainingTime % 60).toString().padLeft(2, '0')}';
// Return the UI widgets based on the remaining time
return Column(
children: [
Text(formattedRemainingTime),
// ElevatedButton(
// onPressed: () {
// // Handle button press here
// },
// ),
],
);
},
);
});
}
}