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,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'),
),
),
);
}
}