262 lines
9.3 KiB
Dart
262 lines
9.3 KiB
Dart
import 'package:camera/camera.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:get/get.dart';
|
|
import 'package:ride/constant/colors.dart';
|
|
import 'package:ride/constant/style.dart';
|
|
import 'package:ride/constant/table_names.dart';
|
|
import 'package:ride/controller/home/captin/home_captain_controller.dart';
|
|
import 'package:ride/controller/home/captin/order_request_controller.dart';
|
|
import 'package:ride/controller/payment/payment_controller.dart';
|
|
import 'package:ride/main.dart';
|
|
import 'package:ride/views/Rate/ride_calculate_driver.dart';
|
|
import 'package:ride/views/home/Captin/camer_widget.dart';
|
|
import 'package:ride/views/home/Captin/text_scanner.dart';
|
|
import 'package:ride/views/widgets/circle_container.dart';
|
|
import 'package:ride/views/widgets/elevated_btn.dart';
|
|
import 'package:flutter_font_icons/flutter_font_icons.dart';
|
|
|
|
import '../../../controller/functions/location_controller.dart';
|
|
import '../../../controller/functions/ocr_controller.dart';
|
|
import '../../../controller/home/captin/widget/connect.dart';
|
|
|
|
class HomeCaptain extends StatelessWidget {
|
|
const HomeCaptain({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
Get.put(LocationController());
|
|
Get.put(OrderRequestController());
|
|
Get.put(HomeCaptainController());
|
|
return Scaffold(
|
|
appBar: AppBar(
|
|
backgroundColor: AppColor.blueColor,
|
|
title: Text('Captain Home'.tr),
|
|
actions: [
|
|
GetBuilder<LocationController>(
|
|
builder: (locationController) => locationController.isLoading
|
|
? const SizedBox(
|
|
height: 1,
|
|
width: 1,
|
|
child: CircularProgressIndicator.adaptive())
|
|
: const SizedBox(),
|
|
),
|
|
IconButton(
|
|
// onPressed: () => box.remove(BoxName.periods),
|
|
onPressed: () => sql.deleteAllData(TableName.driverOrdersRefuse),
|
|
icon: const Icon(Icons.remove)),
|
|
GetBuilder<OrderRequestController>(
|
|
builder: (orderRequestController) => IconButton(
|
|
onPressed: () =>
|
|
orderRequestController.getRefusedOrderByCaptain(),
|
|
icon: const Icon(Icons.get_app)),
|
|
),
|
|
GetBuilder<OrderRequestController>(
|
|
builder: (orderRequestController) => MyCircleContainer(
|
|
child: Text(
|
|
orderRequestController.countRefuse.toString(),
|
|
style: AppStyle.title,
|
|
)))
|
|
],
|
|
),
|
|
drawer: Drawer(
|
|
child: Column(
|
|
children: [
|
|
// Other drawer items
|
|
|
|
MyElevatedButton(title: 'Sign Out'.tr, onPressed: () {})
|
|
],
|
|
),
|
|
),
|
|
body: Column(
|
|
children: [
|
|
GetBuilder<LocationController>(
|
|
builder: (locationController) => Column(
|
|
children: [
|
|
Padding(
|
|
padding: const EdgeInsets.all(8.0),
|
|
child: Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
children: [
|
|
Text(
|
|
'${locationController.myLocation}',
|
|
style: AppStyle.subtitle,
|
|
),
|
|
Text(
|
|
'${DateTime.now()}',
|
|
style: AppStyle.subtitle,
|
|
)
|
|
],
|
|
),
|
|
),
|
|
// TextButton(
|
|
// onPressed: () {
|
|
// MyClass().exampleUsage();
|
|
// },
|
|
// child: Text(
|
|
// "Text Button",
|
|
// ),
|
|
// ),
|
|
],
|
|
)),
|
|
const ConnectWidget(),
|
|
const SizedBox(
|
|
height: 10,
|
|
),
|
|
GetBuilder<HomeCaptainController>(
|
|
builder: (homeCaptainController) => Container(
|
|
decoration: AppStyle.boxDecoration,
|
|
width: Get.width * .8,
|
|
height: 80,
|
|
child: Center(
|
|
child: Row(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
const Icon(
|
|
Entypo.wallet,
|
|
color: AppColor.greenColor,
|
|
),
|
|
Text(
|
|
' You Earn today is '.tr +
|
|
homeCaptainController
|
|
.totalMoneyToday, //Todo add here number for income
|
|
style: AppStyle.title,
|
|
),
|
|
],
|
|
))),
|
|
),
|
|
GetBuilder<HomeCaptainController>(
|
|
builder: (homeCaptainController) => Column(
|
|
children: [
|
|
Text(
|
|
'Active Duration:'.tr +
|
|
' ${homeCaptainController.activeDuration.inSeconds} seconds',
|
|
style: const TextStyle(fontSize: 20),
|
|
),
|
|
Text(
|
|
'Total Duration:'.tr +
|
|
' ${homeCaptainController.totalDurationToday} ',
|
|
style: const TextStyle(fontSize: 20),
|
|
),
|
|
TextButton(
|
|
onPressed: () {
|
|
Get.to(() => const RideCalculateDriver());
|
|
},
|
|
child: const Text('Chart')),
|
|
const Wrap(
|
|
children: <Widget>[
|
|
Icon(AntDesign.facebook_square),
|
|
Icon(AntDesign.wallet),
|
|
Icon(Entypo.wallet),
|
|
Icon(
|
|
Entypo.google__with_circle,
|
|
color: AppColor.redColor,
|
|
),
|
|
Icon(EvilIcons.camera),
|
|
Icon(Feather.activity),
|
|
Icon(
|
|
FontAwesome.whatsapp,
|
|
color: AppColor.greenColor,
|
|
),
|
|
Icon(FontAwesome5.square),
|
|
Icon(FontAwesome5Solid.address_book),
|
|
Icon(FontAwesome5Brands.$500px),
|
|
Icon(Fontisto.google_play),
|
|
Icon(Foundation.hearing_aid),
|
|
Icon(Ionicons.logo_whatsapp),
|
|
Icon(MaterialCommunityIcons.home_city),
|
|
Icon(MaterialIcons.ac_unit),
|
|
Icon(Octicons.watch),
|
|
Icon(SimpleLineIcons.wrench),
|
|
Icon(WeatherIcons.wi_day_sleet),
|
|
Icon(Zocial.github),
|
|
],
|
|
),
|
|
InkWell(
|
|
onTap: () async {
|
|
// TwilioSMS().sendSMS(
|
|
// recipientPhoneNumber: '+962 7 9858 3052',
|
|
// message: 'Hello, this is a test message.',
|
|
// );
|
|
},
|
|
child: const Icon(MaterialIcons.message)),
|
|
TextButton(
|
|
onPressed: () {
|
|
Get.to(() => TextExtractionView());
|
|
},
|
|
child: const Text(
|
|
"Text FlutterTesseractsOcr",
|
|
),
|
|
),
|
|
TextButton(
|
|
onPressed: () {
|
|
Get.to(() => TextRecognizerWidget());
|
|
},
|
|
child: const Text(
|
|
"Text FlutterMLGoogle",
|
|
),
|
|
),
|
|
TextButton(
|
|
onPressed: () {
|
|
Get.to(() => Scaffold(
|
|
appBar: AppBar(),
|
|
body: CameraWidgetCardId(),
|
|
));
|
|
},
|
|
child: const Text(
|
|
"Text IdCamera",
|
|
),
|
|
),
|
|
TextButton(
|
|
onPressed: () {
|
|
PaymentController().makePayment(
|
|
14,
|
|
'USD',
|
|
() => Get.snackbar('Yes you pay success', '',
|
|
backgroundColor: Colors.greenAccent));
|
|
},
|
|
child: const Text(
|
|
"Pay 18 dollar",
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|
|
|
|
// class CameraContainer extends StatelessWidget {
|
|
// TextMLGoogleRecognizerController controller =
|
|
// Get.put(TextMLGoogleRecognizerController());
|
|
|
|
// CameraContainer({super.key});
|
|
// @override
|
|
// Widget build(BuildContext context) {
|
|
// return Stack(
|
|
// children: [
|
|
// // The camera preview
|
|
// SizedBox(
|
|
// height: Get.height * 0.3,
|
|
// width: Get.width * 0.9,
|
|
// child: CameraPreview(controller.imagePicker as CameraController),
|
|
// ),
|
|
|
|
// // The lines on the side of the name and national number
|
|
// const Positioned(
|
|
// bottom: 0,
|
|
// left: 0,
|
|
// right: 0,
|
|
// child: Column(
|
|
// children: [
|
|
// Text('Name'),
|
|
// Text('National Number'),
|
|
// ],
|
|
// ),
|
|
// ),
|
|
// ],
|
|
// );
|
|
// }
|
|
// }
|