Initial commit for Tripz Admin
This commit is contained in:
@@ -20,6 +20,7 @@ import '../../controller/functions/gemeni.dart';
|
||||
import '../../print.dart';
|
||||
import '../widgets/my_scafold.dart';
|
||||
import 'captain/captain.dart';
|
||||
import 'dashboard_widget.dart';
|
||||
import 'drivers/driver_the_best.dart';
|
||||
import 'packages.dart';
|
||||
import 'passenger/passenger.dart';
|
||||
@@ -29,432 +30,352 @@ import 'wallet/wallet.dart';
|
||||
|
||||
class AdminHomePage extends StatelessWidget {
|
||||
const AdminHomePage({super.key});
|
||||
int _calculateCrossAxisCount(BuildContext context) {
|
||||
double screenWidth = MediaQuery.of(context).size.width;
|
||||
if (screenWidth > 1200) {
|
||||
// Large desktops
|
||||
return 5;
|
||||
} else if (screenWidth > 900) {
|
||||
// Desktops / Large Tablets
|
||||
return 4;
|
||||
} else if (screenWidth > 600) {
|
||||
// Tablets
|
||||
return 3;
|
||||
} else {
|
||||
// Phones
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
|
||||
// Helper to format currency (assuming '₵' is your currency symbol)
|
||||
String _formatCurrency(dynamic value) {
|
||||
final number = double.tryParse(value.toString());
|
||||
if (number != null) {
|
||||
return '₵${number.toStringAsFixed(2)}';
|
||||
}
|
||||
return value.toString(); // Fallback to original string if not a number
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
Get.put(DashboardController());
|
||||
|
||||
return MyScafolld(
|
||||
title: 'Admin Home Page',
|
||||
action: IconButton(
|
||||
onPressed: () async {
|
||||
await Get.find<DashboardController>().getDashBoard();
|
||||
},
|
||||
icon: const Icon(
|
||||
Icons.refresh,
|
||||
color: AppColor.greenColor,
|
||||
),
|
||||
title: 'Admin Home Page',
|
||||
action: IconButton(
|
||||
onPressed: () async {
|
||||
await Get.find<DashboardController>().getDashBoard();
|
||||
},
|
||||
icon: const Icon(
|
||||
Icons.refresh,
|
||||
color: AppColor.greenColor,
|
||||
),
|
||||
body: [
|
||||
GetBuilder<DashboardController>(builder: (dashboardController) {
|
||||
return dashboardController.dashbord.isEmpty
|
||||
? const MyCircularProgressIndicator()
|
||||
: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: ListView(
|
||||
// crossAxisAlignment: WrapCrossAlignment.center,
|
||||
// alignment: WrapAlignment.center,
|
||||
children: [
|
||||
Container(
|
||||
width: Get.width,
|
||||
height: Get.height * .6,
|
||||
decoration: AppStyle.boxDecoration1,
|
||||
child: Wrap(
|
||||
spacing: 6,
|
||||
alignment: WrapAlignment.spaceBetween,
|
||||
runAlignment: WrapAlignment.spaceBetween,
|
||||
children: [
|
||||
Container(
|
||||
decoration: AppStyle.boxDecoration1,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Column(
|
||||
children: [
|
||||
Text(
|
||||
'Sms',
|
||||
style: AppStyle.title,
|
||||
),
|
||||
Text(dashboardController.creditSMS
|
||||
.toString()),
|
||||
],
|
||||
),
|
||||
)),
|
||||
Container(
|
||||
decoration: AppStyle.boxDecoration1,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Column(
|
||||
children: [
|
||||
Text(
|
||||
'Passengers',
|
||||
style: AppStyle.title,
|
||||
),
|
||||
Text(dashboardController.dashbord[0]
|
||||
['countPassengers']
|
||||
.toString()),
|
||||
],
|
||||
),
|
||||
)),
|
||||
Container(
|
||||
decoration: AppStyle.boxDecoration1,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Column(
|
||||
children: [
|
||||
Text(
|
||||
'Drivers',
|
||||
style: AppStyle.title,
|
||||
),
|
||||
Text(dashboardController.dashbord[0]
|
||||
['countDriver']
|
||||
.toString()),
|
||||
],
|
||||
),
|
||||
)),
|
||||
Container(
|
||||
decoration: AppStyle.boxDecoration1,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Column(
|
||||
children: [
|
||||
Text(
|
||||
'Rides this month',
|
||||
style: AppStyle.title,
|
||||
),
|
||||
Text(dashboardController.dashbord[0]
|
||||
['countRideThisMonth']
|
||||
.toString()),
|
||||
],
|
||||
),
|
||||
)),
|
||||
Container(
|
||||
decoration: AppStyle.boxDecoration1,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Column(
|
||||
children: [
|
||||
Text(
|
||||
'avg costs',
|
||||
style: AppStyle.title,
|
||||
),
|
||||
Text(dashboardController.dashbord[0]
|
||||
['avg_passenger_price']
|
||||
.toString()),
|
||||
],
|
||||
),
|
||||
)),
|
||||
Container(
|
||||
decoration: AppStyle.boxDecoration1,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Column(
|
||||
children: [
|
||||
Text(
|
||||
'completed ride',
|
||||
style: AppStyle.title,
|
||||
),
|
||||
Text(dashboardController.dashbord[0]
|
||||
['completed_rides']
|
||||
.toString()),
|
||||
],
|
||||
),
|
||||
)),
|
||||
Container(
|
||||
decoration: AppStyle.boxDecoration1,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Column(
|
||||
children: [
|
||||
Text(
|
||||
'cancelled ride',
|
||||
style: AppStyle.title,
|
||||
),
|
||||
Text(dashboardController.dashbord[0]
|
||||
['cancelled_rides']
|
||||
.toString()),
|
||||
],
|
||||
),
|
||||
)),
|
||||
Container(
|
||||
decoration: AppStyle.boxDecoration1,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Column(
|
||||
children: [
|
||||
Text(
|
||||
'payments to driver',
|
||||
style: AppStyle.title,
|
||||
),
|
||||
Text(dashboardController.dashbord[0]
|
||||
['payments']
|
||||
.toString()),
|
||||
],
|
||||
),
|
||||
)),
|
||||
Container(
|
||||
decoration: AppStyle.boxDecoration1,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Column(
|
||||
children: [
|
||||
Text(
|
||||
'sefer wallet',
|
||||
style: AppStyle.title,
|
||||
),
|
||||
Text(dashboardController.dashbord[0]
|
||||
['seferWallet']
|
||||
.toString()),
|
||||
],
|
||||
),
|
||||
)),
|
||||
Container(
|
||||
decoration: AppStyle.boxDecoration1,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Column(
|
||||
children: [
|
||||
Text(
|
||||
'count of transfer',
|
||||
style: AppStyle.title,
|
||||
),
|
||||
Text(dashboardController.dashbord[0]
|
||||
['transfer_from_count']
|
||||
.toString()),
|
||||
],
|
||||
),
|
||||
)),
|
||||
Container(
|
||||
decoration: AppStyle.boxDecoration1,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Column(
|
||||
children: [
|
||||
Text(
|
||||
'Morning',
|
||||
style: AppStyle.title,
|
||||
),
|
||||
Text(dashboardController.dashbord[0]
|
||||
['morning_ride_count']
|
||||
.toString()),
|
||||
],
|
||||
),
|
||||
)),
|
||||
Container(
|
||||
decoration: AppStyle.boxDecoration1,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Column(
|
||||
children: [
|
||||
Text(
|
||||
'evening',
|
||||
style: AppStyle.title,
|
||||
),
|
||||
Text(dashboardController.dashbord[0]
|
||||
['evening_ride_count']
|
||||
.toString()),
|
||||
],
|
||||
),
|
||||
)),
|
||||
Container(
|
||||
decoration: AppStyle.boxDecoration1,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Column(
|
||||
children: [
|
||||
Text(
|
||||
'night',
|
||||
style: AppStyle.title,
|
||||
),
|
||||
Text(dashboardController.dashbord[0]
|
||||
['night_ride_count']
|
||||
.toString()),
|
||||
],
|
||||
),
|
||||
)),
|
||||
Container(
|
||||
decoration: AppStyle.boxDecoration1,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Column(
|
||||
children: [
|
||||
Text(
|
||||
'comfort',
|
||||
style: AppStyle.title,
|
||||
),
|
||||
Text(dashboardController.dashbord[0]
|
||||
['comfort']
|
||||
.toString()),
|
||||
],
|
||||
),
|
||||
)),
|
||||
Container(
|
||||
decoration: AppStyle.boxDecoration1,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Column(
|
||||
children: [
|
||||
Text(
|
||||
'Speed',
|
||||
style: AppStyle.title,
|
||||
),
|
||||
Text(dashboardController.dashbord[0]
|
||||
['speed']
|
||||
.toString()),
|
||||
],
|
||||
),
|
||||
)),
|
||||
Container(
|
||||
decoration: AppStyle.boxDecoration1,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Column(
|
||||
children: [
|
||||
Text(
|
||||
'Lady',
|
||||
style: AppStyle.title,
|
||||
),
|
||||
Text(dashboardController.dashbord[0]
|
||||
['lady']
|
||||
.toString()),
|
||||
],
|
||||
),
|
||||
)),
|
||||
],
|
||||
)),
|
||||
AdminWidgetsDashBoard(
|
||||
title: 'Passengers',
|
||||
onPressed: () => Get.to(() => Passengrs(),
|
||||
transition: Transition.topLevel)),
|
||||
AdminWidgetsDashBoard(
|
||||
title: 'Captains',
|
||||
onPressed: () => Get.to(() => Captain(),
|
||||
transition: Transition.size)),
|
||||
AdminWidgetsDashBoard(
|
||||
title: 'Wallet',
|
||||
onPressed: () => Get.to(() => Wallet(),
|
||||
transition: Transition.fade)),
|
||||
AdminWidgetsDashBoard(
|
||||
title: 'Rides',
|
||||
onPressed: () => Get.to(() => Rides(),
|
||||
transition: Transition.downToUp)),
|
||||
AdminWidgetsDashBoard(
|
||||
title: 'Static',
|
||||
onPressed: () async {
|
||||
await Get.put(StaticController()).getAll();
|
||||
),
|
||||
body: [
|
||||
// This is a List<Widget> for MyScafolld
|
||||
GetBuilder<DashboardController>(builder: (dashboardController) {
|
||||
return dashboardController.dashbord.isEmpty
|
||||
? const MyCircularProgressIndicator()
|
||||
: Padding(
|
||||
// This Padding wraps the entire content for this section
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: ListView(
|
||||
// Changed from a direct ListView for the whole page
|
||||
// to a ListView that contains the stats grid and then other items.
|
||||
children: [
|
||||
// --- Statistics Grid Section ---
|
||||
Container(
|
||||
// width: Get.width, // Not needed in ListView
|
||||
// height: Get.height * .6, // Let GridView determine its height
|
||||
padding: const EdgeInsets.all(
|
||||
8.0), // Padding for the grid container
|
||||
decoration: AppStyle.boxDecoration1.copyWith(
|
||||
// Optional: slightly different background for the grid area
|
||||
// color: (AppStyle.boxDecoration1.color as Color?)?.withAlpha(200) ?? Theme.of(context).cardColor.withAlpha(200),
|
||||
boxShadow: [] // Remove shadow if cards have them, or use a very subtle one
|
||||
),
|
||||
child: GridView.count(
|
||||
crossAxisCount: _calculateCrossAxisCount(context),
|
||||
shrinkWrap: true,
|
||||
physics:
|
||||
const NeverScrollableScrollPhysics(), // Grid shouldn't scroll independently
|
||||
mainAxisSpacing: 10.0,
|
||||
crossAxisSpacing: 10.0,
|
||||
childAspectRatio:
|
||||
1.7, // Adjust for desired card W/H ratio (e.g. 1.5 to 2.0)
|
||||
children: [
|
||||
DashboardStatCard(
|
||||
title: 'SMS Credits',
|
||||
value: dashboardController.creditSMS.toString(),
|
||||
icon: Icons.sms_outlined,
|
||||
iconColor: Colors.lightBlueAccent,
|
||||
),
|
||||
DashboardStatCard(
|
||||
title: 'Passengers',
|
||||
value: dashboardController.dashbord[0]
|
||||
['countPassengers']
|
||||
.toString(),
|
||||
icon: Icons.people_alt_outlined,
|
||||
iconColor: Colors.teal,
|
||||
),
|
||||
DashboardStatCard(
|
||||
title: 'Drivers',
|
||||
value: dashboardController.dashbord[0]
|
||||
['countDriver']
|
||||
.toString(),
|
||||
icon: Icons.sports_motorsports_outlined,
|
||||
iconColor: Colors.orangeAccent,
|
||||
),
|
||||
DashboardStatCard(
|
||||
title: 'Rides (Month)',
|
||||
value: dashboardController.dashbord[0]
|
||||
['countRideThisMonth']
|
||||
.toString(),
|
||||
icon: Icons.calendar_month_outlined,
|
||||
iconColor: Colors.purpleAccent,
|
||||
),
|
||||
DashboardStatCard(
|
||||
title: 'Avg. Ride Cost',
|
||||
value: _formatCurrency(dashboardController
|
||||
.dashbord[0]['avg_passenger_price']),
|
||||
icon: Icons.monetization_on_outlined,
|
||||
iconColor: Colors.green,
|
||||
valueColor: Colors.green.shade700,
|
||||
),
|
||||
DashboardStatCard(
|
||||
title: 'Completed Rides',
|
||||
value: dashboardController.dashbord[0]
|
||||
['completed_rides']
|
||||
.toString(),
|
||||
icon: Icons.check_circle_outline,
|
||||
iconColor: AppColor.greenColor,
|
||||
),
|
||||
DashboardStatCard(
|
||||
title: 'Cancelled Rides',
|
||||
value: dashboardController.dashbord[0]
|
||||
['cancelled_rides']
|
||||
.toString(),
|
||||
icon: Icons.cancel_outlined,
|
||||
iconColor: AppColor.redColor,
|
||||
),
|
||||
DashboardStatCard(
|
||||
title: 'Driver Payments',
|
||||
value: _formatCurrency(
|
||||
dashboardController.dashbord[0]['payments']),
|
||||
icon: Icons.payments_outlined,
|
||||
iconColor: Colors.indigoAccent,
|
||||
valueColor: Colors.indigo.shade700,
|
||||
),
|
||||
DashboardStatCard(
|
||||
title: 'Tripz Wallet',
|
||||
value: _formatCurrency(dashboardController
|
||||
.dashbord[0]['seferWallet']),
|
||||
icon: Icons.account_balance_wallet_outlined,
|
||||
iconColor: Colors.deepOrangeAccent,
|
||||
valueColor: Colors.deepOrange.shade700,
|
||||
),
|
||||
DashboardStatCard(
|
||||
title: 'Transfers Count',
|
||||
value: dashboardController.dashbord[0]
|
||||
['transfer_from_count']
|
||||
.toString(),
|
||||
icon: Icons.swap_horiz_outlined,
|
||||
iconColor: Colors.brown,
|
||||
),
|
||||
DashboardStatCard(
|
||||
title: 'Morning Rides',
|
||||
value: dashboardController.dashbord[0]
|
||||
['morning_ride_count']
|
||||
.toString(),
|
||||
icon: Icons.wb_sunny_outlined,
|
||||
iconColor: Colors.amberAccent,
|
||||
),
|
||||
DashboardStatCard(
|
||||
title: 'Evening Rides',
|
||||
value: dashboardController.dashbord[0]
|
||||
['evening_ride_count']
|
||||
.toString(),
|
||||
icon: Icons.brightness_4_outlined,
|
||||
iconColor: Colors.blueGrey,
|
||||
),
|
||||
DashboardStatCard(
|
||||
title: 'Night Rides',
|
||||
value: dashboardController.dashbord[0]
|
||||
['night_ride_count']
|
||||
.toString(),
|
||||
icon: Icons.nightlight_round_outlined,
|
||||
iconColor: Colors.black54,
|
||||
),
|
||||
DashboardStatCard(
|
||||
title: 'Comfort Type',
|
||||
value: dashboardController.dashbord[0]['comfort']
|
||||
.toString(),
|
||||
icon: Icons.event_seat_outlined,
|
||||
iconColor: Colors.cyan,
|
||||
),
|
||||
DashboardStatCard(
|
||||
title: 'Speed Type',
|
||||
value: dashboardController.dashbord[0]['speed']
|
||||
.toString(),
|
||||
icon: Icons.speed_outlined,
|
||||
iconColor: Colors.red,
|
||||
),
|
||||
DashboardStatCard(
|
||||
title: 'Lady Type',
|
||||
value: dashboardController.dashbord[0]['lady']
|
||||
.toString(),
|
||||
icon: Icons.woman_2_outlined,
|
||||
iconColor: Colors.pinkAccent,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
// --- End of Statistics Grid Section ---
|
||||
|
||||
Get.to(() => const StaticDash());
|
||||
},
|
||||
),
|
||||
AdminWidgetsDashBoard(
|
||||
title: 'send Whatsapp to Drivers',
|
||||
onPressed: () async {
|
||||
Get.defaultDialog(
|
||||
title: 'Are you sure to send by WhatsApp ?',
|
||||
middleText: '',
|
||||
confirm: MyElevatedButton(
|
||||
title: 'Ok',
|
||||
kolor: AppColor.greenColor,
|
||||
onPressed: () async {
|
||||
Log.print(
|
||||
'CRUD().phoneDriversTest.: ${CRUD().phoneDriversTest}');
|
||||
for (var phoneNumber
|
||||
in CRUD().phoneDrivers) {
|
||||
await CRUD().sendWhatsAppAuth(
|
||||
phoneNumber.toString());
|
||||
}
|
||||
}),
|
||||
cancel: MyElevatedButton(
|
||||
title: 'cancel',
|
||||
kolor: AppColor.redColor,
|
||||
onPressed: () => Get.back()));
|
||||
}),
|
||||
AdminWidgetsDashBoard(
|
||||
title: 'send notification Drivers',
|
||||
onPressed: () async {
|
||||
await Get.put(NotificationController())
|
||||
.getTokensDrivers();
|
||||
}),
|
||||
AdminWidgetsDashBoard(
|
||||
title: 'send SMS Drivers',
|
||||
onPressed: () async {
|
||||
Get.defaultDialog(
|
||||
title: 'Are you sure to send SMS ?',
|
||||
middleText: '',
|
||||
content: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Form(
|
||||
key: dashboardController.formKey,
|
||||
child: MyTextForm(
|
||||
controller:
|
||||
dashboardController.smsText,
|
||||
label: 'label',
|
||||
hint: 'hint',
|
||||
type: TextInputType.name)),
|
||||
),
|
||||
confirm: MyElevatedButton(
|
||||
title: 'Ok',
|
||||
kolor: AppColor.greenColor,
|
||||
onPressed: () async {
|
||||
dashboardController.sendSMSMethod();
|
||||
}),
|
||||
cancel: MyElevatedButton(
|
||||
title: 'cancel',
|
||||
kolor: AppColor.redColor,
|
||||
onPressed: () => Get.back()));
|
||||
}),
|
||||
AdminWidgetsDashBoard(
|
||||
title: 'send notification Passengers',
|
||||
onPressed: () async {
|
||||
await Get.put(NotificationController())
|
||||
.getTokensPassengers();
|
||||
}),
|
||||
AdminWidgetsDashBoard(
|
||||
title: 'register captain'.tr,
|
||||
// --- Your AdminWidgetsDashBoard items follow ---
|
||||
AdminWidgetsDashBoard(
|
||||
title: 'Passengers',
|
||||
icon: Icons.people_outline,
|
||||
onPressed: () => Get.to(() => Passengrs(),
|
||||
transition: Transition.topLevel)),
|
||||
AdminWidgetsDashBoard(
|
||||
title: 'Captains',
|
||||
icon: Icons.sports_motorsports_outlined,
|
||||
onPressed: () => Get.to(() => Captain(),
|
||||
transition: Transition.size)),
|
||||
// ... (Add all your other AdminWidgetsDashBoard items here with icons)
|
||||
AdminWidgetsDashBoard(
|
||||
title: 'Wallet',
|
||||
icon: Icons.account_balance_wallet_outlined,
|
||||
onPressed: () => Get.to(() => Wallet(),
|
||||
transition: Transition.fade)),
|
||||
AdminWidgetsDashBoard(
|
||||
title: 'Rides',
|
||||
icon: Icons.directions_car_filled_outlined,
|
||||
onPressed: () => Get.to(() => Rides(),
|
||||
transition: Transition.downToUp)),
|
||||
AdminWidgetsDashBoard(
|
||||
title: 'Static',
|
||||
icon: Icons.bar_chart_outlined,
|
||||
onPressed: () async {
|
||||
await Get.put(StaticController()).getAll();
|
||||
Get.to(() => const StaticDash());
|
||||
},
|
||||
),
|
||||
AdminWidgetsDashBoard(
|
||||
title: 'send Whatsapp to Drivers',
|
||||
icon: Icons.message_outlined,
|
||||
iconColor: Colors.green,
|
||||
onPressed: () async {
|
||||
await Get.put(RegisterCaptainController())
|
||||
.getDriverNotCompleteRegistration();
|
||||
Get.to(() => const DriversCantRegister());
|
||||
},
|
||||
),
|
||||
AdminWidgetsDashBoard(
|
||||
title: 'update packages'.tr,
|
||||
Get.defaultDialog(
|
||||
title: 'Are you sure to send by WhatsApp ?',
|
||||
middleText: '',
|
||||
confirm: MyElevatedButton(
|
||||
title: 'Ok',
|
||||
kolor: AppColor.greenColor,
|
||||
onPressed: () async {
|
||||
Log.print(
|
||||
'CRUD().phoneDriversTest.: ${CRUD().phoneDriversTest}');
|
||||
for (var phoneNumber
|
||||
in CRUD().phoneDrivers) {
|
||||
await CRUD().sendWhatsAppAuth(
|
||||
phoneNumber.toString());
|
||||
}
|
||||
}),
|
||||
cancel: MyElevatedButton(
|
||||
title: 'cancel',
|
||||
kolor: AppColor.redColor,
|
||||
onPressed: () => Get.back()));
|
||||
}),
|
||||
AdminWidgetsDashBoard(
|
||||
title: 'send notification Drivers',
|
||||
icon: Icons.notifications_active_outlined,
|
||||
onPressed: () async {
|
||||
Get.to(() => PackageUpdateScreen());
|
||||
},
|
||||
),
|
||||
AdminWidgetsDashBoard(
|
||||
title: 'Employee'.tr,
|
||||
await Get.put(NotificationController())
|
||||
.getTokensDrivers();
|
||||
}),
|
||||
AdminWidgetsDashBoard(
|
||||
title: 'send SMS Drivers',
|
||||
icon: Icons.sms_outlined,
|
||||
onPressed: () async {
|
||||
Get.to(() => EmployeePage());
|
||||
},
|
||||
),
|
||||
AdminWidgetsDashBoard(
|
||||
title: 'Drivers the best'.tr,
|
||||
Get.defaultDialog(
|
||||
title: 'Are you sure to send SMS ?',
|
||||
middleText: '',
|
||||
content: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Form(
|
||||
key: dashboardController.formKey,
|
||||
child: MyTextForm(
|
||||
controller:
|
||||
dashboardController.smsText,
|
||||
label: 'label',
|
||||
hint: 'hint',
|
||||
type: TextInputType.name)),
|
||||
),
|
||||
confirm: MyElevatedButton(
|
||||
title: 'Ok',
|
||||
kolor: AppColor.greenColor,
|
||||
onPressed: () async {
|
||||
dashboardController.sendSMSMethod();
|
||||
}),
|
||||
cancel: MyElevatedButton(
|
||||
title: 'cancel',
|
||||
kolor: AppColor.redColor,
|
||||
onPressed: () => Get.back()));
|
||||
}),
|
||||
AdminWidgetsDashBoard(
|
||||
title: 'send notification Passengers',
|
||||
icon: Icons.notification_important_outlined,
|
||||
onPressed: () async {
|
||||
Get.to(() => DriverTheBest());
|
||||
},
|
||||
),
|
||||
|
||||
// AdminWidgetsDashBoard(
|
||||
// title: 'Llama',
|
||||
// onPressed: () =>
|
||||
// CarRegistrationRecognizerController().scanText()),
|
||||
AdminWidgetsDashBoard(
|
||||
title: 'Add device to be Admin',
|
||||
onPressed: () async {
|
||||
// Map device = DeviceInfoPlus.deviceData;
|
||||
await CRUD()
|
||||
.post(link: AppLink.addAdminUser, payload: {
|
||||
// 'deviceNumber': device['serialNumber'].toString(),
|
||||
'name': 'b',
|
||||
});
|
||||
}),
|
||||
],
|
||||
),
|
||||
);
|
||||
})
|
||||
],
|
||||
isleading: false);
|
||||
await Get.put(NotificationController())
|
||||
.getTokensPassengers();
|
||||
}),
|
||||
AdminWidgetsDashBoard(
|
||||
title: 'register captain'.tr,
|
||||
icon: Icons.person_add_alt_1_outlined,
|
||||
onPressed: () async {
|
||||
await Get.put(RegisterCaptainController())
|
||||
.getDriverNotCompleteRegistration();
|
||||
Get.to(() => const DriversCantRegister());
|
||||
},
|
||||
),
|
||||
AdminWidgetsDashBoard(
|
||||
title: 'update packages'.tr,
|
||||
icon: Icons.inventory_2_outlined,
|
||||
onPressed: () async {
|
||||
Get.to(() => PackageUpdateScreen());
|
||||
},
|
||||
),
|
||||
AdminWidgetsDashBoard(
|
||||
title: 'Employee'.tr,
|
||||
icon: Icons.badge_outlined,
|
||||
onPressed: () async {
|
||||
Get.to(() => EmployeePage());
|
||||
},
|
||||
),
|
||||
AdminWidgetsDashBoard(
|
||||
title: 'Drivers the best'.tr,
|
||||
icon: Icons.star_outline,
|
||||
onPressed: () async {
|
||||
Get.to(() => DriverTheBest());
|
||||
},
|
||||
),
|
||||
AdminWidgetsDashBoard(
|
||||
title: 'Add device to be Admin',
|
||||
icon: Icons.admin_panel_settings_outlined,
|
||||
onPressed: () async {
|
||||
await CRUD()
|
||||
.post(link: AppLink.addAdminUser, payload: {
|
||||
'name': 'b',
|
||||
});
|
||||
}),
|
||||
],
|
||||
),
|
||||
);
|
||||
})
|
||||
],
|
||||
isleading: false,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -463,25 +384,76 @@ class AdminWidgetsDashBoard extends StatelessWidget {
|
||||
super.key,
|
||||
required this.title,
|
||||
required this.onPressed,
|
||||
this.icon, // Optional icon
|
||||
this.iconColor,
|
||||
this.backgroundColor,
|
||||
});
|
||||
|
||||
final String title;
|
||||
final Callback onPressed;
|
||||
final IconData? icon;
|
||||
final Color? iconColor;
|
||||
final Color? backgroundColor;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
padding: const EdgeInsets.symmetric(vertical: 6.0, horizontal: 12.0),
|
||||
child: InkWell(
|
||||
onTap: onPressed,
|
||||
borderRadius:
|
||||
BorderRadius.circular(12.0), // Rounded corners for tap effect
|
||||
child: Container(
|
||||
decoration: AppStyle.boxDecoration,
|
||||
height: 50,
|
||||
width: Get.width * .4,
|
||||
child: Center(
|
||||
child: Text(
|
||||
title.tr,
|
||||
style: AppStyle.title,
|
||||
),
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 16.0, vertical: 16.0), // Increased padding
|
||||
decoration: BoxDecoration(
|
||||
color: backgroundColor ??
|
||||
Theme.of(context).cardColor, // Use provided or theme card color
|
||||
borderRadius: BorderRadius.circular(12.0),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.grey.withOpacity(0.15),
|
||||
spreadRadius: 1,
|
||||
blurRadius: 8,
|
||||
offset: const Offset(0, 2), // changes position of shadow
|
||||
),
|
||||
],
|
||||
// If you want to use AppStyle.boxDecoration as a base and modify it:
|
||||
// ...AppStyle.boxDecoration.copyWith(
|
||||
// color: backgroundColor ?? AppStyle.boxDecoration.color,
|
||||
// // Potentially override other properties of AppStyle.boxDecoration if needed
|
||||
// ),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
if (icon != null) ...[
|
||||
Icon(
|
||||
icon,
|
||||
size: 28, // Slightly larger icon
|
||||
color: iconColor ??
|
||||
AppColor.primaryColor, // Use primary color or provided
|
||||
),
|
||||
const SizedBox(width: 16),
|
||||
],
|
||||
Expanded(
|
||||
child: Text(
|
||||
title.tr,
|
||||
style: AppStyle.title.copyWith(
|
||||
fontSize: 16, // Adjust font size for better readability
|
||||
fontWeight: FontWeight.w500, // Medium weight
|
||||
color: Theme.of(context)
|
||||
.textTheme
|
||||
.bodyLarge
|
||||
?.color, // Use theme text color
|
||||
),
|
||||
),
|
||||
),
|
||||
const Icon(
|
||||
Icons.arrow_forward_ios,
|
||||
size: 18,
|
||||
color: Colors.grey, // Subtle indicator for navigation
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user