fixed api
This commit is contained in:
@ -1,26 +1,420 @@
|
||||
// ignore_for_file: file_names
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_slidable/flutter_slidable.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:google_maps_flutter/google_maps_flutter.dart';
|
||||
|
||||
import '../../../controller/after_login/kurir/logKirimanController.dart';
|
||||
import '../../../function/allFunction.dart';
|
||||
import '../../../models/pengirimimanModel.dart';
|
||||
import '../../../widgets/bounce_scroller.dart';
|
||||
import '../../../widgets/boxBackgroundDecoration.dart';
|
||||
import '../../../widgets/load_data.dart';
|
||||
import 'pengirimanPage.dart';
|
||||
|
||||
class LogHistoryKurirPage extends StatelessWidget {
|
||||
class LogHistoryKurirPage extends GetView<LogKirimanControllerKurir> {
|
||||
const LogHistoryKurirPage({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return const Scaffold(
|
||||
return Scaffold(
|
||||
body: BoxBackgroundDecoration(
|
||||
child: Center(
|
||||
child: Text(
|
||||
'Log History',
|
||||
style: TextStyle(
|
||||
fontSize: 30,
|
||||
color: Colors.white,
|
||||
child: Stack(
|
||||
children: [
|
||||
Container(
|
||||
alignment: Alignment.center,
|
||||
width: double.infinity * 0.9,
|
||||
height: double.infinity,
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
SizedBox(height: MediaQuery.of(context).size.height * 0.13),
|
||||
_MainWidget(controller: controller),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
const TopSeachInput(),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _MainWidget extends StatelessWidget {
|
||||
const _MainWidget({
|
||||
Key? key,
|
||||
required this.controller,
|
||||
}) : super(key: key);
|
||||
|
||||
final LogKirimanControllerKurir controller;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Padding(
|
||||
padding: EdgeInsets.only(
|
||||
left: MediaQuery.of(context).size.height * 0.03,
|
||||
right: MediaQuery.of(context).size.height * 0.03),
|
||||
child: Obx(
|
||||
() => BounceScrollerWidget(
|
||||
children: [
|
||||
if (controller.loadPengiriman.value == 0) const LoadingDataWidget(),
|
||||
if (controller.loadPengiriman.value == 1 &&
|
||||
controller.pengirimanModelList.isNotEmpty)
|
||||
for (var data in controller.pengirimanModelList)
|
||||
_SlidableWidget(data: data, controller: controller),
|
||||
if (controller.loadPengiriman.value == 1 &&
|
||||
controller.pengirimanModelList.isEmpty)
|
||||
const Center(
|
||||
child: TiadaDataWIdget(
|
||||
text: "Tiada data pengiriman\ndalam proses pengesahan")),
|
||||
if (controller.loadPengiriman.value == 2)
|
||||
const ErrorLoadDataWidget(),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _SlidableWidget extends StatelessWidget {
|
||||
const _SlidableWidget({
|
||||
Key? key,
|
||||
required this.data,
|
||||
required this.controller,
|
||||
}) : super(key: key);
|
||||
|
||||
final PengirimanModel data;
|
||||
final LogKirimanControllerKurir controller;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
late String _text;
|
||||
late IconData _icon;
|
||||
|
||||
switch (data.statusPengiriman) {
|
||||
case "Paket Diterima Oleh Penerima":
|
||||
_text = "Paket Telah\nDiterima Oleh\nPenerima";
|
||||
_icon = Icons.check_box;
|
||||
break;
|
||||
|
||||
default:
|
||||
}
|
||||
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(bottom: 10),
|
||||
child: Slidable(
|
||||
key: const ValueKey(1),
|
||||
startActionPane: ActionPane(
|
||||
motion: const DrawerMotion(),
|
||||
extentRatio: 0.90,
|
||||
// dismissible: DismissiblePane(onDismissed: () {}),
|
||||
children: [
|
||||
SlidableAction(
|
||||
flex: 5,
|
||||
onPressed: (context) {
|
||||
// if (data.statusPengiriman == "Dalam Pengesahan Kurir") {
|
||||
// controller.terimaPengiriman(data.sId);
|
||||
// } else if (data.statusPengiriman == "Disahkan Kurir") {
|
||||
// controller.mengambilPaket(data.sId);
|
||||
// }
|
||||
},
|
||||
backgroundColor: const Color.fromARGB(255, 104, 164, 164),
|
||||
foregroundColor: Colors.white,
|
||||
icon: _icon,
|
||||
label: _text,
|
||||
),
|
||||
SlidableAction(
|
||||
flex: 5,
|
||||
onPressed: (context) {
|
||||
// controller.lihatFotoKiriman(context, data.fotoPengiriman!);
|
||||
},
|
||||
backgroundColor: const Color.fromARGB(255, 4, 103, 103),
|
||||
foregroundColor: Colors.white,
|
||||
icon: Icons.photo_rounded,
|
||||
label: 'Barang Kiriman',
|
||||
),
|
||||
],
|
||||
),
|
||||
// endActionPane: ActionPane(
|
||||
// motion: const DrawerMotion(),
|
||||
// extentRatio:
|
||||
// (data.statusPengiriman == "Dalam Pengesahan Kurir") ? 0.5 : 0.01,
|
||||
// children: [
|
||||
// if (data.statusPengiriman == 'Dalam Pengesahan Kurir')
|
||||
// SlidableAction(
|
||||
// onPressed: (context) {
|
||||
// // controller.batalkanPengiriman(data.sId);
|
||||
// },
|
||||
// backgroundColor: Colors.red,
|
||||
// foregroundColor: Colors.white,
|
||||
// icon: Icons.cancel_rounded,
|
||||
// label: "Batalkan Permintaan\nPengirim",
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
child: _MainChild(data: data, controller: controller),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _MainChild extends StatelessWidget {
|
||||
const _MainChild({
|
||||
Key? key,
|
||||
required this.data,
|
||||
required this.controller,
|
||||
}) : super(key: key);
|
||||
|
||||
final PengirimanModel data;
|
||||
final LogKirimanControllerKurir controller;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
width: double.infinity,
|
||||
height: 132,
|
||||
padding: const EdgeInsets.all(10),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: const Color.fromARGB(255, 165, 163, 163).withOpacity(0.5),
|
||||
blurRadius: 10,
|
||||
spreadRadius: 5,
|
||||
),
|
||||
],
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Container(
|
||||
width: 65,
|
||||
height: 65,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
shape: BoxShape.circle,
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: const Color.fromARGB(255, 165, 163, 163)
|
||||
.withOpacity(0.5),
|
||||
blurRadius: 10,
|
||||
spreadRadius: 5,
|
||||
),
|
||||
],
|
||||
image: const DecorationImage(
|
||||
image: AssetImage('assets/loading.gif'),
|
||||
fit: BoxFit.fitHeight,
|
||||
),
|
||||
),
|
||||
child: Center(
|
||||
child: CircleAvatar(
|
||||
radius: 30.0,
|
||||
// backgroundImage: NetworkImage(
|
||||
// data.pengirim!.photoUrl ?? 'https://via.placeholder.com/150',
|
||||
// scale: 0.5,
|
||||
// ),
|
||||
backgroundColor: Colors.transparent,
|
||||
child: ClipOval(
|
||||
child: Image.network(
|
||||
data.pengirim!.photoUrl ??
|
||||
'https://via.placeholder.com/150',
|
||||
fit: BoxFit.cover,
|
||||
width: 100,
|
||||
height: 100,
|
||||
errorBuilder: (context, error, stackTrace) {
|
||||
return const Center(
|
||||
child: Icon(
|
||||
Icons.error,
|
||||
size: 20,
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 4,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
FittedBox(
|
||||
child: Text(
|
||||
AllFunction.timeZoneAdd8(data.createdAt),
|
||||
style: const TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.bold,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
),
|
||||
FittedBox(
|
||||
child: Text(
|
||||
data.pengirim!.nama!,
|
||||
style: const TextStyle(
|
||||
fontSize: 15,
|
||||
color: Colors.grey,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
),
|
||||
// Coba(data:data,controller:controller)
|
||||
FittedBox(
|
||||
child: _FutureBuilderHargaJarak(
|
||||
controller: controller,
|
||||
data: data,
|
||||
),
|
||||
),
|
||||
FittedBox(
|
||||
child: Text(
|
||||
data.statusPengiriman!,
|
||||
style: const TextStyle(
|
||||
fontSize: 15,
|
||||
color: Colors.grey,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: _IconContainer(
|
||||
icon: const Icon(
|
||||
Icons.info_outlined,
|
||||
color: Colors.white,
|
||||
),
|
||||
color: const Color.fromARGB(255, 104, 164, 164),
|
||||
shadowColor: const Color.fromARGB(255, 199, 214, 234),
|
||||
onPressed: () {
|
||||
// controller.showMapDialog(context, data);
|
||||
Get.toNamed('/kurirIndex/progressPenghantaran',
|
||||
arguments: data.sId);
|
||||
// dev.log("ini ditekan");
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _FutureBuilderHargaJarak extends StatelessWidget {
|
||||
const _FutureBuilderHargaJarak(
|
||||
{Key? key, required this.controller, required this.data})
|
||||
: super(key: key);
|
||||
|
||||
final LogKirimanControllerKurir controller;
|
||||
final PengirimanModel data;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return FutureBuilder<dynamic>(
|
||||
future: controller.cekDistance(
|
||||
LatLng(double.parse(data.kordinatPengiriman!.lat!),
|
||||
double.parse(data.kordinatPengiriman!.lng!)),
|
||||
LatLng(double.parse(data.kordinatPermulaan!.lat!),
|
||||
double.parse(data.kordinatPermulaan!.lng!))),
|
||||
builder: (context, snapshot) {
|
||||
if (snapshot.hasData) {
|
||||
return Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
controller.cekHarga(snapshot.data, data.biaya!.biayaMinimal!,
|
||||
data.biaya!.biayaMaksimal!, data.biaya!.biayaPerKilo!),
|
||||
style: const TextStyle(
|
||||
fontSize: 15,
|
||||
color: Colors.grey,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
snapshot.data.toString() + " km",
|
||||
style: const TextStyle(
|
||||
fontSize: 15,
|
||||
color: Colors.grey,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
} else if (snapshot.hasError) {
|
||||
return const Text(
|
||||
"Error mengambil data",
|
||||
style: TextStyle(
|
||||
fontSize: 15,
|
||||
color: Colors.grey,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
);
|
||||
} else {
|
||||
return const Center(
|
||||
child: CircularProgressIndicator(
|
||||
valueColor: AlwaysStoppedAnimation<Color>(
|
||||
Color.fromARGB(
|
||||
255,
|
||||
4,
|
||||
103,
|
||||
103,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _IconContainer extends StatelessWidget {
|
||||
const _IconContainer({
|
||||
Key? key,
|
||||
required this.icon,
|
||||
required this.color,
|
||||
required this.shadowColor,
|
||||
required this.onPressed,
|
||||
}) : super(key: key);
|
||||
|
||||
final Icon icon;
|
||||
final Color color;
|
||||
final Color shadowColor;
|
||||
final VoidCallback onPressed;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(2),
|
||||
width: 50,
|
||||
height: 50,
|
||||
decoration: BoxDecoration(
|
||||
color: color,
|
||||
shape: BoxShape.circle,
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: shadowColor.withOpacity(0.5),
|
||||
blurRadius: 10,
|
||||
spreadRadius: 5,
|
||||
),
|
||||
],
|
||||
),
|
||||
child: IconButton(
|
||||
onPressed: onPressed,
|
||||
icon: icon,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -5,9 +5,9 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter_slidable/flutter_slidable.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:google_maps_flutter/google_maps_flutter.dart';
|
||||
import 'package:kurir/function/allFunction.dart';
|
||||
|
||||
import '../../../controller/after_login/kurir/pengirimanController.dart';
|
||||
import '../../../function/allFunction.dart';
|
||||
import '../../../models/pengirimimanModel.dart';
|
||||
import '../../../widgets/bounce_scroller.dart';
|
||||
import '../../../widgets/boxBackgroundDecoration.dart';
|
||||
@ -108,6 +108,10 @@ class _SlidableWidget extends StatelessWidget {
|
||||
_text = "Paket Diterima\nDari Pengirim";
|
||||
_icon = Icons.handshake_outlined;
|
||||
break;
|
||||
case "Menghantar Paket Pengiriman Ke Penerima":
|
||||
_text = "Paket Diterima\nOleh Penerima";
|
||||
_icon = Icons.person_pin_sharp;
|
||||
break;
|
||||
default:
|
||||
}
|
||||
|
||||
|
||||
@ -7,6 +7,8 @@ import 'package:kurir/controller/after_login/pengirim/infoPengirimanController.d
|
||||
import 'package:kurir/widgets/boxBackgroundDecoration.dart';
|
||||
import 'package:kurir/widgets/ourContainer.dart';
|
||||
|
||||
import '../../../widgets/appbar.dart';
|
||||
|
||||
class InfoPengirimanPage extends GetView<InfoPengirimanController> {
|
||||
const InfoPengirimanPage({Key? key}) : super(key: key);
|
||||
|
||||
@ -14,35 +16,56 @@ class InfoPengirimanPage extends GetView<InfoPengirimanController> {
|
||||
Widget build(BuildContext context) {
|
||||
// String _harga_minimal = AllFunction.thousandsSeperator(
|
||||
// controller.pengirimanModel.biaya!.biayaMinimal!);
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text('Info Pengiriman'),
|
||||
actions: [
|
||||
// create back button
|
||||
IconButton(
|
||||
icon: const Icon(Icons.arrow_back),
|
||||
onPressed: () {
|
||||
Get.offAllNamed(
|
||||
'/pengirimIndex',
|
||||
arguments: {
|
||||
'tap': 1,
|
||||
},
|
||||
);
|
||||
},
|
||||
return WillPopScope(
|
||||
onWillPop: () async {
|
||||
Get.offAllNamed(
|
||||
'/pengirimIndex',
|
||||
arguments: {
|
||||
'tap': 1,
|
||||
},
|
||||
);
|
||||
return false;
|
||||
},
|
||||
child: Scaffold(
|
||||
appBar: PreferredSize(
|
||||
preferredSize:
|
||||
Size.fromHeight(MediaQuery.of(context).size.height * 0.08),
|
||||
child: AppBarWidget(
|
||||
header: "Info Pengiriman",
|
||||
autoLeading: true,
|
||||
actions: [
|
||||
// create back button
|
||||
if (controller.pengirimanModel.statusPengiriman ==
|
||||
'Mengambil Paket Pengiriman Dari Pengirim')
|
||||
Row(
|
||||
children: [
|
||||
IconButton(
|
||||
onPressed: () {},
|
||||
icon: const Icon(
|
||||
Icons.qr_code_2_outlined,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
if (controller.pengirimanModel.statusPengiriman ==
|
||||
'Mengambil Paket Pengiriman Dari Pengirim')
|
||||
Row(
|
||||
children: [
|
||||
IconButton(
|
||||
onPressed: () {},
|
||||
icon: const Icon(
|
||||
Icons.motorcycle_outlined,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
body: WillPopScope(
|
||||
onWillPop: () async {
|
||||
Get.offAllNamed(
|
||||
'/pengirimIndex',
|
||||
arguments: {
|
||||
'tap': 1,
|
||||
},
|
||||
);
|
||||
return false;
|
||||
},
|
||||
child: BoxBackgroundDecoration(
|
||||
),
|
||||
body: BoxBackgroundDecoration(
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
@ -73,196 +96,80 @@ class InfoPengirimanPage extends GetView<InfoPengirimanController> {
|
||||
),
|
||||
],
|
||||
),
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(100),
|
||||
image: const DecorationImage(
|
||||
image: AssetImage(
|
||||
'assets/loading.gif',
|
||||
),
|
||||
fit: BoxFit.fill,
|
||||
),
|
||||
),
|
||||
child: (controller.pengirimanModel.fotoPengiriman !=
|
||||
null)
|
||||
? Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(100),
|
||||
image: DecorationImage(
|
||||
image: NetworkImage(
|
||||
controller
|
||||
.pengirimanModel.fotoPengiriman!,
|
||||
),
|
||||
fit: BoxFit.fill,
|
||||
),
|
||||
),
|
||||
)
|
||||
: const SizedBox(),
|
||||
child: _FotoWidget(controller: controller),
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 15,
|
||||
),
|
||||
_ThisTextFormField(
|
||||
text: (controller.pengirimanModel.statusPengiriman ==
|
||||
'Mengambil Paket Pengiriman Dari Pengirim')
|
||||
? 'Kurir Dalam Perjalanan Mengmabil Paket'
|
||||
: controller.pengirimanModel.statusPengiriman!,
|
||||
maxLines: 2,
|
||||
label: "Status Pengiriman",
|
||||
),
|
||||
const SizedBox(
|
||||
height: 15,
|
||||
),
|
||||
_ThisTextFormField(
|
||||
text: controller.pengirimanModel.namaPenerima!,
|
||||
label: 'Nama Penerima'),
|
||||
const SizedBox(
|
||||
height: 15,
|
||||
),
|
||||
_ThisTextFormField(
|
||||
text: controller.pengirimanModel.noTelponPenerima!,
|
||||
label: 'No Telpon Penerima'),
|
||||
const SizedBox(
|
||||
height: 15,
|
||||
),
|
||||
_ThisTextFormField(
|
||||
text: controller.pengirimanModel.alamatPenerima!,
|
||||
label: 'Alamat Penerima',
|
||||
maxLines: 4),
|
||||
const SizedBox(
|
||||
height: 15,
|
||||
),
|
||||
_ThisTextFormField(
|
||||
text: controller.pengirimanModel.kurir!.nama!,
|
||||
label: 'Nama Kurir',
|
||||
suffix: GestureDetector(
|
||||
onTap: () {
|
||||
// dev.log("message");
|
||||
if (controller.loadingMaps.value)
|
||||
controller.show_kurir_dialog();
|
||||
},
|
||||
child: const Icon(
|
||||
Icons.info_outline_rounded,
|
||||
color: Color.fromARGB(255, 104, 164, 164),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 15,
|
||||
),
|
||||
TextFormField(
|
||||
readOnly: true,
|
||||
initialValue:
|
||||
controller.pengirimanModel.statusPengiriman,
|
||||
decoration: InputDecoration(
|
||||
labelStyle: const TextStyle(
|
||||
color: Colors.blue,
|
||||
),
|
||||
labelText: 'Status Pengiriman',
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
borderSide: const BorderSide(
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 15,
|
||||
),
|
||||
TextFormField(
|
||||
readOnly: true,
|
||||
initialValue: controller.pengirimanModel.namaPenerima,
|
||||
decoration: InputDecoration(
|
||||
labelStyle: const TextStyle(
|
||||
color: Colors.blue,
|
||||
),
|
||||
labelText: 'Nama Penerima',
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
borderSide: const BorderSide(
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 15,
|
||||
),
|
||||
TextFormField(
|
||||
readOnly: true,
|
||||
initialValue:
|
||||
controller.pengirimanModel.noTelponPenerima,
|
||||
// maxLength: 13,
|
||||
decoration: InputDecoration(
|
||||
labelStyle: const TextStyle(
|
||||
color: Colors.blue,
|
||||
),
|
||||
labelText: 'No Telpon Penerima',
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
borderSide: const BorderSide(
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 15,
|
||||
),
|
||||
TextFormField(
|
||||
readOnly: true,
|
||||
initialValue: controller.pengirimanModel.alamatPenerima,
|
||||
keyboardType: TextInputType.multiline,
|
||||
textInputAction: TextInputAction.newline,
|
||||
// minLines: 1,
|
||||
maxLines: 4,
|
||||
decoration: InputDecoration(
|
||||
labelText: 'Alamat Penerima',
|
||||
labelStyle: const TextStyle(
|
||||
color: Colors.blue,
|
||||
),
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
borderSide: const BorderSide(
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 15,
|
||||
),
|
||||
TextFormField(
|
||||
readOnly: true,
|
||||
initialValue: controller.pengirimanModel.kurir!.nama,
|
||||
// maxLength: 13,
|
||||
decoration: InputDecoration(
|
||||
labelStyle: const TextStyle(
|
||||
color: Colors.blue,
|
||||
),
|
||||
suffix: GestureDetector(
|
||||
onTap: () {
|
||||
// dev.log("message");
|
||||
if (controller.loadingMaps.value)
|
||||
controller.show_kurir_dialog();
|
||||
},
|
||||
child: const Icon(
|
||||
Icons.info_outline_rounded,
|
||||
color: Colors.blue,
|
||||
),
|
||||
),
|
||||
labelText: 'Nama Kurir',
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
borderSide: const BorderSide(
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 15,
|
||||
),
|
||||
TextFormField(
|
||||
readOnly: true,
|
||||
_ThisTextFormField(
|
||||
controller: controller.distance_travel_controller,
|
||||
decoration: InputDecoration(
|
||||
labelStyle: const TextStyle(
|
||||
color: Colors.blue,
|
||||
),
|
||||
labelText: 'Jarak Pengiriman',
|
||||
suffixIcon: GestureDetector(
|
||||
onTap: () {
|
||||
if (controller.loadingMaps.value)
|
||||
controller.show_maps_dialog();
|
||||
},
|
||||
child: const Icon(
|
||||
Icons.info_outline_rounded,
|
||||
color: Colors.blue,
|
||||
),
|
||||
),
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
borderSide: const BorderSide(
|
||||
color: Colors.grey,
|
||||
),
|
||||
label: 'Jarak Pengiriman',
|
||||
suffix: GestureDetector(
|
||||
onTap: () {
|
||||
if (controller.loadingMaps.value)
|
||||
controller.show_maps_dialog();
|
||||
},
|
||||
child: const Icon(
|
||||
Icons.info_outline_rounded,
|
||||
color: Color.fromARGB(255, 104, 164, 164),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 15,
|
||||
),
|
||||
TextFormField(
|
||||
readOnly: true,
|
||||
controller: controller.price_controller,
|
||||
decoration: InputDecoration(
|
||||
labelStyle: const TextStyle(
|
||||
color: Colors.blue,
|
||||
),
|
||||
labelText: 'Harga Pengiriman',
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
borderSide: const BorderSide(
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
_ThisTextFormField(
|
||||
label: 'Harga Pengiriman',
|
||||
controller: controller.price_controller),
|
||||
const SizedBox(
|
||||
height: 15,
|
||||
),
|
||||
@ -272,12 +179,18 @@ class InfoPengirimanPage extends GetView<InfoPengirimanController> {
|
||||
child: ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(
|
||||
primary: Colors.red,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
),
|
||||
child: const Text("Batalkan Pengiriman"),
|
||||
onPressed: () {},
|
||||
),
|
||||
)
|
||||
: const SizedBox(),
|
||||
: (controller.pengirimanModel.statusPengiriman ==
|
||||
"Mengambil Paket Pengiriman Dari Pengirim")
|
||||
? const _ButtonKurirDalamPerjalan()
|
||||
: const SizedBox(),
|
||||
],
|
||||
),
|
||||
),
|
||||
@ -292,3 +205,148 @@ class InfoPengirimanPage extends GetView<InfoPengirimanController> {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _ButtonKurirDalamPerjalan extends StatelessWidget {
|
||||
const _ButtonKurirDalamPerjalan({
|
||||
Key? key,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Center(
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(
|
||||
primary: const Color.fromARGB(255, 2, 72, 72),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
),
|
||||
child: const Text("Scan QR Code"),
|
||||
onPressed: () {},
|
||||
),
|
||||
ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(
|
||||
primary: const Color.fromARGB(255, 2, 72, 72),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
),
|
||||
child: const Text("Lokasi Kurir"),
|
||||
onPressed: () {},
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _FotoWidget extends StatelessWidget {
|
||||
const _FotoWidget({
|
||||
Key? key,
|
||||
required this.controller,
|
||||
}) : super(key: key);
|
||||
|
||||
final InfoPengirimanController controller;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(100),
|
||||
image: const DecorationImage(
|
||||
image: AssetImage(
|
||||
'assets/loading.gif',
|
||||
),
|
||||
fit: BoxFit.fill,
|
||||
),
|
||||
),
|
||||
child: (controller.pengirimanModel.fotoPengiriman != null)
|
||||
? Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(100),
|
||||
image: DecorationImage(
|
||||
image: NetworkImage(
|
||||
controller.pengirimanModel.fotoPengiriman!,
|
||||
),
|
||||
fit: BoxFit.fill,
|
||||
onError: (object, stacktrace) {
|
||||
// print(e);
|
||||
},
|
||||
),
|
||||
),
|
||||
)
|
||||
: const SizedBox(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _ThisTextFormField extends StatelessWidget {
|
||||
const _ThisTextFormField({
|
||||
Key? key,
|
||||
this.text,
|
||||
this.maxLines = 1,
|
||||
required this.label,
|
||||
this.suffix,
|
||||
this.controller,
|
||||
}) : super(key: key);
|
||||
|
||||
final String? text;
|
||||
final String label;
|
||||
final int maxLines;
|
||||
final Widget? suffix;
|
||||
final TextEditingController? controller;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return TextFormField(
|
||||
controller: controller,
|
||||
maxLines: maxLines,
|
||||
readOnly: true,
|
||||
initialValue: text,
|
||||
decoration: InputDecoration(
|
||||
labelStyle: const TextStyle(
|
||||
color: Color.fromARGB(255, 4, 103, 103),
|
||||
),
|
||||
labelText: label,
|
||||
suffix: suffix,
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(30),
|
||||
borderSide: const BorderSide(
|
||||
color: Color.fromARGB(255, 2, 72, 72),
|
||||
),
|
||||
),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(30),
|
||||
borderSide: const BorderSide(
|
||||
color: Color.fromARGB(255, 2, 72, 72),
|
||||
width: 1,
|
||||
),
|
||||
),
|
||||
disabledBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(30),
|
||||
borderSide: const BorderSide(
|
||||
color: Color.fromARGB(255, 104, 164, 164),
|
||||
width: 1,
|
||||
),
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(30),
|
||||
borderSide: const BorderSide(
|
||||
color: Color.fromARGB(255, 2, 72, 72),
|
||||
width: 1,
|
||||
),
|
||||
),
|
||||
errorBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(30),
|
||||
borderSide: const BorderSide(
|
||||
color: Colors.red,
|
||||
width: 1,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:logger/logger.dart';
|
||||
|
||||
import '../../../controller/after_login/pengirim/listKurirController.dart';
|
||||
import '../../../models/usersModel.dart';
|
||||
@ -136,12 +137,13 @@ class _MainDetail extends StatelessWidget {
|
||||
}
|
||||
|
||||
class _KurirDetailBox extends StatelessWidget {
|
||||
const _KurirDetailBox({
|
||||
_KurirDetailBox({
|
||||
Key? key,
|
||||
required this.data,
|
||||
}) : super(key: key);
|
||||
|
||||
final KurirModel data;
|
||||
final log = Logger();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -170,25 +172,38 @@ class _KurirDetailBox extends StatelessWidget {
|
||||
flex: 2,
|
||||
child: Center(
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(2),
|
||||
alignment: Alignment.center,
|
||||
width: 70,
|
||||
height: 70,
|
||||
decoration: const BoxDecoration(
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: const Color.fromARGB(255, 165, 163, 163)
|
||||
.withOpacity(0.5),
|
||||
blurRadius: 10,
|
||||
spreadRadius: 5,
|
||||
),
|
||||
],
|
||||
image: const DecorationImage(
|
||||
image: AssetImage(
|
||||
'assets/loading.gif',
|
||||
),
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
child: CircleAvatar(
|
||||
radius: 50.0,
|
||||
// backgroundImage: NetworkImage(
|
||||
// pengirimanModel.kurir!.photo_url ??
|
||||
// 'https://via.placeholder.com/150'),
|
||||
backgroundColor: Colors.transparent,
|
||||
child: ClipOval(
|
||||
child: Image.network(
|
||||
data.photo_url ?? 'https://via.placeholder.com/150',
|
||||
child: Container(
|
||||
alignment: Alignment.center,
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
image: DecorationImage(
|
||||
image: NetworkImage(
|
||||
data.photo_url ?? 'https://via.placeholder.com/150',
|
||||
),
|
||||
fit: BoxFit.cover,
|
||||
width: 100,
|
||||
height: 100,
|
||||
errorBuilder: (context, url, error) {
|
||||
return const Icon(Icons.error);
|
||||
onError: (object, stack) {
|
||||
log.e(object, stack);
|
||||
},
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user