another commit

This commit is contained in:
kicap1992
2022-06-08 06:03:46 +08:00
commit 330bfdeadb
60 changed files with 9627 additions and 0 deletions

View File

@ -0,0 +1,52 @@
import 'package:flutter/material.dart';
// import 'package:get/get.dart';
class BeforeEnterPage extends StatelessWidget {
const BeforeEnterPage({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
// appBar: AppBar(
// title: const Text('Login'),
// actions: [
// IconButton(
// icon: Icon(Icons.close),
// onPressed: () => Get.offAllNamed(
// '/index',
// arguments: {
// "tap": 0,
// "history": [0],
// },
// ),
// ),
// ],
// ),
body: Container(
width: MediaQuery.of(context).size.width,
height: MediaQuery.of(context).size.height,
//decoration to gradient
decoration: const BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
colors: [
Color.fromARGB(255, 199, 214, 234),
Color.fromARGB(255, 104, 164, 164),
Color.fromARGB(255, 4, 103, 103),
Color.fromARGB(255, 2, 72, 72),
],
),
),
//put logo image in center
child: Center(
child: Image.asset(
'assets/logo.png',
width: MediaQuery.of(context).size.width / 2,
height: MediaQuery.of(context).size.height / 2,
),
),
),
);
}
}

View File

@ -0,0 +1,42 @@
// ignore_for_file: file_names
import 'dart:developer';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:kurir/controller/after_login/kurir/indexController.dart';
import 'package:kurir/pages/after_login/kurir/logHistoryPage.dart';
import 'package:kurir/pages/after_login/kurir/pengaturanPage.dart';
import 'package:kurir/pages/after_login/kurir/pengirimanPage.dart';
import 'package:double_back_to_close_app/double_back_to_close_app.dart';
class KurirIndexPage extends GetView<KurirIndexController> {
const KurirIndexPage({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
body: DoubleBackToCloseApp(
child: PageView(
controller: controller.pageController,
children: const [
PengaturanKurirPage(),
PengirimanKurirPage(),
LogHistoryKurirPage(),
],
onPageChanged: (index) {
log("sini on page changed" + index.toString());
// Get.delete<PengaturanKurirController>();
FocusScope.of(context).unfocus();
controller.pageChanged(index);
},
),
snackBar: const SnackBar(
content: Text('Tekan tombol kembali lagi untuk keluar'),
),
),
bottomNavigationBar: Obx(() => controller.bottomNavigationBar(context)),
);
}
}

View File

@ -0,0 +1,26 @@
// ignore_for_file: file_names
import 'package:flutter/material.dart';
import '../../../widgets/boxBackgroundDecoration.dart';
class LogHistoryKurirPage extends StatelessWidget {
const LogHistoryKurirPage({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return const Scaffold(
body: BoxBackgroundDecoration(
child: Center(
child: Text(
'Log History',
style: TextStyle(
fontSize: 30,
color: Colors.white,
),
),
),
),
);
}
}

View File

@ -0,0 +1,233 @@
// ignore_for_file: file_names
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 '../../../widgets/boxBackgroundDecoration.dart';
class PengaturanKurirPage extends GetView<PengaturanKurirController> {
const PengaturanKurirPage({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
// controller.onInit();
return Scaffold(
body: BoxBackgroundDecoration(
child: SingleChildScrollView(
child: Column(
children: [
Image.asset(
'assets/logo.png',
height: MediaQuery.of(context).size.height * 0.30,
width: MediaQuery.of(context).size.width * 0.30,
),
OurContainer(
child: Form(
// autovalidateMode: AutovalidateMode.onUserInteraction,
key: controller.formKey,
child: Column(
children: <Widget>[
const SizedBox(height: 5),
const Text(
'Pengaturan Biaya Pengiriman',
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 15,
fontWeight: FontWeight.bold,
),
),
const SizedBox(
height: 15,
),
EnsureVisibleWhenFocused(
focusNode: controller.minimalBiayaPengirimanFocusNode,
child: TextFormField(
// initialValue: 700.toString(),
controller:
controller.minimalBiayaPengirimanController,
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';
}
if (controller.removeComma(controller
.maksimalBiayaPengirimanController.text) <
controller.removeComma(value)) {
return 'Minimal Biaya Pengiriman tidak boleh lebih besar dari Maksimal Biaya Pengiriman';
}
return null;
},
),
),
const SizedBox(
height: 15,
),
EnsureVisibleWhenFocused(
focusNode: controller.maksimalBiayaPengirimanFocusNode,
child: TextFormField(
controller:
controller.maksimalBiayaPengirimanController,
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';
}
return null;
},
),
),
const SizedBox(
height: 15,
),
EnsureVisibleWhenFocused(
focusNode: controller.biayaPerKiloFocusNode,
child: TextFormField(
controller: controller.biayaPerKiloController,
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,
),
),
),
validator: (value) {
if (value!.isEmpty) {
return 'Biaya Per Kilometer tidak boleh kosong';
}
return null;
},
),
),
const SizedBox(
height: 15,
),
ElevatedButton(
onPressed: () {
// log()
if (controller.formKey.currentState!.validate()) {
FocusScope.of(context).unfocus();
// create alert dialog
showDialog(
context: context,
builder: (context) {
return AlertDialog(
title: const Text('Konfirmasi'),
content: Text(controller.status.value ==
'Simpan'
? 'Informasi Biaya Pengiriman akan disimpan '
: 'Info Biaya Pengiriman akan diubah '),
actions: [
ElevatedButton(
child: const Text('Tidak'),
style: ElevatedButton.styleFrom(
primary:
Colors.red[400], //background color
// onPrimary: Colors.black, //ripple color
),
onPressed: () {
Navigator.of(context).pop();
},
),
ElevatedButton(
child: const Text('Ya'),
onPressed: () {
controller.simpan();
Navigator.of(context).pop();
},
),
],
);
},
);
}
},
child: Obx(() => Text(
controller.status.value == 'Simpan'
? 'Simpan'
: 'Ubah')),
),
],
),
),
),
const SizedBox(height: 10),
],
),
),
),
// bottomNavigationBar: BottomNavigationBar(
// items: [
// BottomNavigationBarItem(
// icon: Icon(Icons.home),
// label: "Pengaturan",
// ),
// BottomNavigationBarItem(
// icon: Icon(Icons.history),
// label: "Log History",
// ),
// BottomNavigationBarItem(
// icon: Icon(Icons.arrow_back),
// label: "Pengiriman",
// ),
// ],
// currentIndex: 0,
// selectedItemColor: const Color.fromARGB(255, 148, 183, 229),
// ),
);
}
}

