driverSelectOrder.dart 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. import 'package:flutter/material.dart';
  2. import '../../../models/order.dart';
  3. import '../driverMain.dart';
  4. import 'driverPickup.dart';
  5. class driverSelectOrder extends StatelessWidget {
  6. @override
  7. Widget build(BuildContext context) {
  8. return Scaffold(
  9. appBar: AppBar(
  10. leading: IconButton(
  11. icon: const Icon(
  12. Icons.chevron_left,
  13. size: 36,
  14. ),
  15. onPressed: () {
  16. Navigator.push(
  17. context,
  18. MaterialPageRoute(builder: (context) => driverMain()),
  19. );
  20. },
  21. ),
  22. title: const Text('Select Your Order'),
  23. actions: [
  24. IconButton(
  25. icon: const Icon(Icons.logout),
  26. onPressed: () {
  27. },
  28. ),
  29. ],
  30. ),
  31. body: ListView.builder(
  32. itemCount:
  33. orders.length, // replace with your data length from the database
  34. itemBuilder: (context, index) {
  35. // Here pull data from a database
  36. final order = orders[index];
  37. return Card(
  38. margin: const EdgeInsets.all(8.0),
  39. child: Padding(
  40. padding: const EdgeInsets.all(12.0),
  41. child: Column(
  42. children: <Widget>[
  43. Row(
  44. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  45. children: <Widget>[
  46. Text(
  47. '${order.time} ', // Replace with variable for time and day
  48. style: const TextStyle(
  49. fontWeight: FontWeight.bold,
  50. fontSize: 18,
  51. ),
  52. ),
  53. Text(
  54. 'Price: RM ${order.price}', // Replace with variable for price
  55. style: const TextStyle(
  56. fontWeight: FontWeight.bold,
  57. fontSize: 16,
  58. ),
  59. ),
  60. ],
  61. ),
  62. const SizedBox(height: 10),
  63. Row(
  64. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  65. children: <Widget>[
  66. Text(
  67. 'Route: ${order.route}'), // Replace with variable for route
  68. Text(
  69. 'Start: ${order.start}'), // Replace with variable for start point
  70. ],
  71. ),
  72. const SizedBox(height: 10),
  73. Row(
  74. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  75. children: <Widget>[
  76. Text(
  77. 'Pax: ${order.pax}'), // Replace with boolean variable
  78. ],
  79. ),
  80. const SizedBox(height: 10),
  81. ElevatedButton(
  82. onPressed: () {
  83. // Handle accept action
  84. Navigator.push(
  85. context,
  86. MaterialPageRoute(builder: (context) => driverPickup()),
  87. );
  88. },
  89. child: const Text(
  90. 'Accept',
  91. style: TextStyle(color: Colors.white),
  92. ),
  93. style: ElevatedButton.styleFrom(
  94. primary:
  95. const Color.fromRGBO(119, 97, 255, 1.0), // Background color
  96. ),
  97. ),
  98. ],
  99. ),
  100. ),
  101. );
  102. },
  103. ),
  104. );
  105. }
  106. }