added qrcode generator and qrcode scanner, create the kurir profile page
This commit is contained in:
@ -1,16 +1,57 @@
|
||||
// ignore_for_file: file_names
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'dart:developer';
|
||||
|
||||
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
||||
import 'package:kurir/api/beforeLoginAPI.dart';
|
||||
import 'package:kurir/api/kurirApi.dart';
|
||||
import 'package:kurir/models/usersModel.dart';
|
||||
import 'package:logger/logger.dart';
|
||||
|
||||
class KurirProfileController extends GetxController {
|
||||
@override
|
||||
void onInit() {
|
||||
log("sini profile kurir controller oninit");
|
||||
super.onInit();
|
||||
final dev = Logger();
|
||||
|
||||
Rx<KurirModel> kurirModel = Rx<KurirModel>(KurirModel());
|
||||
RxInt loading = 0.obs;
|
||||
RxString error = RxString("");
|
||||
|
||||
void cekProfile() async {
|
||||
dev.i("sini cek profile");
|
||||
loading.value = 0;
|
||||
final _api = Get.put(KurirApi());
|
||||
Map<String, dynamic> _data = await _api.profileKurir2();
|
||||
if (_data['status'] == 200) {
|
||||
dev.i("sini dia");
|
||||
kurirModel.value = KurirModel.fromJson(_data['data']);
|
||||
loading.value = 1;
|
||||
} else {
|
||||
loading.value = 2;
|
||||
error.value = _data['message'];
|
||||
}
|
||||
}
|
||||
|
||||
lihatFoto(BuildContext context, String foto, String title) {
|
||||
if (foto != "") {
|
||||
Get.dialog(
|
||||
_FotoDialogBox(
|
||||
foto: foto,
|
||||
title: title,
|
||||
),
|
||||
);
|
||||
} else {
|
||||
Get.snackbar(
|
||||
"Info",
|
||||
"Foto Barang Pengiriman Masih Dalam Proses Upload",
|
||||
icon: const Icon(
|
||||
Icons.info_outline_rounded,
|
||||
color: Colors.white,
|
||||
),
|
||||
backgroundColor: const Color.fromARGB(255, 71, 203, 240),
|
||||
duration: const Duration(seconds: 3),
|
||||
snackPosition: SnackPosition.TOP,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
logout() async {
|
||||
@ -30,3 +71,73 @@ class KurirProfileController extends GetxController {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _FotoDialogBox extends StatelessWidget {
|
||||
const _FotoDialogBox({
|
||||
Key? key,
|
||||
required this.foto,
|
||||
required this.title,
|
||||
}) : super(key: key);
|
||||
|
||||
final String foto;
|
||||
final String title;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return AlertDialog(
|
||||
backgroundColor: const Color.fromARGB(255, 104, 164, 164),
|
||||
title: Text(
|
||||
title,
|
||||
style: const TextStyle(color: Colors.white),
|
||||
),
|
||||
content: Container(
|
||||
height: Get.height * 0.5,
|
||||
width: Get.width * 0.6,
|
||||
decoration: const BoxDecoration(
|
||||
borderRadius: BorderRadius.all(
|
||||
Radius.circular(20),
|
||||
),
|
||||
color: Colors.white,
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.grey,
|
||||
spreadRadius: 1,
|
||||
blurRadius: 10,
|
||||
),
|
||||
],
|
||||
),
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
child: Container(
|
||||
decoration: const BoxDecoration(
|
||||
image: DecorationImage(
|
||||
image: AssetImage('assets/loading.gif'),
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
// child: Container(
|
||||
// decoration: BoxDecoration(
|
||||
// image: DecorationImage(
|
||||
// image: NetworkImage(foto),
|
||||
// fit: BoxFit.cover,
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
child: Image.network(
|
||||
foto,
|
||||
fit: BoxFit.cover,
|
||||
errorBuilder: (context, error, stackTrace) {
|
||||
return const Center(
|
||||
child: Icon(
|
||||
Icons.error,
|
||||
color: Colors.black,
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user