416 lines
20 KiB
Dart
416 lines
20 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:get/get.dart';
|
|
import 'package:get/get_rx/src/rx_typedefs/rx_typedefs.dart';
|
|
import 'package:sefer_admin1/constant/colors.dart';
|
|
import 'package:sefer_admin1/controller/admin/dashboard_controller.dart';
|
|
import 'package:sefer_admin1/controller/admin/register_captain_controller.dart';
|
|
import 'package:sefer_admin1/controller/admin/static_controller.dart';
|
|
import 'package:sefer_admin1/controller/notification_controller.dart';
|
|
import 'package:sefer_admin1/views/admin/captain/drivers_cant_registe.dart';
|
|
import 'package:sefer_admin1/views/admin/captain/register_captain.dart';
|
|
import 'package:sefer_admin1/views/widgets/mycircular.dart';
|
|
|
|
import '../../constant/links.dart';
|
|
import '../../constant/style.dart';
|
|
import '../../controller/functions/crud.dart';
|
|
import '../../controller/functions/gemeni.dart';
|
|
import '../widgets/my_scafold.dart';
|
|
import 'captain/captain.dart';
|
|
import 'passenger/passenger.dart';
|
|
import 'rides/rides.dart';
|
|
import 'static/static.dart';
|
|
import 'wallet/wallet.dart';
|
|
|
|
class AdminHomePage extends StatelessWidget {
|
|
const AdminHomePage({super.key});
|
|
|
|
@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,
|
|
),
|
|
),
|
|
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();
|
|
|
|
Get.to(() => const StaticDash());
|
|
},
|
|
),
|
|
AdminWidgetsDashBoard(
|
|
title: 'send notification Drivers',
|
|
onPressed: () async {
|
|
await Get.put(NotificationController())
|
|
.getTokensDrivers();
|
|
}),
|
|
AdminWidgetsDashBoard(
|
|
title: 'send notification Passengers',
|
|
onPressed: () async {
|
|
await Get.put(NotificationController())
|
|
.getTokensPassengers();
|
|
}),
|
|
AdminWidgetsDashBoard(
|
|
title: 'register captain'.tr,
|
|
onPressed: () async {
|
|
await Get.put(RegisterCaptainController())
|
|
.getDriverNotCompleteRegistration();
|
|
Get.to(() => DriversCantRegister());
|
|
},
|
|
),
|
|
|
|
// 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);
|
|
}
|
|
}
|
|
|
|
class AdminWidgetsDashBoard extends StatelessWidget {
|
|
const AdminWidgetsDashBoard({
|
|
super.key,
|
|
required this.title,
|
|
required this.onPressed,
|
|
});
|
|
final String title;
|
|
final Callback onPressed;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Padding(
|
|
padding: const EdgeInsets.all(8.0),
|
|
child: InkWell(
|
|
onTap: onPressed,
|
|
child: Container(
|
|
decoration: AppStyle.boxDecoration,
|
|
height: 50,
|
|
width: Get.width * .4,
|
|
child: Center(
|
|
child: Text(
|
|
title.tr,
|
|
style: AppStyle.title,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|