added profil and kurir page in pengirim, added pengiriman page at kurir, sort the api, design the ui back
This commit is contained in:
@ -2,12 +2,12 @@
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:kurir/controller/after_login/kurir/pengaturanController.dart';
|
||||
import 'package:kurir/widgets/focusToTextFormField.dart';
|
||||
import 'package:kurir/widgets/ourContainer.dart';
|
||||
import 'package:kurir/widgets/thousandSeparator.dart';
|
||||
|
||||
import '../../../controller/after_login/kurir/pengaturanController.dart';
|
||||
import '../../../widgets/boxBackgroundDecoration.dart';
|
||||
import '../../../widgets/focusToTextFormField.dart';
|
||||
import '../../../widgets/ourContainer.dart';
|
||||
import '../../../widgets/thousandSeparator.dart';
|
||||
|
||||
class PengaturanKurirPage extends GetView<PengaturanKurirController> {
|
||||
const PengaturanKurirPage({Key? key}) : super(key: key);
|
||||
@ -45,29 +45,12 @@ class PengaturanKurirPage extends GetView<PengaturanKurirController> {
|
||||
),
|
||||
EnsureVisibleWhenFocused(
|
||||
focusNode: controller.minimalBiayaPengirimanFocusNode,
|
||||
child: TextFormField(
|
||||
// initialValue: 700.toString(),
|
||||
child: _PengaturanTextFormField(
|
||||
controller:
|
||||
controller.minimalBiayaPengirimanController,
|
||||
hintText: 'Minimal Biaya Pengiriman',
|
||||
labelText: 'Minimal Biaya Pengiriman',
|
||||
focusNode: controller.minimalBiayaPengirimanFocusNode,
|
||||
keyboardType: TextInputType.number,
|
||||
maxLength: 6,
|
||||
inputFormatters: [ThousandsSeparatorInputFormatter()],
|
||||
decoration: InputDecoration(
|
||||
// suffix: ,
|
||||
// suffixText: ' / kg',
|
||||
// put suffixText before prefixText
|
||||
prefixText: 'Rp . ',
|
||||
|
||||
hintText: 'Minimal Biaya Pengiriman',
|
||||
labelText: 'Minimal Biaya Pengiriman',
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
borderSide: const BorderSide(
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
),
|
||||
validator: (value) {
|
||||
if (value!.isEmpty) {
|
||||
return 'Minimal Biaya Pengiriman tidak boleh kosong';
|
||||
@ -88,33 +71,24 @@ class PengaturanKurirPage extends GetView<PengaturanKurirController> {
|
||||
),
|
||||
EnsureVisibleWhenFocused(
|
||||
focusNode: controller.maksimalBiayaPengirimanFocusNode,
|
||||
child: TextFormField(
|
||||
child: _PengaturanTextFormField(
|
||||
controller:
|
||||
controller.maksimalBiayaPengirimanController,
|
||||
hintText: 'Maksimal Biaya Pengiriman',
|
||||
labelText: 'Maksimal Biaya Pengiriman',
|
||||
focusNode:
|
||||
controller.maksimalBiayaPengirimanFocusNode,
|
||||
keyboardType: TextInputType.number,
|
||||
maxLength: 6,
|
||||
inputFormatters: [ThousandsSeparatorInputFormatter()],
|
||||
decoration: InputDecoration(
|
||||
// suffix: ,
|
||||
// suffixText: ' / kg',
|
||||
// put suffixText before prefixText
|
||||
prefixText: 'Rp . ',
|
||||
|
||||
hintText: 'Maksimal Biaya Pengiriman',
|
||||
labelText: 'Maksimal Biaya Pengiriman',
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
borderSide: const BorderSide(
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
),
|
||||
validator: (value) {
|
||||
if (value!.isEmpty) {
|
||||
return 'Maksimal Biaya Pengiriman tidak boleh kosong';
|
||||
}
|
||||
|
||||
if (controller.removeComma(controller
|
||||
.maksimalBiayaPengirimanController.text) <
|
||||
controller.removeComma(value)) {
|
||||
return 'Maksimal Biaya Pengiriman tidak boleh lebih besar dari Maksimal Biaya Pengiriman';
|
||||
}
|
||||
|
||||
return null;
|
||||
},
|
||||
),
|
||||
@ -124,31 +98,17 @@ class PengaturanKurirPage extends GetView<PengaturanKurirController> {
|
||||
),
|
||||
EnsureVisibleWhenFocused(
|
||||
focusNode: controller.biayaPerKiloFocusNode,
|
||||
child: TextFormField(
|
||||
child: _PengaturanTextFormField(
|
||||
controller: controller.biayaPerKiloController,
|
||||
hintText: 'Biaya Per Kilometer',
|
||||
labelText: 'Biaya Per Kilometer',
|
||||
focusNode: controller.biayaPerKiloFocusNode,
|
||||
keyboardType: TextInputType.number,
|
||||
maxLength: 6,
|
||||
inputFormatters: [ThousandsSeparatorInputFormatter()],
|
||||
decoration: InputDecoration(
|
||||
// suffix: ,
|
||||
suffixText: ' / km',
|
||||
// put suffixText before prefixText
|
||||
prefixText: 'Rp . ',
|
||||
|
||||
hintText: 'Biaya Per Kilometer',
|
||||
labelText: 'Biaya Per Kilometer',
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
borderSide: const BorderSide(
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
),
|
||||
suffixText: ' / km',
|
||||
validator: (value) {
|
||||
if (value!.isEmpty) {
|
||||
return 'Biaya Per Kilometer tidak boleh kosong';
|
||||
}
|
||||
|
||||
return null;
|
||||
},
|
||||
),
|
||||
@ -157,6 +117,12 @@ class PengaturanKurirPage extends GetView<PengaturanKurirController> {
|
||||
height: 15,
|
||||
),
|
||||
ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(
|
||||
primary: const Color.fromARGB(255, 2, 72, 72),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
),
|
||||
onPressed: () {
|
||||
// log()
|
||||
if (controller.formKey.currentState!.validate()) {
|
||||
@ -175,8 +141,8 @@ class PengaturanKurirPage extends GetView<PengaturanKurirController> {
|
||||
ElevatedButton(
|
||||
child: const Text('Tidak'),
|
||||
style: ElevatedButton.styleFrom(
|
||||
primary:
|
||||
Colors.red[400], //background color
|
||||
primary: const Color.fromARGB(255, 104,
|
||||
164, 164), //background color
|
||||
// onPrimary: Colors.black, //ripple color
|
||||
),
|
||||
onPressed: () {
|
||||
@ -185,6 +151,11 @@ class PengaturanKurirPage extends GetView<PengaturanKurirController> {
|
||||
),
|
||||
ElevatedButton(
|
||||
child: const Text('Ya'),
|
||||
style: ElevatedButton.styleFrom(
|
||||
primary: const Color.fromARGB(
|
||||
255, 2, 72, 72), //background color
|
||||
// onPrimary: Colors.black, //ripple color
|
||||
),
|
||||
onPressed: () {
|
||||
controller.simpan();
|
||||
Navigator.of(context).pop();
|
||||
@ -231,3 +202,78 @@ class PengaturanKurirPage extends GetView<PengaturanKurirController> {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _PengaturanTextFormField extends StatelessWidget {
|
||||
const _PengaturanTextFormField({
|
||||
Key? key,
|
||||
this.controller,
|
||||
this.focusNode,
|
||||
this.hintText,
|
||||
this.labelText,
|
||||
this.validator,
|
||||
this.suffixText,
|
||||
}) : super(key: key);
|
||||
|
||||
final TextEditingController? controller;
|
||||
final FocusNode? focusNode;
|
||||
final String? hintText;
|
||||
final String? labelText;
|
||||
final FormFieldValidator<String>? validator;
|
||||
final String? suffixText;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return TextFormField(
|
||||
// initialValue: 700.toString(),
|
||||
controller: controller,
|
||||
focusNode: focusNode,
|
||||
keyboardType: TextInputType.number,
|
||||
maxLength: 6,
|
||||
inputFormatters: [ThousandsSeparatorInputFormatter()],
|
||||
decoration: InputDecoration(
|
||||
// suffix: ,
|
||||
// suffixText: ' / kg',
|
||||
// put suffixText before prefixText
|
||||
prefixText: 'Rp . ',
|
||||
suffixText: suffixText,
|
||||
hintText: hintText,
|
||||
labelText: labelText,
|
||||
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,
|
||||
),
|
||||
),
|
||||
),
|
||||
validator: validator,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,26 +1,418 @@
|
||||
// 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/pengirimanController.dart';
|
||||
import '../../../models/pengirimimanModel.dart';
|
||||
import '../../../widgets/bounce_scroller.dart';
|
||||
import '../../../widgets/boxBackgroundDecoration.dart';
|
||||
import '../../../widgets/load_data.dart';
|
||||
|
||||
class PengirimanKurirPage extends StatelessWidget {
|
||||
class PengirimanKurirPage extends GetView<PengirimanKurirController> {
|
||||
const PengirimanKurirPage({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return const Scaffold(
|
||||
return Scaffold(
|
||||
// ignore: unnecessary_const
|
||||
body: const BoxBackgroundDecoration(
|
||||
child: Center(
|
||||
child: Text(
|
||||
'Pengiriman',
|
||||
style: TextStyle(
|
||||
fontSize: 30,
|
||||
color: Colors.white,
|
||||
),
|
||||
)),
|
||||
body: BoxBackgroundDecoration(
|
||||
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 PengirimanKurirController 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)
|
||||
Center(
|
||||
child: const 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 PengirimanKurirController controller;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
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) {
|
||||
// Get.offAndToNamed(
|
||||
// '/pengirimIndex/infoPengiriman',
|
||||
// arguments: {
|
||||
// 'pengiriman_model': _pengirimanModel,
|
||||
// },
|
||||
// );
|
||||
},
|
||||
backgroundColor: const Color.fromARGB(255, 104, 164, 164),
|
||||
foregroundColor: Colors.white,
|
||||
icon: Icons.check_box,
|
||||
label: 'Terima Pengiriman',
|
||||
),
|
||||
SlidableAction(
|
||||
flex: 5,
|
||||
onPressed: (context) {
|
||||
controller.lihat_foto_kiriman(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: 0.5,
|
||||
children: [
|
||||
SlidableAction(
|
||||
onPressed: (context) {
|
||||
// _lihat_rute_pengiriman(
|
||||
// context, _kordinat_pengiriman, _kordinat_permulaan);
|
||||
},
|
||||
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 PengirimanKurirController controller;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
width: double.infinity,
|
||||
height: 115,
|
||||
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: CircleAvatar(
|
||||
radius: 30.0,
|
||||
backgroundImage: NetworkImage(
|
||||
data.pengirim!.photoUrl ?? 'https://via.placeholder.com/150',
|
||||
scale: 0.5,
|
||||
),
|
||||
backgroundColor: Colors.transparent,
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 4,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const SizedBox(height: 10),
|
||||
Text(
|
||||
controller.timeZoneAdd8(data.createdAt),
|
||||
style: const TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.bold,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
data.pengirim!.nama!,
|
||||
style: const TextStyle(
|
||||
fontSize: 15,
|
||||
color: Colors.grey,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
// Coba(data:data,controller:controller)
|
||||
_FutureBuilderHargaJarak(
|
||||
controller: controller,
|
||||
data: data,
|
||||
),
|
||||
Text(
|
||||
data.statusPengiriman!,
|
||||
style: const TextStyle(
|
||||
fontSize: 15,
|
||||
color: Colors.grey,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(2),
|
||||
width: 50,
|
||||
height: 50,
|
||||
decoration: BoxDecoration(
|
||||
color: Color.fromARGB(255, 2, 72, 72),
|
||||
shape: BoxShape.circle,
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: const Color.fromARGB(255, 104, 164, 164)
|
||||
.withOpacity(0.5),
|
||||
blurRadius: 10,
|
||||
spreadRadius: 5,
|
||||
),
|
||||
],
|
||||
),
|
||||
child: IconButton(
|
||||
onPressed: () {
|
||||
controller.showMapDialog(context, data);
|
||||
},
|
||||
icon: Icon(
|
||||
Icons.turn_sharp_right_outlined,
|
||||
color: Color.fromARGB(255, 199, 214, 234),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class TopSeachInput extends StatelessWidget {
|
||||
const TopSeachInput({
|
||||
Key? key,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Positioned(
|
||||
top: MediaQuery.of(context).size.height * 0.05,
|
||||
right: MediaQuery.of(context).size.width * 0.05,
|
||||
left: MediaQuery.of(context).size.width * 0.05,
|
||||
child: SizedBox(
|
||||
width: double.infinity,
|
||||
height: 40,
|
||||
child: TextFormField(
|
||||
decoration: InputDecoration(
|
||||
hintText: 'Cari Pengiriman',
|
||||
hintStyle: const TextStyle(
|
||||
color: Colors.white,
|
||||
),
|
||||
prefixIcon: const Icon(
|
||||
Icons.search,
|
||||
color: Colors.white,
|
||||
),
|
||||
suffixIcon: const Icon(
|
||||
Icons.filter_list,
|
||||
color: Colors.white,
|
||||
),
|
||||
filled: true,
|
||||
fillColor: Colors.transparent,
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(30),
|
||||
borderSide: const BorderSide(
|
||||
color: Colors.white,
|
||||
width: 1,
|
||||
),
|
||||
),
|
||||
disabledBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(30),
|
||||
borderSide: const BorderSide(
|
||||
color: Colors.white,
|
||||
width: 1,
|
||||
),
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(30),
|
||||
borderSide: const BorderSide(
|
||||
color: Colors.white,
|
||||
width: 1,
|
||||
),
|
||||
),
|
||||
contentPadding: const EdgeInsets.symmetric(
|
||||
horizontal: 10,
|
||||
vertical: 10,
|
||||
),
|
||||
),
|
||||
style: const TextStyle(
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _FutureBuilderHargaJarak extends StatelessWidget {
|
||||
const _FutureBuilderHargaJarak(
|
||||
{Key? key, required this.controller, required this.data})
|
||||
: super(key: key);
|
||||
|
||||
final PengirimanKurirController 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 Text(
|
||||
"Error mengambil data",
|
||||
style: const TextStyle(
|
||||
fontSize: 15,
|
||||
color: Colors.grey,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
);
|
||||
} else {
|
||||
return Center(
|
||||
child: CircularProgressIndicator(
|
||||
valueColor: AlwaysStoppedAnimation<Color>(
|
||||
Color.fromARGB(
|
||||
255,
|
||||
4,
|
||||
103,
|
||||
103,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,7 +2,10 @@
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:kurir/controller/after_login/kurir/profileController.dart';
|
||||
|
||||
import '../../../controller/after_login/kurir/profileController.dart';
|
||||
import '../../../widgets/appbar.dart';
|
||||
import '../../../widgets/boxBackgroundDecoration.dart';
|
||||
|
||||
class ProfileKurirPage extends GetView<KurirProfileController> {
|
||||
const ProfileKurirPage({Key? key}) : super(key: key);
|
||||
@ -10,41 +13,54 @@ class ProfileKurirPage extends GetView<KurirProfileController> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text('Profile'),
|
||||
actions: [
|
||||
IconButton(
|
||||
icon: const Icon(Icons.logout_outlined),
|
||||
onPressed: () {
|
||||
// log("ini untuk logout");
|
||||
// create get alert dialog
|
||||
Get.dialog(AlertDialog(
|
||||
title: const Text('Logout'),
|
||||
content: const Text('Anda yakin ingin logout?'),
|
||||
actions: [
|
||||
ElevatedButton(
|
||||
child: const Text('Yes'),
|
||||
onPressed: () {
|
||||
// log("ini untuk logout");
|
||||
Get.back();
|
||||
controller.logout();
|
||||
},
|
||||
appBar: PreferredSize(
|
||||
preferredSize:
|
||||
Size.fromHeight(MediaQuery.of(context).size.height * 0.08),
|
||||
child: AppBarWidget(
|
||||
header: "Halaman Profil",
|
||||
autoLeading: false,
|
||||
actions: [
|
||||
IconButton(
|
||||
icon: const Icon(Icons.logout_outlined),
|
||||
onPressed: () {
|
||||
// log("ini untuk logout");
|
||||
// create get alert dialog
|
||||
Get.dialog(
|
||||
AlertDialog(
|
||||
title: const Text('Logout'),
|
||||
content: const Text('Anda yakin ingin logout?'),
|
||||
actions: [
|
||||
ElevatedButton(
|
||||
child: const Text('Yes'),
|
||||
style: ElevatedButton.styleFrom(
|
||||
primary: Color.fromARGB(
|
||||
255, 104, 164, 164), //background color
|
||||
// onPrimary: Colors.black, //ripple color
|
||||
),
|
||||
onPressed: () {
|
||||
// log("ini untuk logout");
|
||||
Get.back();
|
||||
controller.logout();
|
||||
},
|
||||
),
|
||||
ElevatedButton(
|
||||
child: const Text('No'),
|
||||
style: ElevatedButton.styleFrom(
|
||||
primary:
|
||||
Color.fromARGB(255, 2, 72, 72), //background color
|
||||
// onPrimary: Colors.black, //ripple color
|
||||
),
|
||||
onPressed: () {
|
||||
Get.back();
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
ElevatedButton(
|
||||
child: const Text('No'),
|
||||
style: ElevatedButton.styleFrom(
|
||||
primary: Colors.red[400], //background color
|
||||
// onPrimary: Colors.black, //ripple color
|
||||
),
|
||||
onPressed: () {
|
||||
Get.back();
|
||||
},
|
||||
),
|
||||
],
|
||||
));
|
||||
},
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
body: WillPopScope(
|
||||
onWillPop: () async {
|
||||
@ -53,8 +69,10 @@ class ProfileKurirPage extends GetView<KurirProfileController> {
|
||||
);
|
||||
return false;
|
||||
},
|
||||
child: const Center(
|
||||
child: Text('Profile'),
|
||||
child: BoxBackgroundDecoration(
|
||||
child: const Center(
|
||||
child: Text('Profile'),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
290
lib/pages/after_login/pengirim/infoPengirimanPage.dart
Normal file
290
lib/pages/after_login/pengirim/infoPengirimanPage.dart
Normal file
@ -0,0 +1,290 @@
|
||||
// ignore_for_file: file_names, curly_braces_in_flow_control_structures
|
||||
// ignore: unused_import
|
||||
import 'dart:developer' as dev;
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:kurir/controller/after_login/pengirim/infoPengirimanController.dart';
|
||||
import 'package:kurir/widgets/boxBackgroundDecoration.dart';
|
||||
import 'package:kurir/widgets/ourContainer.dart';
|
||||
|
||||
class InfoPengirimanPage extends GetView<InfoPengirimanController> {
|
||||
const InfoPengirimanPage({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
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,
|
||||
},
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
body: WillPopScope(
|
||||
onWillPop: () async {
|
||||
Get.offAllNamed(
|
||||
'/pengirimIndex',
|
||||
arguments: {
|
||||
'tap': 1,
|
||||
},
|
||||
);
|
||||
return false;
|
||||
},
|
||||
child: BoxBackgroundDecoration(
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
const SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
OurContainer(
|
||||
child: Column(
|
||||
children: [
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
controller.show_foto_pengiriman();
|
||||
},
|
||||
child: Container(
|
||||
width: 100,
|
||||
height: 100,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.grey,
|
||||
borderRadius: BorderRadius.circular(100),
|
||||
boxShadow: const [
|
||||
BoxShadow(
|
||||
color: Colors.grey,
|
||||
blurRadius: 5,
|
||||
spreadRadius: 1,
|
||||
),
|
||||
],
|
||||
),
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(100),
|
||||
image: const DecorationImage(
|
||||
image: AssetImage(
|
||||
'assets/loading.gif',
|
||||
),
|
||||
fit: BoxFit.fill,
|
||||
),
|
||||
),
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(100),
|
||||
image: DecorationImage(
|
||||
image: NetworkImage(
|
||||
controller.pengirimanModel.fotoPengiriman!,
|
||||
),
|
||||
fit: BoxFit.fill,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
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,
|
||||
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,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
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,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 15,
|
||||
),
|
||||
(controller.pengirimanModel.statusPengiriman ==
|
||||
"Dalam Pengesahan Kurir")
|
||||
? Center(
|
||||
child: ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(
|
||||
primary: Colors.red,
|
||||
),
|
||||
child: const Text("Batalkan Pengiriman"),
|
||||
onPressed: () {},
|
||||
),
|
||||
)
|
||||
: const SizedBox(),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -35,11 +35,11 @@ class KirimBarangPage extends GetView<KirimBarangController> {
|
||||
width: 80,
|
||||
height: 80,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.grey,
|
||||
color: const Color.fromARGB(255, 199, 214, 234),
|
||||
borderRadius: BorderRadius.circular(100),
|
||||
boxShadow: const [
|
||||
BoxShadow(
|
||||
color: Colors.grey,
|
||||
color: Color.fromARGB(255, 104, 164, 164),
|
||||
blurRadius: 5,
|
||||
spreadRadius: 1,
|
||||
),
|
||||
@ -76,7 +76,8 @@ class KirimBarangPage extends GetView<KirimBarangController> {
|
||||
),
|
||||
)
|
||||
: const Icon(Icons.add,
|
||||
color: Colors.white, size: 22),
|
||||
color: Color.fromARGB(255, 2, 72, 72),
|
||||
size: 22),
|
||||
Positioned(
|
||||
bottom: 0,
|
||||
right: 0,
|
||||
@ -87,7 +88,8 @@ class KirimBarangPage extends GetView<KirimBarangController> {
|
||||
width: 40,
|
||||
height: 40,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.blue,
|
||||
color: const Color.fromARGB(
|
||||
255, 4, 103, 103),
|
||||
borderRadius:
|
||||
BorderRadius.circular(100),
|
||||
),
|
||||
@ -286,6 +288,12 @@ class KirimBarangPage extends GetView<KirimBarangController> {
|
||||
// log("sini pin lokasi");
|
||||
controller.pin_lokasi(context);
|
||||
},
|
||||
style: ElevatedButton.styleFrom(
|
||||
primary: const Color.fromARGB(255, 104, 164, 164),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
),
|
||||
child: const Text(
|
||||
'Lokasi Pengiriman',
|
||||
textAlign: TextAlign.center,
|
||||
@ -307,6 +315,12 @@ class KirimBarangPage extends GetView<KirimBarangController> {
|
||||
// }
|
||||
controller.pin_lokasi_permulaan(context, "awal");
|
||||
},
|
||||
style: ElevatedButton.styleFrom(
|
||||
primary: const Color.fromARGB(255, 104, 164, 164),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
),
|
||||
child: const Text(
|
||||
'Lokasi Permulaan',
|
||||
textAlign: TextAlign.center,
|
||||
@ -319,17 +333,20 @@ class KirimBarangPage extends GetView<KirimBarangController> {
|
||||
child: SizedBox(
|
||||
width: MediaQuery.of(context).size.width * 0.3,
|
||||
child: ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(
|
||||
primary: Colors.green,
|
||||
),
|
||||
onPressed: () {
|
||||
WidgetsBinding.instance?.focusManager.primaryFocus
|
||||
WidgetsBinding.instance!.focusManager.primaryFocus
|
||||
?.unfocus();
|
||||
if (controller.formKey.currentState!.validate()) {
|
||||
FocusScope.of(context).unfocus();
|
||||
controller.konfirmasi_all(context);
|
||||
}
|
||||
},
|
||||
style: ElevatedButton.styleFrom(
|
||||
primary: const Color.fromARGB(255, 2, 72, 72),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
),
|
||||
child: const Text(
|
||||
'Konfirmasi',
|
||||
textAlign: TextAlign.center,
|
||||
|
||||
@ -1,19 +1,99 @@
|
||||
// ignore_for_file: file_names
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:kurir/widgets/boxBackgroundDecoration.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
class ListKurirPage extends StatelessWidget {
|
||||
import '../../../controller/after_login/pengirim/listKurirController.dart';
|
||||
import '../../../models/usersModel.dart';
|
||||
import '../../../widgets/bounce_scroller.dart';
|
||||
import '../../../widgets/boxBackgroundDecoration.dart';
|
||||
import '../../../widgets/load_data.dart';
|
||||
|
||||
class ListKurirPage extends GetView<ListKurirController> {
|
||||
const ListKurirPage({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return const BoxBackgroundDecoration(
|
||||
child: Center(
|
||||
child: Text(
|
||||
'List Kurir',
|
||||
style: TextStyle(
|
||||
fontSize: 30,
|
||||
return BoxBackgroundDecoration(
|
||||
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),
|
||||
_MainDetail(controller: controller),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
_TopSearchInputField(),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _TopSearchInputField extends StatelessWidget {
|
||||
const _TopSearchInputField({
|
||||
Key? key,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Positioned(
|
||||
top: MediaQuery.of(context).size.height * 0.05,
|
||||
right: MediaQuery.of(context).size.width * 0.05,
|
||||
left: MediaQuery.of(context).size.width * 0.05,
|
||||
child: SizedBox(
|
||||
width: double.infinity,
|
||||
height: 40,
|
||||
child: TextFormField(
|
||||
decoration: InputDecoration(
|
||||
hintText: 'Cari Kurir',
|
||||
hintStyle: const TextStyle(
|
||||
color: Colors.white,
|
||||
),
|
||||
prefixIcon: const Icon(
|
||||
Icons.search,
|
||||
color: Colors.white,
|
||||
),
|
||||
suffixIcon: const Icon(
|
||||
Icons.filter_list,
|
||||
color: Colors.white,
|
||||
),
|
||||
filled: true,
|
||||
fillColor: Colors.transparent,
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(30),
|
||||
borderSide: const BorderSide(
|
||||
color: Colors.white,
|
||||
width: 1,
|
||||
),
|
||||
),
|
||||
disabledBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(30),
|
||||
borderSide: const BorderSide(
|
||||
color: Colors.white,
|
||||
width: 1,
|
||||
),
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(30),
|
||||
borderSide: const BorderSide(
|
||||
color: Colors.white,
|
||||
width: 1,
|
||||
),
|
||||
),
|
||||
contentPadding: const EdgeInsets.symmetric(
|
||||
horizontal: 10,
|
||||
vertical: 10,
|
||||
),
|
||||
),
|
||||
style: const TextStyle(
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
@ -21,3 +101,142 @@ class ListKurirPage extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _MainDetail extends StatelessWidget {
|
||||
const _MainDetail({
|
||||
Key? key,
|
||||
required this.controller,
|
||||
}) : super(key: key);
|
||||
|
||||
final ListKurirController 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.loadKurir.value == 0) const LoadingDataWidget(),
|
||||
if (controller.loadKurir.value == 1 &&
|
||||
controller.kurirModelList.isNotEmpty)
|
||||
for (var data in controller.kurirModelList)
|
||||
_KurirDetailBox(data: data)
|
||||
else if (controller.loadKurir.value == 1 &&
|
||||
controller.kurirModelList.isEmpty)
|
||||
const TiadaDataWIdget(text: "Tidak ada data"),
|
||||
if (controller.loadKurir.value == 2) const ErrorLoadDataWidget(),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _KurirDetailBox extends StatelessWidget {
|
||||
const _KurirDetailBox({
|
||||
Key? key,
|
||||
required this.data,
|
||||
}) : super(key: key);
|
||||
|
||||
final KurirModel data;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(bottom: 10),
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
height: 90,
|
||||
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: 60,
|
||||
height: 60,
|
||||
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: CircleAvatar(
|
||||
radius: 30.0,
|
||||
backgroundImage: NetworkImage(
|
||||
data.photo_url ?? 'https://via.placeholder.com/150',
|
||||
scale: 0.5,
|
||||
),
|
||||
backgroundColor: Colors.transparent,
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const SizedBox(height: 10),
|
||||
Text(
|
||||
data.nama ?? 'Nama Belum Terisi',
|
||||
style: const TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.bold,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
data.no_telp ?? 'No Telp Belum Terisi',
|
||||
style: const TextStyle(
|
||||
fontSize: 15,
|
||||
color: Colors.grey,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
data.email ?? 'Email Belum Terisi',
|
||||
style: const TextStyle(
|
||||
fontSize: 15,
|
||||
color: Colors.grey,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const Expanded(
|
||||
flex: 1,
|
||||
child: Text("Rating"),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -51,7 +51,7 @@ class LogKirimanPage extends GetView<LogKirimanController> {
|
||||
child: GestureDetector(
|
||||
child: const Icon(
|
||||
Icons.list_alt_rounded,
|
||||
color: Colors.blueAccent,
|
||||
color: Color.fromARGB(255, 4, 103, 103),
|
||||
),
|
||||
onTap: () {},
|
||||
),
|
||||
|
||||
@ -1,27 +1,31 @@
|
||||
// ignore_for_file: file_names
|
||||
|
||||
// ignore: unused_import
|
||||
import 'dart:developer';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:kurir/widgets/boxBackgroundDecoration.dart';
|
||||
|
||||
class PengirimProfilePage extends StatelessWidget {
|
||||
import '../../../controller/after_login/pengirim/pengirimProfileController.dart';
|
||||
import '../../../widgets/appbar.dart';
|
||||
import '../../../widgets/boxBackgroundDecoration.dart';
|
||||
|
||||
class PengirimProfilePage extends GetView<PengirimProfileController> {
|
||||
const PengirimProfilePage({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text('Pengirim Profile'),
|
||||
actions: [
|
||||
IconButton(
|
||||
icon: const Icon(Icons.exit_to_app),
|
||||
onPressed: () {
|
||||
log("logout");
|
||||
},
|
||||
),
|
||||
],
|
||||
appBar: PreferredSize(
|
||||
preferredSize:
|
||||
Size.fromHeight(MediaQuery.of(context).size.height * 0.08),
|
||||
child: AppBarWidget(
|
||||
header: controller.headerText,
|
||||
autoLeading: true,
|
||||
actions: [
|
||||
HeaderActionButton(controller: controller),
|
||||
],
|
||||
),
|
||||
),
|
||||
body: WillPopScope(
|
||||
onWillPop: () async {
|
||||
@ -33,18 +37,155 @@ class PengirimProfilePage extends StatelessWidget {
|
||||
);
|
||||
return false;
|
||||
},
|
||||
child: const BoxBackgroundDecoration(
|
||||
child: Center(
|
||||
child: Text(
|
||||
'Pengirim Profile',
|
||||
style: TextStyle(
|
||||
fontSize: 30,
|
||||
color: Colors.white,
|
||||
child: BoxBackgroundDecoration(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
const SizedBox(
|
||||
height: 30,
|
||||
),
|
||||
),
|
||||
Container(
|
||||
padding: const EdgeInsets.all(3),
|
||||
width: 150,
|
||||
height: 150,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
shape: BoxShape.circle,
|
||||
image: const DecorationImage(
|
||||
image: AssetImage('assets/loading.gif'),
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.black.withOpacity(0.3),
|
||||
blurRadius: 10,
|
||||
spreadRadius: 5,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const Padding(
|
||||
padding:
|
||||
EdgeInsets.only(left: 15, right: 15, top: 15, bottom: 10),
|
||||
child: Text(
|
||||
"Nama User",
|
||||
style: TextStyle(
|
||||
fontSize: 24,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontStyle: FontStyle.italic,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
),
|
||||
const DetailChild(
|
||||
icon: Icons.phone_android_outlined, text: "08123456789"),
|
||||
const DetailChild(
|
||||
icon: Icons.email_outlined, text: "Karauksii@gmail.com"),
|
||||
const DetailChild(
|
||||
icon: Icons.home,
|
||||
text:
|
||||
"Jln Industri Kecil Parepare asdasd asdasd asdasda asdas"),
|
||||
const DetailChild(
|
||||
icon: Icons.motorcycle_outlined,
|
||||
text: "3 kali melakukan pengiriman barang"),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class DetailChild extends StatelessWidget {
|
||||
const DetailChild({
|
||||
Key? key,
|
||||
required this.icon,
|
||||
required this.text,
|
||||
}) : super(key: key);
|
||||
|
||||
final IconData icon;
|
||||
final String text;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Padding(
|
||||
padding: EdgeInsets.only(
|
||||
top: 10,
|
||||
bottom: 10,
|
||||
left: MediaQuery.of(context).size.width * 0.15,
|
||||
right: MediaQuery.of(context).size.width * 0.15,
|
||||
),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Icon(
|
||||
icon,
|
||||
color: Colors.white,
|
||||
),
|
||||
const SizedBox(
|
||||
width: 25,
|
||||
),
|
||||
Flexible(
|
||||
child: Text(
|
||||
text,
|
||||
style: const TextStyle(
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontStyle: FontStyle.italic,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class HeaderActionButton extends StatelessWidget {
|
||||
const HeaderActionButton({
|
||||
Key? key,
|
||||
required this.controller,
|
||||
}) : super(key: key);
|
||||
|
||||
final PengirimProfileController controller;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return IconButton(
|
||||
icon: const Icon(Icons.logout_outlined),
|
||||
onPressed: () {
|
||||
Get.dialog(
|
||||
AlertDialog(
|
||||
title: const Text('Logout'),
|
||||
content: const Text('Anda yakin ingin logout?'),
|
||||
actions: [
|
||||
ElevatedButton(
|
||||
child: const Text('Yes'),
|
||||
style: ElevatedButton.styleFrom(
|
||||
primary: const Color.fromARGB(255, 2, 72, 72),
|
||||
),
|
||||
onPressed: () {
|
||||
// log("ini untuk logout");
|
||||
Get.back();
|
||||
controller.logout();
|
||||
},
|
||||
),
|
||||
ElevatedButton(
|
||||
child: const Text('No'),
|
||||
style: ElevatedButton.styleFrom(
|
||||
primary: const Color.fromARGB(
|
||||
255, 104, 164, 164), //background color
|
||||
// onPrimary: Colors.black, //ripple color
|
||||
),
|
||||
onPressed: () {
|
||||
Get.back();
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user