slight changes

This commit is contained in:
kicap1992
2022-10-14 08:17:20 +08:00
parent f50fd64fff
commit ee50f73e3c
9 changed files with 181 additions and 24 deletions

6
.env
View File

@ -1 +1,5 @@
URL=http://192.168.189.237:9000/ URL=http://192.168.218.237:9000/
# URL=http://192.168.12.227:9000/
# URL=https://garis-tangan-lagi.herokuapp.com/
# URL=http://garis-tangan1.kicap-karan.com/
# URL=https://garistangan-serov.pitunnel.com/

View File

@ -26,7 +26,8 @@ apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android { android {
compileSdkVersion flutter.compileSdkVersion // compileSdkVersion flutter.compileSdkVersion
compileSdkVersion 33
ndkVersion flutter.ndkVersion ndkVersion flutter.ndkVersion
compileOptions { compileOptions {

View File

@ -1,5 +1,8 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.cek_tapak_tangan"> package="com.example.cek_tapak_tangan">
<uses-permission android:name="android.permission.CAMERA" />
<uses-feature android:name="android.hardware.camera" />
<uses-permission android:name="android.permission.INTERNET"/>
<application <application
android:label="cek_tapak_tangan" android:label="cek_tapak_tangan"
android:name="${applicationName}" android:name="${applicationName}"

View File

@ -26,6 +26,11 @@ class _AmbilFotoState extends State<AmbilFoto> {
Uint8List? imagebytes; Uint8List? imagebytes;
String? ramalannya; String? ramalannya;
List<String> gender = ['Laki-laki', 'Perempuan'];
String genderValue = 'Laki-laki';
List<String> umur = ['Anak-anak', 'Dewasa', 'Lanjut Usia'];
String umurValue = 'Anak-anak';
@override @override
void initState() { void initState() {
super.initState(); super.initState();
@ -49,7 +54,8 @@ class _AmbilFotoState extends State<AmbilFoto> {
}); });
} }
await EasyLoading.show( await EasyLoading.show(
status: "Periksa Foto", // status: "Periksa Foto",
status: "Membaca Garis Tangan Dari Telapak Tangan Kiri Anda",
maskType: EasyLoadingMaskType.black, maskType: EasyLoadingMaskType.black,
); );
Map? cekFoto = await ApiServices.cekFoto(_imgPath); Map? cekFoto = await ApiServices.cekFoto(_imgPath);
@ -57,25 +63,26 @@ class _AmbilFotoState extends State<AmbilFoto> {
// dev.i(cekFoto); // dev.i(cekFoto);
if (cekFoto!['status'] == 500) return mySnackBar(cekFoto['message'], 1); if (cekFoto!['status'] == 500) return mySnackBar(cekFoto['message'], 1);
if (cekFoto['status'] == 404) return mySnackBar(cekFoto['message'], 2); if (cekFoto['status'] == 404) return mySnackBar(cekFoto['message'], 2);
await EasyLoading.show( // await EasyLoading.show(
status: "Membaca Garis Tangan Dari Telapak Tangan Kiri Anda", // status: "Membaca Garis Tangan Dari Telapak Tangan Kiri Anda",
maskType: EasyLoadingMaskType.black, // maskType: EasyLoadingMaskType.black,
); // );
setState(() { // setState(() {
ramalannya = null; // ramalannya = null;
}); // });
Map? cekRamalan = await ApiServices.cekRamalan(_imgPath); // Map? cekRamalan = await ApiServices.cekRamalan(_imgPath);
await EasyLoading.dismiss(); // await EasyLoading.dismiss();
// dev.i(cekFoto); // // dev.i(cekFoto);
if (cekRamalan!['status'] == 500) { // if (cekRamalan!['status'] == 500) {
return mySnackBar(cekRamalan['message'], 1); // return mySnackBar(cekRamalan['message'], 1);
} // }
if (cekRamalan['status'] == 404) { // if (cekRamalan['status'] == 404) {
return mySnackBar(cekRamalan['message'], 2); // return mySnackBar(cekRamalan['message'], 2);
} // }
setState(() { setState(() {
ramalannya = cekRamalan['message']; ramalannya = cekFoto['message'];
// ramalannya = cekRamalan['message'];
}); });
await EasyLoading.dismiss(); await EasyLoading.dismiss();
@ -218,6 +225,108 @@ class _AmbilFotoState extends State<AmbilFoto> {
const SizedBox( const SizedBox(
height: 10, height: 10,
), ),
SizedBox(
child: DropdownButtonFormField(
decoration: InputDecoration(
labelText: 'Jenis Kelamin',
labelStyle: const TextStyle(
color: ThemeInfo.primary,
),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(30),
borderSide: const BorderSide(
color: ThemeInfo.primary,
),
),
enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(30),
borderSide: const BorderSide(
color: ThemeInfo.primary,
width: 1,
),
),
focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(30),
borderSide: const BorderSide(
color: ThemeInfo.primary,
width: 1,
),
),
),
value: genderValue,
items: gender.map((String value) {
return DropdownMenuItem(
value: value,
child: Text(
value,
style: const TextStyle(
color: ThemeInfo.primary,
),
),
);
}).toList(),
onChanged: (item) {
// log(item.toString() + " ini item");
setState(() {
genderValue = item.toString();
});
},
),
),
const SizedBox(
height: 10,
),
SizedBox(
child: DropdownButtonFormField(
decoration: InputDecoration(
labelText: 'Umur',
labelStyle: const TextStyle(
color: ThemeInfo.primary,
),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(30),
borderSide: const BorderSide(
color: ThemeInfo.primary,
),
),
enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(30),
borderSide: const BorderSide(
color: ThemeInfo.primary,
width: 1,
),
),
focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(30),
borderSide: const BorderSide(
color: ThemeInfo.primary,
width: 1,
),
),
),
value: umurValue,
items: umur.map((String value) {
return DropdownMenuItem(
value: value,
child: Text(
value,
style: const TextStyle(
color: ThemeInfo.primary,
),
),
);
}).toList(),
onChanged: (item) {
// log(item.toString() + " ini item");
setState(() {
umurValue = item.toString();
});
},
),
),
const SizedBox(
height: 10,
),
ElevatedButton( ElevatedButton(
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
backgroundColor: ThemeInfo.primary, backgroundColor: ThemeInfo.primary,

View File

@ -7,11 +7,12 @@ import 'package:path/path.dart';
class ApiServices { class ApiServices {
static final dev = Logger(); static final dev = Logger();
static final url = dotenv.env['URL']; static final url = dotenv.env['URL'];
// static final url = "http://192.168.218.21:9000/";
static final options = BaseOptions( static final options = BaseOptions(
baseUrl: url!, baseUrl: url!,
connectTimeout: 5000, connectTimeout: 120000,
receiveTimeout: 5000, receiveTimeout: 120000,
); );
static Dio dio = Dio(options); static Dio dio = Dio(options);

View File

@ -331,6 +331,41 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.1.3" version: "2.1.3"
permission_handler:
dependency: "direct main"
description:
name: permission_handler
url: "https://pub.dartlang.org"
source: hosted
version: "10.1.0"
permission_handler_android:
dependency: transitive
description:
name: permission_handler_android
url: "https://pub.dartlang.org"
source: hosted
version: "10.1.0"
permission_handler_apple:
dependency: transitive
description:
name: permission_handler_apple
url: "https://pub.dartlang.org"
source: hosted
version: "9.0.6"
permission_handler_platform_interface:
dependency: transitive
description:
name: permission_handler_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "3.9.0"
permission_handler_windows:
dependency: transitive
description:
name: permission_handler_windows
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.1"
platform: platform:
dependency: transitive dependency: transitive
description: description:

View File

@ -50,7 +50,7 @@ dependencies:
http_parser: http_parser:
path: path:
animated_snack_bar: animated_snack_bar:
permission_handler:
dev_dependencies: dev_dependencies:
flutter_test: flutter_test:

View File

@ -6,6 +6,9 @@
#include "generated_plugin_registrant.h" #include "generated_plugin_registrant.h"
#include <permission_handler_windows/permission_handler_windows_plugin.h>
void RegisterPlugins(flutter::PluginRegistry* registry) { void RegisterPlugins(flutter::PluginRegistry* registry) {
PermissionHandlerWindowsPluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("PermissionHandlerWindowsPlugin"));
} }

View File

@ -3,6 +3,7 @@
# #
list(APPEND FLUTTER_PLUGIN_LIST list(APPEND FLUTTER_PLUGIN_LIST
permission_handler_windows
) )
list(APPEND FLUTTER_FFI_PLUGIN_LIST list(APPEND FLUTTER_FFI_PLUGIN_LIST