View File

@ -0,0 +1,26 @@
// ignore_for_file: file_names
import 'package:flutter/material.dart';
import '../../../widgets/boxBackgroundDecoration.dart';
class PengirimanKurirPage extends StatelessWidget {
const PengirimanKurirPage({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return const Scaffold(
// ignore: unnecessary_const
body: const BoxBackgroundDecoration(
child: Center(
child: Text(
'Pengiriman',
style: TextStyle(
fontSize: 30,
color: Colors.white,
),
)),
),
);
}
}

View File

@ -0,0 +1,62 @@
// ignore_for_file: file_names
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:kurir/controller/after_login/kurir/profileController.dart';
class ProfileKurirPage extends GetView<KurirProfileController> {
const ProfileKurirPage({Key? key}) : super(key: key);
@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();
},
),
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 {
Get.offAllNamed(
'/kurirIndex',
);
return false;
},
child: const Center(
child: Text('Profile'),
),
),
);
}
}

View File

@ -0,0 +1,43 @@
// ignore_for_file: file_names
import 'dart:developer';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:kurir/controller/after_login/pengirim/indexController.dart';
import 'package:double_back_to_close_app/double_back_to_close_app.dart';
import 'package:kurir/pages/after_login/pengirim/kirimBarangPage.dart';
import 'package:kurir/pages/after_login/pengirim/listKurirPage.dart';
import 'package:kurir/pages/after_login/pengirim/logKirimanPage.dart';
class PengirimIndexPage extends GetView<PengirimIndexController> {
const PengirimIndexPage({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
// ignore: unnecessary_const
body: DoubleBackToCloseApp(
child: PageView(
controller: controller.pageController,
children: const [
KirimBarangPage(),
LogKirimanPage(),
ListKurirPage(),
],
onPageChanged: (index) {
log("sini on page changed" + index.toString());
// Get.delete<PengaturanKurirController>();
FocusScope.of(context).unfocus();
controller.pageChanged(index);
},
),
snackBar: const SnackBar(
content: Text('Tekan tombol kembali lagi untuk keluar'),
),
),
bottomNavigationBar: Obx(() => controller.bottomNavigationBar(context)),
);
}
}

View File

@ -0,0 +1,352 @@
// ignore_for_file: file_names
// ignore: unused_import
import 'dart:developer' as dev;
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:get/get.dart';
import 'package:kurir/controller/after_login/pengirim/kirimBarangController.dart';
import 'package:kurir/widgets/boxBackgroundDecoration.dart';
import 'package:kurir/widgets/ourContainer.dart';
class KirimBarangPage extends GetView<KirimBarangController> {
const KirimBarangPage({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
// Get.lazyPut<KirimBarangController>(() => KirimBarangController());
return BoxBackgroundDecoration(
child: SingleChildScrollView(
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
const SizedBox(height: 25),
OurContainer(
child: Form(
key: controller.formKey,
child: Column(
children: [
const SizedBox(height: 5),
GestureDetector(
onTap: () => controller.show_foto(context),
child: Center(
child: Container(
width: 80,
height: 80,
decoration: BoxDecoration(
color: Colors.grey,
borderRadius: BorderRadius.circular(100),
boxShadow: const [
BoxShadow(
color: Colors.grey,
blurRadius: 5,
spreadRadius: 1,
),
],
),
child: Obx(
() => Stack(
// put icon on rigth bottom corner
alignment: Alignment.center,
children: [
(controller.adaFoto.value)
? 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: MemoryImage(
controller.imagebytes,
),
fit: BoxFit.fill,
),
),
),
)
: const Icon(Icons.add,
color: Colors.white, size: 22),
Positioned(
bottom: 0,
right: 0,
child: GestureDetector(
onTap: () =>
controller.onChooseOption(context),
child: Container(
width: 40,
height: 40,
decoration: BoxDecoration(
color: Colors.blue,
borderRadius:
BorderRadius.circular(100),
),
child: const Icon(
Icons.add_a_photo_outlined,
color: Colors.black,
size: 30,
),
),
),
),
],
),
),
),
),
),
const SizedBox(height: 10),
TextFormField(
controller: controller.namaPenerimaController,
focusNode: controller.namaPenerimaFocusNode,
decoration: InputDecoration(
hintText: 'Masukkan Nama Penerima',
labelText: 'Nama Penerima',
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(10),
borderSide: const BorderSide(
color: Colors.grey,
),
),
),
validator: (value) {
if (value!.isEmpty) {
return 'Nama Penerima Tidak Boleh Kosong';
}
return null;
},
),
const SizedBox(height: 20),
TextFormField(
keyboardType: TextInputType.number,
inputFormatters: [
FilteringTextInputFormatter.allow(
RegExp(r'[0-9]'),
),
],
controller: controller.noTelponPenerimaController,
focusNode: controller.noTelponPenerimaFocusNode,
maxLength: 13,
decoration: InputDecoration(
hintText: 'Masukkan No Telpon Penerima',
labelText: 'No Telpon Penerima',
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(10),
borderSide: const BorderSide(
color: Colors.grey,
),
),
),
validator: (value) {
if (value!.isEmpty) {
return 'Nama Penerima Tidak Boleh Kosong';
}
if (value[0] != '0' && value[1] != '8') {
return 'No Telpon Penerima Tidak Valid';
}
if (value.length < 11) {
return 'Minimal No Telpon Penerima 11 Digit';
}
return null;
},
),
const SizedBox(height: 20),
GestureDetector(
onTap: () {
FocusScope.of(context).unfocus();
// log("sini untuk pilih kurir");
controller.pilih_kurir(context);
},
child: TextFormField(
enabled: false,
// initialValue: (controller.selectedKurirNama.value == '')
// ? 'Klik Untuk Pilih Kurir'
// : "ada",
controller: controller.kurirOutroTextController,
style: const TextStyle(
color: Colors.grey,
),
decoration: InputDecoration(
labelText: 'Kurir Penghantar',
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(10),
borderSide: const BorderSide(
color: Colors.grey,
),
),
errorStyle: const TextStyle(
color: Colors.red,
),
),
// validator: (value) {
// if (value! == 'Klik Untuk Pilih Kurir') {
// return 'Nama Penerima Tidak Boleh Kosong';
// }
// return null;
// },
),
),
const SizedBox(height: 20),
TextFormField(
controller: controller.alamatPenerimaController,
focusNode: controller.alamatPenerimaFocusNode,
keyboardType: TextInputType.multiline,
textInputAction: TextInputAction.newline,
// minLines: 1,
maxLines: 4,
decoration: InputDecoration(
hintText: 'Masukkan Alamat Penerima',
labelText: 'Alamat Penerima',
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(10),
borderSide: const BorderSide(
color: Colors.grey,
),
),
),
validator: (value) {
if (value!.isEmpty) {
return 'Nama Penerima Tidak Boleh Kosong';
}
return null;
},
),
const SizedBox(height: 20),
TextFormField(
controller: controller.biayaKirimController,
enabled: false,
style: const TextStyle(
color: Colors.grey,
),
decoration: InputDecoration(
labelText: 'Biaya Pengiriman',
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(10),
borderSide: const BorderSide(
color: Colors.grey,
),
),
errorStyle: const TextStyle(
color: Colors.red,
),
),
// validator: (value) {
// if (value!.isEmpty) {
// return 'Kurir Belum Dipilih @\nLokasi Pengiriman Belum Ditanda @\nLokasi Permulaan Belum Ditanda';
// }
// return null;
// },
),
const SizedBox(height: 20),
TextFormField(
controller: controller.jarakTempuhController,
enabled: false,
style: const TextStyle(
color: Colors.grey,
),
decoration: InputDecoration(
labelText: 'Jarak Tempuh (Km) Kurir',
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(10),
borderSide: const BorderSide(
color: Colors.grey,
),
),
errorStyle: const TextStyle(
color: Colors.red,
),
),
// validator: (value) {
// if (value!.isEmpty) {
// return 'Lokasi Pengiriman atau Lokasi Permulaan Belum Ditanda';
// }
// return null;
// },
),
const SizedBox(height: 20),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
SizedBox(
width: MediaQuery.of(context).size.width * 0.3,
child: ElevatedButton(
onPressed: () {
// log("sini pin lokasi");
controller.pin_lokasi(context);
},
child: const Text(
'Lokasi Pengiriman',
textAlign: TextAlign.center,
),
),
),
const SizedBox(),
SizedBox(
width: MediaQuery.of(context).size.width * 0.3,
child: ElevatedButton(
onPressed: () {
// create random number
// String number =
// Random().nextInt(99999999).toString();
// controller.kurirOutroTextController.text = number;
// if (controller.formKey.currentState!.validate()) {
// FocusScope.of(context).unfocus();
// controller.konfirmasi_all(context);
// }
controller.pin_lokasi_permulaan(context, "awal");
},
child: const Text(
'Lokasi Permulaan',
textAlign: TextAlign.center,
),
),
),
],
),
Center(
child: SizedBox(
width: MediaQuery.of(context).size.width * 0.3,
child: ElevatedButton(
style: ElevatedButton.styleFrom(
primary: Colors.green,
),
onPressed: () {
WidgetsBinding.instance?.focusManager.primaryFocus
?.unfocus();
if (controller.formKey.currentState!.validate()) {
FocusScope.of(context).unfocus();
controller.konfirmasi_all(context);
}
},
child: const Text(
'Konfirmasi',
textAlign: TextAlign.center,
),
),
),
),
],
),
),
),
const SizedBox(
height: 20,
),
],
),
),
);
}
}

View File

@ -0,0 +1,23 @@
// ignore_for_file: file_names
import 'package:flutter/material.dart';
import 'package:kurir/widgets/boxBackgroundDecoration.dart';
class ListKurirPage extends StatelessWidget {
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,
color: Colors.white,
),
),
),
);
}
}

View File

@ -0,0 +1,91 @@
// ignore_for_file: file_names
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:kurir/controller/after_login/pengirim/logKirimanController.dart';
import 'package:kurir/widgets/boxBackgroundDecoration.dart';
import 'package:kurir/widgets/ourContainer.dart';
class LogKirimanPage extends GetView<LogKirimanController> {
const LogKirimanPage({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
controller.checkScreenOrientation();
return BoxBackgroundDecoration(
child: SingleChildScrollView(
child: Column(
children: [
const SizedBox(
height: 25,
),
Center(
child: Container(
constraints: BoxConstraints(
maxHeight: MediaQuery.of(context).size.height * 0.85,
minHeight: MediaQuery.of(context).size.height * 0.75,
maxWidth: MediaQuery.of(context).size.width,
),
child: OurContainer(
child: Column(
children: [
const Center(
child: Text(
'Log Kiriman',
style: TextStyle(
fontSize: 20, fontWeight: FontWeight.bold,
// color: Colors.white,
),
),
),
const SizedBox(
height: 20,
),
TextFormField(
decoration: InputDecoration(
hintText: 'Cari Kiriman',
labelText: 'Cari Kiriman',
prefixIcon: Padding(
padding:
const EdgeInsetsDirectional.only(start: 10),
child: GestureDetector(
child: const Icon(
Icons.list_alt_rounded,
color: Colors.blueAccent,
),
onTap: () {},
),
),
suffixIcon: const Icon(Icons.search),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(10),
borderSide: const BorderSide(
color: Colors.grey,
),
),
),
validator: (value) {
if (value!.isEmpty) {
return 'Nama Penerima Tidak Boleh Kosong';
}
return null;
},
),
const SizedBox(
height: 10,
),
Obx(() => controller.widgetLogKiriman.value),
],
),
),
),
),
const SizedBox(
height: 20,
),
],
),
),
);
}
}

View File

@ -0,0 +1,50 @@
// ignore_for_file: file_names
import 'dart:developer';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:kurir/widgets/boxBackgroundDecoration.dart';
class PengirimProfilePage extends StatelessWidget {
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");
},
),
],
),
body: WillPopScope(
onWillPop: () async {
Get.offAllNamed(
'/pengirimIndex',
arguments: {
'tap': 1,
},
);
return false;
},
child: const BoxBackgroundDecoration(
child: Center(
child: Text(
'Pengirim Profile',
style: TextStyle(
fontSize: 30,
color: Colors.white,
),
),
),
),
),
);
}
}