Fakultas Ilmu Komputer UI

Commit d02cd736 authored by Manuel Yoseph Ray's avatar Manuel Yoseph Ray
Browse files

[REFACTOR] mengubah code kriteria password

parent 2ed7172b
Pipeline #77257 failed with stages
in 6 minutes and 35 seconds
This diff is collapsed.
This diff is collapsed.
# This is a generated file; do not edit or check into version control.
flutter_keyboard_visibility=/Users/ferdisungkar/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_keyboard_visibility-5.0.0/
flutter_keyboard_visibility_web=/Users/ferdisungkar/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_keyboard_visibility_web-2.0.0/
flutter_plugin_android_lifecycle=/Users/ferdisungkar/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_plugin_android_lifecycle-2.0.1/
flutter_secure_storage=/Users/ferdisungkar/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_secure_storage-3.3.5/
image_picker=/Users/ferdisungkar/flutter/.pub-cache/hosted/pub.dartlang.org/image_picker-0.7.4/
image_picker_for_web=/Users/ferdisungkar/flutter/.pub-cache/hosted/pub.dartlang.org/image_picker_for_web-2.0.0/
path_provider=/Users/ferdisungkar/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider-2.0.1/
path_provider_linux=/Users/ferdisungkar/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_linux-2.0.0/
path_provider_macos=/Users/ferdisungkar/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_macos-2.0.0/
path_provider_windows=/Users/ferdisungkar/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_windows-2.0.0/
flutter_keyboard_visibility=C:\\src\\flutter\\.pub-cache\\hosted\\pub.dartlang.org\\flutter_keyboard_visibility-5.0.0\\
flutter_keyboard_visibility_web=C:\\src\\flutter\\.pub-cache\\hosted\\pub.dartlang.org\\flutter_keyboard_visibility_web-2.0.0\\
flutter_plugin_android_lifecycle=C:\\src\\flutter\\.pub-cache\\hosted\\pub.dartlang.org\\flutter_plugin_android_lifecycle-2.0.1\\
flutter_secure_storage=C:\\src\\flutter\\.pub-cache\\hosted\\pub.dartlang.org\\flutter_secure_storage-3.3.5\\
image_picker=C:\\src\\flutter\\.pub-cache\\hosted\\pub.dartlang.org\\image_picker-0.7.4\\
image_picker_for_web=C:\\src\\flutter\\.pub-cache\\hosted\\pub.dartlang.org\\image_picker_for_web-2.0.0\\
path_provider=C:\\src\\flutter\\.pub-cache\\hosted\\pub.dartlang.org\\path_provider-2.0.1\\
path_provider_linux=C:\\src\\flutter\\.pub-cache\\hosted\\pub.dartlang.org\\path_provider_linux-2.0.0\\
path_provider_macos=C:\\src\\flutter\\.pub-cache\\hosted\\pub.dartlang.org\\path_provider_macos-2.0.0\\
path_provider_windows=C:\\src\\flutter\\.pub-cache\\hosted\\pub.dartlang.org\\path_provider_windows-2.0.0\\
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"flutter_keyboard_visibility","path":"/Users/ferdisungkar/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_keyboard_visibility-5.0.0/","dependencies":[]},{"name":"flutter_secure_storage","path":"/Users/ferdisungkar/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_secure_storage-3.3.5/","dependencies":[]},{"name":"image_picker","path":"/Users/ferdisungkar/flutter/.pub-cache/hosted/pub.dartlang.org/image_picker-0.7.4/","dependencies":[]},{"name":"path_provider","path":"/Users/ferdisungkar/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider-2.0.1/","dependencies":[]}],"android":[{"name":"flutter_keyboard_visibility","path":"/Users/ferdisungkar/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_keyboard_visibility-5.0.0/","dependencies":[]},{"name":"flutter_plugin_android_lifecycle","path":"/Users/ferdisungkar/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_plugin_android_lifecycle-2.0.1/","dependencies":[]},{"name":"flutter_secure_storage","path":"/Users/ferdisungkar/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_secure_storage-3.3.5/","dependencies":[]},{"name":"image_picker","path":"/Users/ferdisungkar/flutter/.pub-cache/hosted/pub.dartlang.org/image_picker-0.7.4/","dependencies":["flutter_plugin_android_lifecycle"]},{"name":"path_provider","path":"/Users/ferdisungkar/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider-2.0.1/","dependencies":[]}],"macos":[{"name":"path_provider_macos","path":"/Users/ferdisungkar/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_macos-2.0.0/","dependencies":[]}],"linux":[{"name":"path_provider_linux","path":"/Users/ferdisungkar/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_linux-2.0.0/","dependencies":[]}],"windows":[{"name":"path_provider_windows","path":"/Users/ferdisungkar/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_windows-2.0.0/","dependencies":[]}],"web":[{"name":"flutter_keyboard_visibility_web","path":"/Users/ferdisungkar/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_keyboard_visibility_web-2.0.0/","dependencies":[]},{"name":"image_picker_for_web","path":"/Users/ferdisungkar/flutter/.pub-cache/hosted/pub.dartlang.org/image_picker_for_web-2.0.0/","dependencies":[]}]},"dependencyGraph":[{"name":"flutter_keyboard_visibility","dependencies":["flutter_keyboard_visibility_web"]},{"name":"flutter_keyboard_visibility_web","dependencies":[]},{"name":"flutter_plugin_android_lifecycle","dependencies":[]},{"name":"flutter_secure_storage","dependencies":[]},{"name":"image_picker","dependencies":["flutter_plugin_android_lifecycle","image_picker_for_web"]},{"name":"image_picker_for_web","dependencies":[]},{"name":"path_provider","dependencies":["path_provider_macos","path_provider_linux","path_provider_windows"]},{"name":"path_provider_linux","dependencies":[]},{"name":"path_provider_macos","dependencies":[]},{"name":"path_provider_windows","dependencies":[]}],"date_created":"2021-05-17 01:53:59.926683","version":"2.0.1"}
\ No newline at end of file
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"flutter_keyboard_visibility","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\flutter_keyboard_visibility-5.0.0\\\\","dependencies":[]},{"name":"flutter_secure_storage","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\flutter_secure_storage-3.3.5\\\\","dependencies":[]},{"name":"image_picker","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\image_picker-0.7.4\\\\","dependencies":[]},{"name":"path_provider","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider-2.0.1\\\\","dependencies":[]}],"android":[{"name":"flutter_keyboard_visibility","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\flutter_keyboard_visibility-5.0.0\\\\","dependencies":[]},{"name":"flutter_plugin_android_lifecycle","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\flutter_plugin_android_lifecycle-2.0.1\\\\","dependencies":[]},{"name":"flutter_secure_storage","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\flutter_secure_storage-3.3.5\\\\","dependencies":[]},{"name":"image_picker","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\image_picker-0.7.4\\\\","dependencies":["flutter_plugin_android_lifecycle"]},{"name":"path_provider","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider-2.0.1\\\\","dependencies":[]}],"macos":[{"name":"path_provider_macos","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider_macos-2.0.0\\\\","dependencies":[]}],"linux":[{"name":"path_provider_linux","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider_linux-2.0.0\\\\","dependencies":[]}],"windows":[{"name":"path_provider_windows","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider_windows-2.0.0\\\\","dependencies":[]}],"web":[{"name":"flutter_keyboard_visibility_web","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\flutter_keyboard_visibility_web-2.0.0\\\\","dependencies":[]},{"name":"image_picker_for_web","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\image_picker_for_web-2.0.0\\\\","dependencies":[]}]},"dependencyGraph":[{"name":"flutter_keyboard_visibility","dependencies":["flutter_keyboard_visibility_web"]},{"name":"flutter_keyboard_visibility_web","dependencies":[]},{"name":"flutter_plugin_android_lifecycle","dependencies":[]},{"name":"flutter_secure_storage","dependencies":[]},{"name":"image_picker","dependencies":["flutter_plugin_android_lifecycle","image_picker_for_web"]},{"name":"image_picker_for_web","dependencies":[]},{"name":"path_provider","dependencies":["path_provider_macos","path_provider_linux","path_provider_windows"]},{"name":"path_provider_linux","dependencies":[]},{"name":"path_provider_macos","dependencies":[]},{"name":"path_provider_windows","dependencies":[]}],"date_created":"2021-05-17 04:32:43.804091","version":"2.0.1"}
\ No newline at end of file
This diff is collapsed.
sdk.dir=/Users/ferdisungkar/Library/Android/sdk
flutter.sdk=/Users/ferdisungkar/flutter
sdk.dir=C:\\Users\\Manuel Yoseph Ray\\AppData\\Local\\Android\\sdk
flutter.sdk=C:\\src\\flutter
=======
flutter.buildMode=debug
flutter.versionName=1.0.0
......
import 'package:flutter/material.dart';
import 'package:fundex_app/pages/business/prospectus_page.dart';
import 'package:fundex_app/pages/register/register.dart';
void main() {
runApp(MaterialApp(home: ProspectusPage()));
runApp(MaterialApp(home: RegisterPage()));
}
class MyApp extends StatelessWidget {
......
......@@ -18,45 +18,6 @@ class EmailValidator {
class PasswordValidator {
static String validate(String value) {
if (value.contains(new RegExp(r'[A-Z]'))) {
_RegisterPageState.circleColorKapital = Colors.green;
_RegisterPageState.fontColorKapital = Colors.black;
}
if (!value.contains(new RegExp(r'[A-Z]'))) {
_RegisterPageState.circleColorKapital = Colors.grey[400];
_RegisterPageState.fontColorKapital = Colors.grey[400];
return 'Tidak memiliki huruf kapital';
}
if (value.contains(new RegExp(r'[a-z]'))) {
_RegisterPageState.circleColorHurufKecil = Colors.green;
_RegisterPageState.fontColorHurufKecil = Colors.black;
}
if (!value.contains(new RegExp(r'[a-z]'))) {
_RegisterPageState.circleColorHurufKecil = Colors.grey[400];
_RegisterPageState.fontColorHurufKecil = Colors.grey[400];
return 'Tidak memiliki huruf kecil';
}
if (value.contains(new RegExp(r'[0-9]'))) {
_RegisterPageState.circleColorAngka = Colors.green;
_RegisterPageState.fontColorAngka = Colors.black;
}
if (!value.contains(new RegExp(r'[0-9]'))) {
_RegisterPageState.circleColorAngka = Colors.grey[400];
_RegisterPageState.fontColorAngka = Colors.grey[400];
return 'Tidak memiliki angka';
}
if (value.length >= 8) {
_RegisterPageState.circleColorKarakter = Colors.green;
_RegisterPageState.fontColorKarakter = Colors.black;
}
if (!(value.length >= 8)) {
_RegisterPageState.circleColorKarakter = Colors.grey[400];
_RegisterPageState.fontColorKarakter = Colors.grey[400];
return 'Tidak terdiri dari 8 karakter';
}
if (value.isEmpty) {
return 'Password harus diisi';
}
if (_RegisterPageState.circleColorKarakter == Colors.green &&
_RegisterPageState.circleColorAngka == Colors.green &&
_RegisterPageState.circleColorKapital == Colors.green &&
......@@ -66,8 +27,9 @@ class PasswordValidator {
_RegisterPageState.fontColorKapital == Colors.black &&
_RegisterPageState.fontColorHurufKecil == Colors.black) {
return null;
} else {
return "Ada kriteria password yang belum terpenuhi";
}
return null;
}
}
......@@ -110,6 +72,68 @@ class _RegisterPageState extends State<RegisterPage> {
);
}
setValidasiPassword(String value) {
if (value.contains(new RegExp(r'[A-Z]'))) {
setState(() {
circleColorKapital = Colors.green;
fontColorKapital = Colors.black;
});
}
if (!value.contains(new RegExp(r'[A-Z]'))) {
setState(() {
circleColorKapital = Colors.grey[400];
fontColorKapital = Colors.grey[400];
});
}
if (value.contains(new RegExp(r'[a-z]'))) {
setState(() {
circleColorHurufKecil = Colors.green;
fontColorHurufKecil = Colors.black;
});
}
if (!value.contains(new RegExp(r'[a-z]'))) {
setState(() {
circleColorHurufKecil = Colors.grey[400];
fontColorHurufKecil = Colors.grey[400];
});
}
if (value.contains(new RegExp(r'[0-9]'))) {
setState(() {
circleColorAngka = Colors.green;
fontColorAngka = Colors.black;
});
}
if (!value.contains(new RegExp(r'[0-9]'))) {
setState(() {
circleColorAngka = Colors.grey[400];
fontColorAngka = Colors.grey[400];
});
}
if (value.length >= 8) {
setState(() {
circleColorKarakter = Colors.green;
fontColorKarakter = Colors.black;
});
}
if (!(value.length >= 8)) {
setState(() {
circleColorKarakter = Colors.grey[400];
fontColorKarakter = Colors.grey[400];
});
}
if (_RegisterPageState.circleColorKarakter == Colors.green &&
_RegisterPageState.circleColorAngka == Colors.green &&
_RegisterPageState.circleColorKapital == Colors.green &&
_RegisterPageState.circleColorHurufKecil == Colors.green &&
_RegisterPageState.fontColorKarakter == Colors.black &&
_RegisterPageState.fontColorAngka == Colors.black &&
_RegisterPageState.fontColorKapital == Colors.black &&
_RegisterPageState.fontColorHurufKecil == Colors.black) {
return null;
}
return null;
}
Widget _buildEmail() {
return SizedBox(
child: TextFormField(
......@@ -134,6 +158,9 @@ class _RegisterPageState extends State<RegisterPage> {
decoration: formInputDecoration(),
validator: PasswordValidator.validate,
keyboardType: TextInputType.text,
onChanged: (value) {
setValidasiPassword(value);
},
onSaved: (String value) {
password = value;
},
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment