another commit
This commit is contained in:
52
lib/pages/after_login/before_enter.dart
Normal file
52
lib/pages/after_login/before_enter.dart
Normal 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,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
42
lib/pages/after_login/kurir/indexPage.dart
Normal file
42
lib/pages/after_login/kurir/indexPage.dart
Normal 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)),
|
||||
);
|
||||
}
|
||||
}
|
||||
26
lib/pages/after_login/kurir/logHistoryPage.dart
Normal file
26
lib/pages/after_login/kurir/logHistoryPage.dart
Normal 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,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
233
lib/pages/after_login/kurir/pengaturanPage.dart
Normal file
233
lib/pages/after_login/kurir/pengaturanPage.dart
Normal 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),
|
||||
// ),
|
||||
);
|
||||
}
|
||||
}
|
||||
26
lib/pages/after_login/kurir/pengirimanPage.dart
Normal file
26
lib/pages/after_login/kurir/pengirimanPage.dart
Normal 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,
|
||||
),
|
||||
)),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
62
lib/pages/after_login/kurir/profilePage.dart
Normal file
62
lib/pages/after_login/kurir/profilePage.dart
Normal 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'),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
43
lib/pages/after_login/pengirim/indexPage.dart
Normal file
43
lib/pages/after_login/pengirim/indexPage.dart
Normal 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)),
|
||||
);
|
||||
}
|
||||
}
|
||||
352
lib/pages/after_login/pengirim/kirimBarangPage.dart
Normal file
352
lib/pages/after_login/pengirim/kirimBarangPage.dart
Normal 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,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
23
lib/pages/after_login/pengirim/listKurirPage.dart
Normal file
23
lib/pages/after_login/pengirim/listKurirPage.dart
Normal 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,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
91
lib/pages/after_login/pengirim/logKirimanPage.dart
Normal file
91
lib/pages/after_login/pengirim/logKirimanPage.dart
Normal 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,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
50
lib/pages/after_login/pengirim/pengirimProfilePage.dart
Normal file
50
lib/pages/after_login/pengirim/pengirimProfilePage.dart
Normal 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,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
101
lib/pages/before_login/daftar.dart
Normal file
101
lib/pages/before_login/daftar.dart
Normal file
@ -0,0 +1,101 @@
|
||||
import 'dart:developer';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:kurir/controller/before_login/loginController.dart';
|
||||
// import 'package:kurir/controller/before_login/indexController.dart';
|
||||
|
||||
import '../../widgets/boxBackgroundDecoration.dart';
|
||||
import '../../widgets/ourContainer.dart';
|
||||
|
||||
// class DaftarPage extends GetView<IndexController> {
|
||||
class DaftarPage extends GetView<LoginController> {
|
||||
const DaftarPage({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return WillPopScope(
|
||||
onWillPop: () async => controller.willPopScopeWidget(),
|
||||
child: Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text('Daftar'),
|
||||
),
|
||||
body: BoxBackgroundDecoration(
|
||||
child: SingleChildScrollView(
|
||||
child: Center(
|
||||
child: Column(
|
||||
children: [
|
||||
// set logo.png on top center of screen
|
||||
Image.asset(
|
||||
'assets/logo.png',
|
||||
height: MediaQuery.of(context).size.height * 0.30,
|
||||
width: MediaQuery.of(context).size.width * 0.30,
|
||||
),
|
||||
OurContainer(
|
||||
child: Column(
|
||||
children: [
|
||||
SizedBox(
|
||||
height: MediaQuery.of(context).size.height * 0.03,
|
||||
),
|
||||
SizedBox(
|
||||
width: double.infinity,
|
||||
child: Obx(
|
||||
() => DropdownButtonFormField(
|
||||
decoration: InputDecoration(
|
||||
labelText: 'Daftar Sebagai',
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
borderSide: const BorderSide(
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
),
|
||||
value: controller.selectedRole.value,
|
||||
items: controller.role.map((String value) {
|
||||
return DropdownMenuItem(
|
||||
value: value,
|
||||
child: Text(value),
|
||||
);
|
||||
}).toList(),
|
||||
onChanged: (item) {
|
||||
// log(item.toString() + " ini item");
|
||||
controller.selectedRole.value = item.toString();
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 15,
|
||||
),
|
||||
SizedBox(
|
||||
width: MediaQuery.of(context).size.width * 0.3,
|
||||
child: ElevatedButton(
|
||||
onPressed: () {
|
||||
log(controller.selectedRole.value);
|
||||
if (controller.selectedRole.value == 'Kurir') {
|
||||
// Get.delete<LoginController>();
|
||||
Get.offAllNamed('/pendaftaranKurir');
|
||||
} else if (controller.selectedRole.value ==
|
||||
'Pengirim') {
|
||||
Get.offAllNamed('/pendaftaranPengirim');
|
||||
}
|
||||
},
|
||||
child: const Text('Daftar'),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: MediaQuery.of(context).size.height * 0.03,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
bottomNavigationBar: Obx(() => controller.bottomNavigationBar()),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
39
lib/pages/before_login/index.dart
Normal file
39
lib/pages/before_login/index.dart
Normal file
@ -0,0 +1,39 @@
|
||||
import 'package:double_back_to_close_app/double_back_to_close_app.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:kurir/controller/before_login/loginController.dart';
|
||||
// import 'package:kurir/controller/before_login/indexController.dart';
|
||||
|
||||
import '../../widgets/boxBackgroundDecoration.dart';
|
||||
|
||||
// class IndexPage extends GetView<IndexController> {
|
||||
class IndexPage extends GetView<LoginController> {
|
||||
const IndexPage({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text('Hompage'),
|
||||
automaticallyImplyLeading: false,
|
||||
),
|
||||
body: const DoubleBackToCloseApp(
|
||||
child: BoxBackgroundDecoration(
|
||||
child: Center(
|
||||
child: Text(
|
||||
'Hompage',
|
||||
style: TextStyle(
|
||||
fontSize: 30,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
snackBar: SnackBar(
|
||||
content: Text('Tekan tombol kembali lagi untuk keluar'),
|
||||
),
|
||||
),
|
||||
bottomNavigationBar: Obx(() => controller.bottomNavigationBar()),
|
||||
);
|
||||
}
|
||||
}
|
||||
175
lib/pages/before_login/login.dart
Normal file
175
lib/pages/before_login/login.dart
Normal file
@ -0,0 +1,175 @@
|
||||
import 'dart:developer';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:kurir/widgets/focusToTextFormField.dart';
|
||||
import 'package:kurir/widgets/ourContainer.dart';
|
||||
|
||||
import '../../controller/before_login/loginController.dart';
|
||||
import '../../widgets/boxBackgroundDecoration.dart';
|
||||
|
||||
class LoginPage extends GetView<LoginController> {
|
||||
const LoginPage({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return WillPopScope(
|
||||
onWillPop: () async => controller.willPopScopeWidget(),
|
||||
child: Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text('Login'),
|
||||
),
|
||||
body: BoxBackgroundDecoration(
|
||||
child: SingleChildScrollView(
|
||||
child: Center(
|
||||
child: Form(
|
||||
key: controller.formKey,
|
||||
child: Column(
|
||||
children: [
|
||||
// set logo.png on top center of screen
|
||||
Image.asset(
|
||||
'assets/logo.png',
|
||||
height: MediaQuery.of(context).size.height * 0.30,
|
||||
width: MediaQuery.of(context).size.width * 0.30,
|
||||
),
|
||||
OurContainer(
|
||||
child: Column(
|
||||
children: [
|
||||
SizedBox(
|
||||
height: MediaQuery.of(context).size.height * 0.03,
|
||||
),
|
||||
SizedBox(
|
||||
width: double.infinity,
|
||||
child: Obx(
|
||||
() => DropdownButtonFormField(
|
||||
decoration: InputDecoration(
|
||||
labelText: 'Login Sebagai',
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
borderSide: const BorderSide(
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
),
|
||||
value: controller.selectedRole.value,
|
||||
items: controller.role.map((String value) {
|
||||
return DropdownMenuItem(
|
||||
value: value,
|
||||
child: Text(value),
|
||||
);
|
||||
}).toList(),
|
||||
onChanged: (item) {
|
||||
// log(item.toString() + " ini item");
|
||||
controller.selectedRole.value =
|
||||
item.toString();
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 15,
|
||||
),
|
||||
EnsureVisibleWhenFocused(
|
||||
focusNode: controller.usernameFocusNode,
|
||||
child: TextFormField(
|
||||
//focus node
|
||||
focusNode: controller.usernameFocusNode,
|
||||
controller: controller.usernameController,
|
||||
decoration: InputDecoration(
|
||||
hintText: 'Masukkan Username',
|
||||
labelText: 'Username',
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
borderSide: const BorderSide(
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
),
|
||||
validator: (value) {
|
||||
if (value!.isEmpty) {
|
||||
controller.usernameFocusNode.requestFocus();
|
||||
return 'Masukkan Username';
|
||||
}
|
||||
return null;
|
||||
},
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 15,
|
||||
),
|
||||
Obx(
|
||||
() => EnsureVisibleWhenFocused(
|
||||
focusNode: controller.passwordFocusNode,
|
||||
child: TextFormField(
|
||||
//focus node
|
||||
focusNode: controller.passwordFocusNode,
|
||||
controller: controller.passwordController,
|
||||
obscureText: !controller.passwordVisible.value,
|
||||
decoration: InputDecoration(
|
||||
hintText: 'Masukkan Password',
|
||||
labelText: 'Password',
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
borderSide: const BorderSide(
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
suffixIcon: IconButton(
|
||||
icon: Icon(
|
||||
Icons.remove_red_eye,
|
||||
color: controller.passwordVisible.value
|
||||
? Colors.black
|
||||
: Colors.grey,
|
||||
),
|
||||
onPressed: () {
|
||||
controller.passwordVisible.value =
|
||||
!controller.passwordVisible.value;
|
||||
},
|
||||
),
|
||||
),
|
||||
validator: (value) {
|
||||
if (value!.isEmpty) {
|
||||
controller.passwordFocusNode.requestFocus();
|
||||
return 'Masukkan Password';
|
||||
}
|
||||
return null;
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 15,
|
||||
),
|
||||
SizedBox(
|
||||
width: MediaQuery.of(context).size.width * 0.3,
|
||||
child: ElevatedButton(
|
||||
onPressed: () {
|
||||
log(controller.selectedRole.value +
|
||||
" ini selected role di login");
|
||||
FocusScope.of(context).unfocus();
|
||||
if (controller.formKey.currentState!
|
||||
.validate()) {
|
||||
// controller.wrongPassword.value = true;
|
||||
controller.login();
|
||||
}
|
||||
},
|
||||
child: const Text('Login'),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: MediaQuery.of(context).size.height * 0.03,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
bottomNavigationBar: Obx(() => controller.bottomNavigationBar()),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
668
lib/pages/before_login/pendaftaran_kurir.dart
Normal file
668
lib/pages/before_login/pendaftaran_kurir.dart
Normal file
@ -0,0 +1,668 @@
|
||||
import 'dart:developer';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:kurir/controller/before_login/pendaftaranKurirController.dart';
|
||||
import 'package:kurir/widgets/focusToTextFormField.dart';
|
||||
|
||||
import '../../widgets/boxBackgroundDecoration.dart';
|
||||
import '../../widgets/ourContainer.dart';
|
||||
|
||||
// import 'package:image_picker/image_picker.dart';
|
||||
|
||||
class PendaftaranKurirPage extends GetView<PendaftaranKurirController> {
|
||||
const PendaftaranKurirPage({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
// FocusScope.of(context).unfocus();
|
||||
return WillPopScope(
|
||||
onWillPop: () => controller.willPopScopeWidget(),
|
||||
child: Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text('Pendaftaran Kurir'),
|
||||
actions: [
|
||||
IconButton(
|
||||
icon: const Icon(Icons.info_outline),
|
||||
onPressed: () {
|
||||
controller.intro_message();
|
||||
// controller.getHttp();
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
body: BoxBackgroundDecoration(
|
||||
child: SingleChildScrollView(
|
||||
reverse: false,
|
||||
child: Center(
|
||||
child: Form(
|
||||
key: controller.formKey,
|
||||
child: Column(
|
||||
children: [
|
||||
SizedBox(
|
||||
height: MediaQuery.of(context).size.height * 0.03,
|
||||
),
|
||||
OurContainer(
|
||||
child: Column(
|
||||
children: [
|
||||
SizedBox(
|
||||
height: MediaQuery.of(context).size.height * 0.02,
|
||||
),
|
||||
const Text(
|
||||
'Detail Login',
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 15,
|
||||
),
|
||||
EnsureVisibleWhenFocused(
|
||||
focusNode: controller.usernameFocusNode,
|
||||
child: TextFormField(
|
||||
//focus node
|
||||
focusNode: controller.usernameFocusNode,
|
||||
controller: controller.usernameController,
|
||||
decoration: InputDecoration(
|
||||
hintText: 'Username',
|
||||
labelText: 'Username',
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
borderSide: const BorderSide(
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
),
|
||||
validator: (value) {
|
||||
if (value!.isEmpty) {
|
||||
// request focus
|
||||
// FocusScope.of(context).unfocus();
|
||||
controller.usernameFocusNode.requestFocus();
|
||||
return 'Username Harus Terisi';
|
||||
}
|
||||
return null;
|
||||
},
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 15,
|
||||
),
|
||||
Obx(
|
||||
() => EnsureVisibleWhenFocused(
|
||||
focusNode: controller.passwordFocusNode,
|
||||
child: TextFormField(
|
||||
//focus node
|
||||
focusNode: controller.passwordFocusNode,
|
||||
controller: controller.passwordController,
|
||||
obscureText: controller.passwordVisible.value,
|
||||
decoration: InputDecoration(
|
||||
hintText: 'Password',
|
||||
labelText: 'Password',
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
borderSide: const BorderSide(
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
suffixIcon: IconButton(
|
||||
icon: Icon(
|
||||
Icons.remove_red_eye,
|
||||
color: !controller.passwordVisible.value
|
||||
? Colors.black
|
||||
: Colors.grey,
|
||||
),
|
||||
onPressed: () {
|
||||
controller.passwordVisible.value =
|
||||
!controller.passwordVisible.value;
|
||||
},
|
||||
),
|
||||
),
|
||||
validator: (value) {
|
||||
// log(value!.length.toString() +
|
||||
// "ini panjangnya");
|
||||
if (value!.isEmpty) {
|
||||
controller.passwordFocusNode.requestFocus();
|
||||
return 'Password Harus Terisi';
|
||||
} else if (value.length < 8) {
|
||||
controller.passwordFocusNode.requestFocus();
|
||||
return 'Password Minimal 8 Karakter';
|
||||
} else if (value.toString() !=
|
||||
controller
|
||||
.konfirmasiPasswordController.text
|
||||
.toString()) {
|
||||
controller.passwordFocusNode.requestFocus();
|
||||
return 'Password tidak sama dengan konfirmasi password';
|
||||
}
|
||||
return null;
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 15,
|
||||
),
|
||||
Obx(
|
||||
() => EnsureVisibleWhenFocused(
|
||||
focusNode: controller.konfirmasiPasswordFocusNode,
|
||||
child: TextFormField(
|
||||
//focus node
|
||||
focusNode:
|
||||
controller.konfirmasiPasswordFocusNode,
|
||||
controller:
|
||||
controller.konfirmasiPasswordController,
|
||||
obscureText:
|
||||
controller.konfirmasiPasswordVisible.value,
|
||||
decoration: InputDecoration(
|
||||
hintText: 'Konfirmasi Password',
|
||||
labelText: 'Konfirmasi Password',
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
borderSide: const BorderSide(
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
suffixIcon: IconButton(
|
||||
icon: Icon(
|
||||
Icons.remove_red_eye,
|
||||
color: !controller
|
||||
.konfirmasiPasswordVisible.value
|
||||
? Colors.black
|
||||
: Colors.grey,
|
||||
),
|
||||
onPressed: () {
|
||||
controller
|
||||
.konfirmasiPasswordVisible.value =
|
||||
!controller
|
||||
.konfirmasiPasswordVisible.value;
|
||||
},
|
||||
),
|
||||
),
|
||||
validator: (value) {
|
||||
// log('konfirmasi pasword = $value');
|
||||
if (value!.isEmpty) {
|
||||
controller.konfirmasiPasswordFocusNode
|
||||
.requestFocus();
|
||||
return 'Konfirmasi Password Harus Terisi';
|
||||
} else if (value.toString() !=
|
||||
controller.passwordController.text
|
||||
.toString()) {
|
||||
controller.konfirmasiPasswordFocusNode
|
||||
.requestFocus();
|
||||
return 'Password tidak sama dengan konfirmasi password';
|
||||
}
|
||||
return null;
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: MediaQuery.of(context).size.height * 0.03,
|
||||
),
|
||||
OurContainer(
|
||||
child: Column(
|
||||
children: [
|
||||
SizedBox(
|
||||
height: MediaQuery.of(context).size.height * 0.02,
|
||||
),
|
||||
const Text(
|
||||
'Detail Kurir',
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 15,
|
||||
),
|
||||
EnsureVisibleWhenFocused(
|
||||
focusNode: controller.nikFocusNode,
|
||||
child: TextFormField(
|
||||
//focus node
|
||||
focusNode: controller.nikFocusNode,
|
||||
controller: controller.nikController,
|
||||
maxLength: 16,
|
||||
keyboardType: TextInputType.number,
|
||||
inputFormatters: [
|
||||
FilteringTextInputFormatter.allow(
|
||||
RegExp(r'[0-9]'),
|
||||
),
|
||||
],
|
||||
decoration: InputDecoration(
|
||||
hintText: 'NIK',
|
||||
labelText: 'NIK',
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
borderSide: const BorderSide(
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
),
|
||||
validator: (value) {
|
||||
if (value!.isEmpty) {
|
||||
controller.nikFocusNode.requestFocus();
|
||||
return 'NIK Harus Terisi';
|
||||
} else if (value.length < 16) {
|
||||
controller.nikFocusNode.requestFocus();
|
||||
return 'NIK Harus 16 Karakter';
|
||||
}
|
||||
return null;
|
||||
},
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 15,
|
||||
),
|
||||
EnsureVisibleWhenFocused(
|
||||
focusNode: controller.namaFocusNode,
|
||||
child: TextFormField(
|
||||
//focus node
|
||||
focusNode: controller.namaFocusNode,
|
||||
controller: controller.namaController,
|
||||
decoration: InputDecoration(
|
||||
hintText: 'Nama Sesuai KTP',
|
||||
labelText: 'Nama',
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
borderSide: const BorderSide(
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
),
|
||||
validator: (value) {
|
||||
if (value!.isEmpty) {
|
||||
controller.namaFocusNode.requestFocus();
|
||||
return 'Nama Harus Terisi \n Sesuai Nama Di KTP';
|
||||
}
|
||||
return null;
|
||||
},
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 15,
|
||||
),
|
||||
EnsureVisibleWhenFocused(
|
||||
focusNode: controller.emailFocusNode,
|
||||
child: TextFormField(
|
||||
//focus node
|
||||
focusNode: controller.emailFocusNode,
|
||||
controller: controller.emailController,
|
||||
decoration: InputDecoration(
|
||||
hintText: 'Email',
|
||||
labelText: 'Email',
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
borderSide: const BorderSide(
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
),
|
||||
validator: (value) {
|
||||
// log(controller
|
||||
// .email_checker(value!)
|
||||
// .toString());
|
||||
if (value!.isEmpty) {
|
||||
controller.emailFocusNode.requestFocus();
|
||||
return 'Email Harus Terisi \n Untuk Konfimasi Pendaftaran Akun \n Pastikan Gunakan Email Yang Valid';
|
||||
} else if (!controller.email_checker(value)) {
|
||||
controller.emailFocusNode.requestFocus();
|
||||
return 'Email Tidak Valid';
|
||||
}
|
||||
return null;
|
||||
},
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 15,
|
||||
),
|
||||
EnsureVisibleWhenFocused(
|
||||
focusNode: controller.noTelpFocusNode,
|
||||
child: TextFormField(
|
||||
//focus node
|
||||
focusNode: controller.noTelpFocusNode,
|
||||
controller: controller.noTelpController,
|
||||
maxLength: 13,
|
||||
keyboardType: TextInputType.number,
|
||||
inputFormatters: [
|
||||
FilteringTextInputFormatter.allow(
|
||||
RegExp(r'[0-9]'),
|
||||
),
|
||||
],
|
||||
decoration: InputDecoration(
|
||||
hintText: 'No Telpon',
|
||||
labelText: 'No Telpon',
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
borderSide: const BorderSide(
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
),
|
||||
validator: (value) {
|
||||
if (value!.isEmpty) {
|
||||
controller.noTelpFocusNode.requestFocus();
|
||||
return 'No Telpon Harus Terisi \n Dengan Nomor Yang Valid';
|
||||
} else if (value.length < 11) {
|
||||
controller.noTelpFocusNode.requestFocus();
|
||||
return 'No Telpon Minimal Harus 11 Karakter';
|
||||
// ignore: unrelated_type_equality_checks
|
||||
} else if (int.parse(value[0]) != 0 &&
|
||||
// ignore: unrelated_type_equality_checks
|
||||
int.parse(value[1]) != 8) {
|
||||
controller.noTelpFocusNode.requestFocus();
|
||||
return 'Format No Telpon Tidak Valid';
|
||||
}
|
||||
return null;
|
||||
},
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 15,
|
||||
),
|
||||
EnsureVisibleWhenFocused(
|
||||
focusNode: controller.alamatFocusNode,
|
||||
child: TextFormField(
|
||||
//focus node
|
||||
focusNode: controller.alamatFocusNode,
|
||||
controller: controller.alamatController,
|
||||
decoration: InputDecoration(
|
||||
hintText: 'Alamat',
|
||||
labelText: 'Alamat',
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
borderSide: const BorderSide(
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
),
|
||||
validator: (value) {
|
||||
if (value!.isEmpty) {
|
||||
controller.alamatFocusNode.requestFocus();
|
||||
return 'Alamat Harus Terisi';
|
||||
}
|
||||
return null;
|
||||
},
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 15,
|
||||
),
|
||||
EnsureVisibleWhenFocused(
|
||||
focusNode: controller.noPlatFocusNode,
|
||||
child: TextFormField(
|
||||
//focus node
|
||||
focusNode: controller.noPlatFocusNode,
|
||||
controller: controller.noPlatController,
|
||||
decoration: InputDecoration(
|
||||
hintText: 'No Plat Kenderaan',
|
||||
labelText: 'No Plat Kenderaan',
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
borderSide: const BorderSide(
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
),
|
||||
validator: (value) {
|
||||
if (value!.isEmpty) {
|
||||
controller.noPlatFocusNode.requestFocus();
|
||||
return 'No Plat Kenderaan Harus Terisi';
|
||||
}
|
||||
return null;
|
||||
},
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 15,
|
||||
),
|
||||
Obx(
|
||||
() => GestureDetector(
|
||||
onTap: () {
|
||||
FocusScope.of(context).unfocus();
|
||||
// log("sini ontap foto profil");
|
||||
controller.onChooseOption('profil');
|
||||
},
|
||||
onDoubleTap: () => [
|
||||
controller.isAdaFotoProfil.value
|
||||
? controller.showFoto('profil')
|
||||
: log("tidak ada profil"),
|
||||
FocusScope.of(context).unfocus()
|
||||
],
|
||||
child: EnsureVisibleWhenFocused(
|
||||
focusNode: controller.fotoProfilFocusNode,
|
||||
child: TextFormField(
|
||||
//focus node
|
||||
focusNode: controller.fotoProfilFocusNode,
|
||||
initialValue: '',
|
||||
enabled: false,
|
||||
decoration: InputDecoration(
|
||||
labelText: controller.isAdaFotoProfil.value
|
||||
? 'Klik 2x Untuk Melihat Foto Profil'
|
||||
: 'Foto Profil Belum Di Upload',
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
borderSide: const BorderSide(
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
errorStyle: const TextStyle(
|
||||
color: Colors.red,
|
||||
// fontSize: 12,
|
||||
),
|
||||
),
|
||||
validator: (value) {
|
||||
if (!controller.isAdaFotoProfil.value) {
|
||||
FocusScope.of(context).unfocus();
|
||||
controller.fotoProfilFocusNode
|
||||
.requestFocus();
|
||||
return 'Foto Profil Belum Di Upload\nKlik Field Ini Untuk Upload Foto Profil';
|
||||
}
|
||||
return null;
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 15,
|
||||
),
|
||||
Obx(
|
||||
() => GestureDetector(
|
||||
onTap: () {
|
||||
FocusScope.of(context).unfocus();
|
||||
// log("sini ontap foto");
|
||||
controller.onChooseOption('ktp');
|
||||
},
|
||||
onDoubleTap: () => [
|
||||
controller.isAdaFotoKTP.value
|
||||
? controller.showFoto('ktp')
|
||||
: log("tidak ada foto"),
|
||||
FocusScope.of(context).unfocus()
|
||||
],
|
||||
child: EnsureVisibleWhenFocused(
|
||||
focusNode: controller.fotoKTPFocusNode,
|
||||
child: TextFormField(
|
||||
//focus node
|
||||
focusNode: controller.fotoKTPFocusNode,
|
||||
initialValue: '',
|
||||
enabled: false,
|
||||
decoration: InputDecoration(
|
||||
labelText: controller.isAdaFotoKTP.value
|
||||
? 'Klik 2x Untuk Melihat Foto KTP'
|
||||
: 'Foto KTP Belum Di Upload',
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
borderSide: const BorderSide(
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
errorStyle: const TextStyle(
|
||||
color: Colors.red,
|
||||
// fontSize: 12,
|
||||
),
|
||||
),
|
||||
validator: (value) {
|
||||
if (!controller.isAdaFotoKTP.value) {
|
||||
FocusScope.of(context).unfocus();
|
||||
controller.fotoKTPFocusNode
|
||||
.requestFocus();
|
||||
return 'Foto KTP Belum Di Upload\nKlik Field Ini Untuk Upload Foto KTP';
|
||||
}
|
||||
return null;
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 15,
|
||||
),
|
||||
Obx(
|
||||
() => GestureDetector(
|
||||
onTap: () {
|
||||
FocusScope.of(context).unfocus();
|
||||
// log("sini ontap ktp holding");
|
||||
controller.onChooseOption('ktp_holding');
|
||||
},
|
||||
onDoubleTap: () => [
|
||||
controller.isAdaFotoKTPHolding.value
|
||||
? controller.showFoto('ktp_holding')
|
||||
: log("tidak ada foto"),
|
||||
FocusScope.of(context).unfocus()
|
||||
],
|
||||
child: EnsureVisibleWhenFocused(
|
||||
focusNode: controller.fotoHoldingKTPFocusNode,
|
||||
child: TextFormField(
|
||||
//focus node
|
||||
focusNode: controller.fotoHoldingKTPFocusNode,
|
||||
enabled: false,
|
||||
initialValue: '',
|
||||
decoration: InputDecoration(
|
||||
labelText: controller
|
||||
.isAdaFotoKTPHolding.value
|
||||
? 'Klik 2x Untuk Melihat Foto Memegang KTP'
|
||||
: 'Foto Memegang KTP ',
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
borderSide: const BorderSide(
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
errorStyle: const TextStyle(
|
||||
color: Colors.red,
|
||||
// fontSize: 12,
|
||||
),
|
||||
),
|
||||
validator: (value) {
|
||||
if (!controller.isAdaFotoKTPHolding.value) {
|
||||
FocusScope.of(context).unfocus();
|
||||
controller.fotoHoldingKTPFocusNode
|
||||
.requestFocus();
|
||||
return 'Foto Memegang KTP Belum Di Upload\nKlik Field Ini Untuk Upload Foto Memegang KTP';
|
||||
}
|
||||
return null;
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 15,
|
||||
),
|
||||
Obx(
|
||||
() => GestureDetector(
|
||||
onTap: () {
|
||||
FocusScope.of(context).unfocus();
|
||||
// log("sini ontap kendaraan");
|
||||
controller.onChooseOption('kendaraan');
|
||||
},
|
||||
onDoubleTap: () => [
|
||||
controller.isAdaKenderaan.value
|
||||
? controller.showFoto('kendaraan')
|
||||
: log("tidak ada foto"),
|
||||
FocusScope.of(context).unfocus()
|
||||
],
|
||||
child: EnsureVisibleWhenFocused(
|
||||
focusNode: controller.fotoKendaraanFocusNode,
|
||||
child: TextFormField(
|
||||
//focus node
|
||||
focusNode: controller.fotoKendaraanFocusNode,
|
||||
enabled: false,
|
||||
initialValue: '',
|
||||
decoration: InputDecoration(
|
||||
labelText: controller.isAdaKenderaan.value
|
||||
? 'Klik 2x Untuk Melihat Foto Kendaraan'
|
||||
: 'Foto Kendaraan ',
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
borderSide: const BorderSide(
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
errorStyle: const TextStyle(
|
||||
color: Colors.red,
|
||||
// fontSize: 12,
|
||||
),
|
||||
),
|
||||
validator: (value) {
|
||||
if (!controller.isAdaKenderaan.value) {
|
||||
FocusScope.of(context).unfocus();
|
||||
controller.fotoKendaraanFocusNode
|
||||
.requestFocus();
|
||||
return 'Foto Kendaraan Belum Di Upload\nKlik Field Ini Untuk Upload Foto Kendaraan';
|
||||
}
|
||||
return null;
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: MediaQuery.of(context).size.height * 0.03,
|
||||
),
|
||||
SizedBox(
|
||||
width: MediaQuery.of(context).size.width * 0.3,
|
||||
child: ElevatedButton(
|
||||
onPressed: () {
|
||||
if (controller.formKey.currentState!.validate()) {
|
||||
FocusScope.of(context).unfocus();
|
||||
// log("jalankan");
|
||||
controller.before_sign_up();
|
||||
} else {
|
||||
Get.snackbar(
|
||||
'Error',
|
||||
'Mohon Lengkapi Data',
|
||||
icon: const Icon(
|
||||
Icons.error,
|
||||
color: Colors.white,
|
||||
),
|
||||
backgroundColor: Colors.orange[400],
|
||||
colorText: Colors.white,
|
||||
);
|
||||
}
|
||||
},
|
||||
child: const Text('Daftar'),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: MediaQuery.of(context).size.height * 0.03,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
431
lib/pages/before_login/pendaftaran_pengirirm.dart
Normal file
431
lib/pages/before_login/pendaftaran_pengirirm.dart
Normal file
@ -0,0 +1,431 @@
|
||||
import 'dart:developer';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:kurir/controller/before_login/pendaftaranPengirimController.dart';
|
||||
import 'package:kurir/widgets/boxBackgroundDecoration.dart';
|
||||
import 'package:kurir/widgets/focusToTextFormField.dart';
|
||||
import 'package:kurir/widgets/ourContainer.dart';
|
||||
|
||||
class PendaftaranPengirimPage extends GetView<PendaftaranPengirimController> {
|
||||
const PendaftaranPengirimPage({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return WillPopScope(
|
||||
onWillPop: () async => controller.willPopScopeWidget(),
|
||||
child: Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text('Pendaftaran Pengirim'),
|
||||
actions: [
|
||||
IconButton(
|
||||
onPressed: () => controller.intro_message(),
|
||||
icon: const Icon(Icons.info_outline),
|
||||
),
|
||||
],
|
||||
),
|
||||
body: BoxBackgroundDecoration(
|
||||
child: SingleChildScrollView(
|
||||
child: Center(
|
||||
child: Form(
|
||||
key: controller.formKey,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
SizedBox(
|
||||
height: MediaQuery.of(context).size.height * 0.03,
|
||||
),
|
||||
OurContainer(
|
||||
child: Column(
|
||||
children: [
|
||||
SizedBox(
|
||||
height: MediaQuery.of(context).size.height * 0.01,
|
||||
),
|
||||
const Text(
|
||||
'Pendaftaran Pengirim',
|
||||
style: TextStyle(
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 15,
|
||||
),
|
||||
EnsureVisibleWhenFocused(
|
||||
focusNode: controller.usernameFocusNode,
|
||||
child: TextFormField(
|
||||
focusNode: controller.usernameFocusNode,
|
||||
controller: controller.usernameController,
|
||||
decoration: InputDecoration(
|
||||
hintText: 'Username',
|
||||
labelText: 'Username',
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
borderSide: const BorderSide(
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
),
|
||||
validator: (value) {
|
||||
if (value!.isEmpty) {
|
||||
// request focus
|
||||
controller.usernameFocusNode.requestFocus();
|
||||
return 'Username Harus Terisi';
|
||||
} else if (value.length < 6) {
|
||||
return 'Username Minimal 6 Karakter';
|
||||
}
|
||||
return null;
|
||||
},
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 15,
|
||||
),
|
||||
Obx(
|
||||
() => EnsureVisibleWhenFocused(
|
||||
focusNode: controller.passwordFocusNode,
|
||||
child: TextFormField(
|
||||
//focus node
|
||||
focusNode: controller.passwordFocusNode,
|
||||
controller: controller.passwordController,
|
||||
obscureText: !controller.passwordVisible.value,
|
||||
decoration: InputDecoration(
|
||||
hintText: 'Password',
|
||||
labelText: 'Password',
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
borderSide: const BorderSide(
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
suffixIcon: IconButton(
|
||||
icon: Icon(
|
||||
Icons.remove_red_eye,
|
||||
color: controller.passwordVisible.value
|
||||
? Colors.black
|
||||
: Colors.grey,
|
||||
),
|
||||
onPressed: () {
|
||||
controller.passwordVisible.value =
|
||||
!controller.passwordVisible.value;
|
||||
},
|
||||
),
|
||||
),
|
||||
validator: (value) {
|
||||
// log(value!.length.toString() +
|
||||
// "ini panjangnya");
|
||||
if (value!.isEmpty) {
|
||||
controller.passwordFocusNode.requestFocus();
|
||||
return 'Password Harus Terisi';
|
||||
} else if (value.length < 8) {
|
||||
controller.passwordFocusNode.requestFocus();
|
||||
return 'Password Minimal 8 Karakter';
|
||||
} else if (value.toString() !=
|
||||
controller
|
||||
.konfirmasiPasswordController.text
|
||||
.toString()) {
|
||||
controller.passwordFocusNode.requestFocus();
|
||||
return 'Password tidak sama dengan konfirmasi password';
|
||||
}
|
||||
return null;
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 15,
|
||||
),
|
||||
Obx(
|
||||
() => EnsureVisibleWhenFocused(
|
||||
focusNode: controller.konfirmasiPasswordFocusNode,
|
||||
child: TextFormField(
|
||||
//focus node
|
||||
focusNode:
|
||||
controller.konfirmasiPasswordFocusNode,
|
||||
controller:
|
||||
controller.konfirmasiPasswordController,
|
||||
obscureText:
|
||||
!controller.konfirmasiPasswordVisible.value,
|
||||
decoration: InputDecoration(
|
||||
hintText: 'Konfirmasi Password',
|
||||
labelText: 'Konfirmasi Password',
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
borderSide: const BorderSide(
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
suffixIcon: IconButton(
|
||||
icon: Icon(
|
||||
Icons.remove_red_eye,
|
||||
color: controller
|
||||
.konfirmasiPasswordVisible.value
|
||||
? Colors.black
|
||||
: Colors.grey,
|
||||
),
|
||||
onPressed: () {
|
||||
controller
|
||||
.konfirmasiPasswordVisible.value =
|
||||
!controller
|
||||
.konfirmasiPasswordVisible.value;
|
||||
},
|
||||
),
|
||||
),
|
||||
validator: (value) {
|
||||
// log('konfirmasi pasword = $value');
|
||||
if (value!.isEmpty) {
|
||||
controller.konfirmasiPasswordFocusNode
|
||||
.requestFocus();
|
||||
return 'Konfirmasi Password Harus Terisi';
|
||||
} else if (value.toString() !=
|
||||
controller.passwordController.text
|
||||
.toString()) {
|
||||
controller.konfirmasiPasswordFocusNode
|
||||
.requestFocus();
|
||||
return 'Password tidak sama dengan konfirmasi password';
|
||||
}
|
||||
return null;
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: MediaQuery.of(context).size.height * 0.03,
|
||||
),
|
||||
OurContainer(
|
||||
child: Column(
|
||||
children: [
|
||||
SizedBox(
|
||||
height: MediaQuery.of(context).size.height * 0.01,
|
||||
),
|
||||
const Text(
|
||||
'Detail Pengirim',
|
||||
style: TextStyle(
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 15,
|
||||
),
|
||||
EnsureVisibleWhenFocused(
|
||||
focusNode: controller.namaFocusNode,
|
||||
child: TextFormField(
|
||||
focusNode: controller.namaFocusNode,
|
||||
controller: controller.namaController,
|
||||
decoration: InputDecoration(
|
||||
hintText: 'Masukkan Nama',
|
||||
labelText: 'Nama',
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
borderSide: const BorderSide(
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
),
|
||||
validator: (value) {
|
||||
if (value!.isEmpty) {
|
||||
// request focus
|
||||
controller.usernameFocusNode.requestFocus();
|
||||
return 'Nama Harus Terisi';
|
||||
}
|
||||
return null;
|
||||
},
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 15,
|
||||
),
|
||||
EnsureVisibleWhenFocused(
|
||||
focusNode: controller.emailFocusNode,
|
||||
child: TextFormField(
|
||||
focusNode: controller.emailFocusNode,
|
||||
controller: controller.emailController,
|
||||
decoration: InputDecoration(
|
||||
hintText: 'Masukkan Email',
|
||||
labelText: 'Email',
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
borderSide: const BorderSide(
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
),
|
||||
validator: (value) {
|
||||
if (value!.isEmpty) {
|
||||
// request focus
|
||||
controller.emailFocusNode.requestFocus();
|
||||
return 'Email Harus Terisi';
|
||||
} else if (controller
|
||||
.email_checker(value.toString()) ==
|
||||
false) {
|
||||
controller.emailFocusNode.requestFocus();
|
||||
return 'Email Tidak Valid';
|
||||
}
|
||||
return null;
|
||||
},
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 15,
|
||||
),
|
||||
EnsureVisibleWhenFocused(
|
||||
focusNode: controller.noTelpFocusNode,
|
||||
child: TextFormField(
|
||||
//focus node
|
||||
focusNode: controller.noTelpFocusNode,
|
||||
controller: controller.noTelpController,
|
||||
maxLength: 13,
|
||||
keyboardType: TextInputType.number,
|
||||
inputFormatters: [
|
||||
FilteringTextInputFormatter.allow(
|
||||
RegExp(r'[0-9]'),
|
||||
),
|
||||
],
|
||||
decoration: InputDecoration(
|
||||
hintText: ' Masukkan No Telpon',
|
||||
labelText: 'No Telpon',
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
borderSide: const BorderSide(
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
),
|
||||
validator: (value) {
|
||||
if (value!.isEmpty) {
|
||||
controller.noTelpFocusNode.requestFocus();
|
||||
return 'No Telpon Harus Terisi \n Dengan Nomor Yang Valid';
|
||||
} else if (value.length < 11) {
|
||||
controller.noTelpFocusNode.requestFocus();
|
||||
return 'No Telpon Minimal Harus 11 Karakter';
|
||||
// ignore: unrelated_type_equality_checks
|
||||
} else if (int.parse(value[0]) != 0 &&
|
||||
// ignore: unrelated_type_equality_checks
|
||||
int.parse(value[1]) != 8) {
|
||||
controller.noTelpFocusNode.requestFocus();
|
||||
return 'Format No Telpon Tidak Valid';
|
||||
}
|
||||
return null;
|
||||
},
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 15,
|
||||
),
|
||||
EnsureVisibleWhenFocused(
|
||||
focusNode: controller.alamatFocusNode,
|
||||
child: TextFormField(
|
||||
//focus node
|
||||
focusNode: controller.alamatFocusNode,
|
||||
controller: controller.alamatController,
|
||||
decoration: InputDecoration(
|
||||
hintText: ' Masukkan Alamat',
|
||||
labelText: 'Alamat',
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
borderSide: const BorderSide(
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
),
|
||||
validator: (value) {
|
||||
if (value!.isEmpty) {
|
||||
controller.alamatFocusNode.requestFocus();
|
||||
return 'Alamat Harus Terisi';
|
||||
}
|
||||
return null;
|
||||
},
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 15,
|
||||
),
|
||||
Obx(
|
||||
() => GestureDetector(
|
||||
onTap: () {
|
||||
FocusScope.of(context).unfocus();
|
||||
// log("sini ontap foto profil");
|
||||
controller.onChooseOption('profil');
|
||||
},
|
||||
onDoubleTap: () => [
|
||||
controller.isAdaFotoProfil.value
|
||||
? controller.showFoto('profil')
|
||||
: log("tidak ada profil"),
|
||||
FocusScope.of(context).unfocus()
|
||||
],
|
||||
child: TextFormField(
|
||||
initialValue: '',
|
||||
enabled: false,
|
||||
decoration: InputDecoration(
|
||||
labelText: controller.isAdaFotoProfil.value
|
||||
? 'Klik 2x Untuk Melihat Foto Profil'
|
||||
: 'Foto Profil Belum Di Upload',
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
borderSide: const BorderSide(
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
errorStyle: const TextStyle(
|
||||
color: Colors.red,
|
||||
// fontSize: 12,
|
||||
),
|
||||
),
|
||||
validator: (value) {
|
||||
if (!controller.isAdaFotoProfil.value) {
|
||||
FocusScope.of(context).unfocus();
|
||||
return 'Foto Profil Belum Di Upload\nKlik Field Ini Untuk Upload Foto Profil';
|
||||
}
|
||||
return null;
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: MediaQuery.of(context).size.height * 0.03,
|
||||
),
|
||||
SizedBox(
|
||||
width: MediaQuery.of(context).size.width * 0.3,
|
||||
child: ElevatedButton(
|
||||
onPressed: () {
|
||||
if (controller.formKey.currentState!.validate()) {
|
||||
FocusScope.of(context).unfocus();
|
||||
// log("jalankan");
|
||||
controller.before_sign_up(context);
|
||||
} else {
|
||||
Get.snackbar(
|
||||
'Error',
|
||||
'Mohon Lengkapi Data',
|
||||
icon: const Icon(
|
||||
Icons.error,
|
||||
color: Colors.white,
|
||||
),
|
||||
backgroundColor: Colors.orange[400],
|
||||
colorText: Colors.white,
|
||||
);
|
||||
}
|
||||
},
|
||||
child: const Text('Daftar'),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: MediaQuery.of(context).size.height * 0.03,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user