step 11 : proses login test
This commit is contained in:
BIN
app_petty_cash/images/login_top_bg.png
Normal file
BIN
app_petty_cash/images/login_top_bg.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 41 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 9.2 KiB After Width: | Height: | Size: 13 KiB |
@@ -254,9 +254,11 @@ class Constant {
|
|||||||
static Color textGrey = Color(0xff80848E);
|
static Color textGrey = Color(0xff80848E);
|
||||||
static Color textWhite = Color(0xffFDFDFD);
|
static Color textWhite = Color(0xffFDFDFD);
|
||||||
static Color textGreen = Color(0xff0BAF48);
|
static Color textGreen = Color(0xff0BAF48);
|
||||||
|
static Color textGreyv2 = Color(0xff637381);
|
||||||
|
static Color pcBtnBackgroundColor = Color(0xffF15A29);
|
||||||
|
|
||||||
// background upload file
|
// background upload file
|
||||||
static Color bgUploadFile = Color(0xffF5F5F5);
|
static Color bgUploadFile = Color.fromRGBO(207, 207, 207, 0.20);
|
||||||
|
|
||||||
//typoGraphy
|
//typoGraphy
|
||||||
static TextStyle titleH1Login({required BuildContext context}) {
|
static TextStyle titleH1Login({required BuildContext context}) {
|
||||||
|
|||||||
@@ -38,9 +38,9 @@ class MyApp extends StatelessWidget {
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
debugShowCheckedModeBanner: false,
|
debugShowCheckedModeBanner: false,
|
||||||
// initialRoute: loginRoute,
|
initialRoute: loginRoute,
|
||||||
// initialRoute: splashScreen,
|
// initialRoute: splashScreen,
|
||||||
initialRoute: transaksiRoute,
|
// initialRoute: transaksiRoute,
|
||||||
// initialRoute: reportRoute,
|
// initialRoute: reportRoute,
|
||||||
// initialRoute: testFilePickerRoute,
|
// initialRoute: testFilePickerRoute,
|
||||||
onGenerateRoute: AppRoute.generateRoute,
|
onGenerateRoute: AppRoute.generateRoute,
|
||||||
|
|||||||
@@ -18,16 +18,17 @@ class AuthDoctorModel {
|
|||||||
// "ip": "139.194.156.91",
|
// "ip": "139.194.156.91",
|
||||||
// "agent": "PostmanRuntime/7.29.2"
|
// "agent": "PostmanRuntime/7.29.2"
|
||||||
|
|
||||||
late String doctorID;
|
// late String doctorID;
|
||||||
late String doctorName;
|
// late String doctorName;
|
||||||
|
|
||||||
// new
|
// new
|
||||||
late String M_UserID;
|
late String M_UserID;
|
||||||
late String M_UserUsername;
|
late String M_UserUsername;
|
||||||
late String M_UserM_DoctorCode;
|
late String M_UserEmail;
|
||||||
late String M_UserM_DoctorID;
|
// late String M_UserM_DoctorCode;
|
||||||
late String M_UserM_StaffID;
|
// late String M_UserM_DoctorID;
|
||||||
late String M_UserM_MouID;
|
// late String M_UserM_StaffID;
|
||||||
|
// late String M_UserM_MouID;
|
||||||
late String ip;
|
late String ip;
|
||||||
late String agent;
|
late String agent;
|
||||||
|
|
||||||
@@ -37,10 +38,11 @@ class AuthDoctorModel {
|
|||||||
|
|
||||||
required this.M_UserID,
|
required this.M_UserID,
|
||||||
required this.M_UserUsername,
|
required this.M_UserUsername,
|
||||||
required this.M_UserM_DoctorCode,
|
required this.M_UserEmail,
|
||||||
required this.M_UserM_DoctorID,
|
// required this.M_UserM_DoctorCode,
|
||||||
this.M_UserM_StaffID = "",
|
// required this.M_UserM_DoctorID,
|
||||||
this.M_UserM_MouID = "",
|
// this.M_UserM_StaffID = "",
|
||||||
|
// this.M_UserM_MouID = "",
|
||||||
this.ip = "",
|
this.ip = "",
|
||||||
this.agent = ""
|
this.agent = ""
|
||||||
});
|
});
|
||||||
@@ -48,10 +50,11 @@ class AuthDoctorModel {
|
|||||||
AuthDoctorModel.fromJson(Map<String, dynamic> json) {
|
AuthDoctorModel.fromJson(Map<String, dynamic> json) {
|
||||||
M_UserID = json['M_UserID'].toString();
|
M_UserID = json['M_UserID'].toString();
|
||||||
M_UserUsername = json['M_UserUsername'].toString();
|
M_UserUsername = json['M_UserUsername'].toString();
|
||||||
M_UserM_DoctorCode = json['M_UserM_DoctorCode'].toString();
|
M_UserEmail = json['M_UserEmail'].toString();
|
||||||
M_UserM_DoctorID = json['M_UserM_DoctorID'].toString();
|
// M_UserM_DoctorCode = json['M_UserM_DoctorCode'].toString();
|
||||||
M_UserM_StaffID = json['M_UserM_StaffID'].toString();
|
// M_UserM_DoctorID = json['M_UserM_DoctorID'].toString();
|
||||||
M_UserM_MouID = json['M_UserM_MouID'].toString();
|
// M_UserM_StaffID = json['M_UserM_StaffID'].toString();
|
||||||
|
// M_UserM_MouID = json['M_UserM_MouID'].toString();
|
||||||
ip = json['ip'].toString();
|
ip = json['ip'].toString();
|
||||||
agent = json['agent'].toString();
|
agent = json['agent'].toString();
|
||||||
}
|
}
|
||||||
@@ -60,10 +63,11 @@ class AuthDoctorModel {
|
|||||||
final Map<String, dynamic> data = <String, dynamic>{};
|
final Map<String, dynamic> data = <String, dynamic>{};
|
||||||
data['M_UserID'] = M_UserID;
|
data['M_UserID'] = M_UserID;
|
||||||
data['M_UserUsername'] = M_UserUsername;
|
data['M_UserUsername'] = M_UserUsername;
|
||||||
data['M_UserM_DoctorCode'] = M_UserM_DoctorCode;
|
data['M_UserEmail'] = M_UserEmail;
|
||||||
data['M_UserM_DoctorID'] = M_UserM_DoctorID;
|
// data['M_UserM_DoctorCode'] = M_UserM_DoctorCode;
|
||||||
data['M_UserM_StaffID'] = M_UserM_StaffID;
|
// data['M_UserM_DoctorID'] = M_UserM_DoctorID;
|
||||||
data['M_UserM_MouID'] = M_UserM_MouID;
|
// data['M_UserM_StaffID'] = M_UserM_StaffID;
|
||||||
|
// data['M_UserM_MouID'] = M_UserM_MouID;
|
||||||
data['ip'] = ip;
|
data['ip'] = ip;
|
||||||
data['agent'] = agent;
|
data['agent'] = agent;
|
||||||
|
|
||||||
|
|||||||
@@ -6,13 +6,13 @@ class AuthRepository extends BaseRepository {
|
|||||||
AuthRepository({required super.dio});
|
AuthRepository({required super.dio});
|
||||||
|
|
||||||
Future<AuthModel> login({
|
Future<AuthModel> login({
|
||||||
required String username,
|
required String email,
|
||||||
required String dokterId,
|
// required String dokterId,
|
||||||
required String password,
|
required String password,
|
||||||
}) async {
|
}) async {
|
||||||
final param = {
|
final param = {
|
||||||
"username": username,
|
"email": email,
|
||||||
"doctor_id": dokterId,
|
// "doctor_id": dokterId,
|
||||||
"password": password
|
"password": password
|
||||||
|
|
||||||
// "username": "alhadad1",
|
// "username": "alhadad1",
|
||||||
@@ -21,6 +21,7 @@ class AuthRepository extends BaseRepository {
|
|||||||
};
|
};
|
||||||
// final service = "${Constant.baseUrlDevone}xauth/login";
|
// final service = "${Constant.baseUrlDevone}xauth/login";
|
||||||
final service = "${Constant.baseUrlDevone}auth/login";
|
final service = "${Constant.baseUrlDevone}auth/login";
|
||||||
|
print('url login $service');
|
||||||
final resp = await post(param: param, service: service);
|
final resp = await post(param: param, service: service);
|
||||||
final result = AuthModel(
|
final result = AuthModel(
|
||||||
token: resp["data"]["token"],
|
token: resp["data"]["token"],
|
||||||
@@ -42,6 +43,7 @@ class AuthRepository extends BaseRepository {
|
|||||||
};
|
};
|
||||||
|
|
||||||
final service = "${Constant.baseUrlDevone}auth/logout";
|
final service = "${Constant.baseUrlDevone}auth/logout";
|
||||||
|
print('url login $service');
|
||||||
final resp = await post(param: param, service: service);
|
final resp = await post(param: param, service: service);
|
||||||
|
|
||||||
if (resp["status"] == "OK") {
|
if (resp["status"] == "OK") {
|
||||||
|
|||||||
@@ -1,278 +0,0 @@
|
|||||||
// ignore_for_file: prefer_const_constructors, use_full_hex_values_for_flutter_colors
|
|
||||||
|
|
||||||
import 'dart:async';
|
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:flutter_hooks/flutter_hooks.dart';
|
|
||||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
|
||||||
|
|
||||||
import '../../app/constant.dart';
|
|
||||||
import '../../app/route.dart';
|
|
||||||
import '../../provider/current_menu_provider.dart';
|
|
||||||
import '../../provider/current_user_provider.dart';
|
|
||||||
import 'custom_text_field.dart';
|
|
||||||
import 'login_provider.dart';
|
|
||||||
|
|
||||||
class BlockBody extends HookConsumerWidget {
|
|
||||||
const BlockBody({
|
|
||||||
Key? key,
|
|
||||||
}) : super(key: key);
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context, WidgetRef ref) {
|
|
||||||
final isPasswordObscured = useState<bool>(true);
|
|
||||||
final ctrlUsername = useTextEditingController(text: "");
|
|
||||||
final ctrlDokterId = useTextEditingController(text: "");
|
|
||||||
final ctrlPassword = useTextEditingController(text: "");
|
|
||||||
final isLoading = useState(false);
|
|
||||||
final errorMessage = useState("");
|
|
||||||
final isSuccess = useState(false);
|
|
||||||
|
|
||||||
ref.listen(loginProvider, (prev, next) {
|
|
||||||
if (next is LoginStateLoading) {
|
|
||||||
isLoading.value = true;
|
|
||||||
} else if (next is LoginStateError) {
|
|
||||||
isLoading.value = false;
|
|
||||||
errorMessage.value = next.message;
|
|
||||||
Timer(const Duration(seconds: 3), () {
|
|
||||||
errorMessage.value = "";
|
|
||||||
});
|
|
||||||
} else if (next is LoginStateDone) {
|
|
||||||
isLoading.value = false;
|
|
||||||
isSuccess.value = true;
|
|
||||||
ref.read(currentPageProvider.state).update((state) => 0);
|
|
||||||
ref.read(currentUserProvider.notifier).state = next.model;
|
|
||||||
|
|
||||||
// print(next.model.model.doctorName);
|
|
||||||
|
|
||||||
// Navigator.of(context).pop();
|
|
||||||
// Navigator.of(context).pushNamedAndRemoveUntil(menuRoute,(route) => true,);
|
|
||||||
// Navigator.popAndPushNamed(context,menuRoute);
|
|
||||||
|
|
||||||
Navigator.of(context)
|
|
||||||
.pushNamedAndRemoveUntil(menuRoute, (route) => false);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
return ListView(
|
|
||||||
children: [
|
|
||||||
Container(
|
|
||||||
width: Constant.getActualXPhone(context: context, x: 390),
|
|
||||||
height: Constant.getActualYPhone(context: context, y: 343),
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
image: DecorationImage(
|
|
||||||
image: AssetImage('images/header_tanpa_logo.png'),
|
|
||||||
fit: BoxFit.cover,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
child: Column(
|
|
||||||
children: [
|
|
||||||
SizedBox(
|
|
||||||
height: Constant.getActualYPhone(context: context, y: 136),
|
|
||||||
),
|
|
||||||
Container(
|
|
||||||
width: Constant.getActualXPhone(context: context, x: 148),
|
|
||||||
height: Constant.getActualYPhone(context: context, y: 78),
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
image: DecorationImage(
|
|
||||||
fit: BoxFit.fitHeight,
|
|
||||||
image: AssetImage('images/logo_pramita.png'),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
height: Constant.getActualYPhone(context: context, y: 43),
|
|
||||||
),
|
|
||||||
Container(
|
|
||||||
width: Constant.getActualXPhone(context: context, x: 391),
|
|
||||||
height: Constant.getActualYPhone(context: context, y: 454),
|
|
||||||
padding: EdgeInsets.only(
|
|
||||||
left: Constant.getActualXPhone(context: context, x: 32),
|
|
||||||
right: Constant.getActualXPhone(context: context, x: 32),
|
|
||||||
top: Constant.getActualYPhone(context: context, y: 20),
|
|
||||||
bottom: Constant.getActualYPhone(context: context, y: 20),
|
|
||||||
),
|
|
||||||
child: Column(
|
|
||||||
children: [
|
|
||||||
// form
|
|
||||||
SizedBox(
|
|
||||||
width: Constant.getActualXPhone(context: context, x: 180),
|
|
||||||
height: Constant.getActualYPhone(context: context, y: 29),
|
|
||||||
child: Align(
|
|
||||||
alignment: Alignment.center,
|
|
||||||
child: Text("LOGIN DOKTER",
|
|
||||||
style: Constant.titleH3_700(context: context)
|
|
||||||
.copyWith(color: Constant.subTitleBlack)),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
|
|
||||||
SizedBox(
|
|
||||||
height: Constant.getActualYPhone(context: context, y: 4),
|
|
||||||
),
|
|
||||||
|
|
||||||
// notify error dari backend start
|
|
||||||
|
|
||||||
if (isLoading.value)
|
|
||||||
SizedBox(
|
|
||||||
width: Constant.getActualXPhone(context: context, x: 20),
|
|
||||||
height: Constant.getActualYPhone(context: context, y: 20),
|
|
||||||
child: CircularProgressIndicator(),
|
|
||||||
),
|
|
||||||
|
|
||||||
if (errorMessage.value != "")
|
|
||||||
Text(
|
|
||||||
"Peringatan : ${errorMessage.value}",
|
|
||||||
style: Constant.titleH7_700(context: context)
|
|
||||||
.copyWith(color: Constant.textRedProblemMaketing),
|
|
||||||
),
|
|
||||||
|
|
||||||
// notify error dari backend end
|
|
||||||
|
|
||||||
SizedBox(
|
|
||||||
height: Constant.getActualYPhone(context: context, y: 24),
|
|
||||||
),
|
|
||||||
// textfield marketing ID
|
|
||||||
SizedBox(
|
|
||||||
width: Constant.getActualXPhone(context: context, x: 320),
|
|
||||||
height: Constant.getActualYPhone(context: context, y: 50),
|
|
||||||
child: CustomTextField(
|
|
||||||
ctrl: ctrlDokterId,
|
|
||||||
isPassword: false,
|
|
||||||
hintText: "Doctor ID",
|
|
||||||
labelText: "Doctor ID",
|
|
||||||
isError: (errorMessage.value != "") ? true : false,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
|
|
||||||
SizedBox(
|
|
||||||
height: Constant.getActualYPhone(context: context, y: 20),
|
|
||||||
),
|
|
||||||
// textfield username
|
|
||||||
SizedBox(
|
|
||||||
width: Constant.getActualXPhone(context: context, x: 320),
|
|
||||||
height: Constant.getActualYPhone(context: context, y: 50),
|
|
||||||
child: CustomTextField(
|
|
||||||
ctrl: ctrlUsername,
|
|
||||||
isPassword: false,
|
|
||||||
hintText: "Username",
|
|
||||||
labelText: "Username",
|
|
||||||
isError: (errorMessage.value != "") ? true : false,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
|
|
||||||
SizedBox(
|
|
||||||
height: Constant.getActualYPhone(context: context, y: 20),
|
|
||||||
),
|
|
||||||
// textfield password
|
|
||||||
SizedBox(
|
|
||||||
width: Constant.getActualXPhone(context: context, x: 320),
|
|
||||||
height: Constant.getActualYPhone(context: context, y: 50),
|
|
||||||
child: CustomTextField(
|
|
||||||
ctrl: ctrlPassword,
|
|
||||||
isPassword: false,
|
|
||||||
obscureText: isPasswordObscured.value,
|
|
||||||
hintText: "Password",
|
|
||||||
labelText: "Password",
|
|
||||||
onToggle: () {
|
|
||||||
isPasswordObscured.value = !isPasswordObscured.value;
|
|
||||||
},
|
|
||||||
isError: (errorMessage.value != "") ? true : false,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
|
|
||||||
SizedBox(
|
|
||||||
height: Constant.getActualYPhone(context: context, y: 40),
|
|
||||||
),
|
|
||||||
// button login
|
|
||||||
SizedBox(
|
|
||||||
width: Constant.getActualXPhone(context: context, x: 320),
|
|
||||||
height: Constant.getActualYPhone(context: context, y: 50),
|
|
||||||
child: ElevatedButton(
|
|
||||||
onPressed: (isSuccess.value == true)
|
|
||||||
? () {}
|
|
||||||
: () {
|
|
||||||
if (ctrlUsername.text.isEmpty ||
|
|
||||||
ctrlDokterId.text.isEmpty ||
|
|
||||||
ctrlPassword.text.isEmpty) {
|
|
||||||
isLoading.value = true;
|
|
||||||
errorMessage.value = 'Inputan harus diisi';
|
|
||||||
Timer(const Duration(seconds: 3), () {
|
|
||||||
isLoading.value = false;
|
|
||||||
errorMessage.value = "";
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
ref.read(loginProvider.notifier).login(
|
|
||||||
username: ctrlUsername.text,
|
|
||||||
dokterId: ctrlDokterId.text,
|
|
||||||
password: ctrlPassword.text);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
style: ButtonStyle(
|
|
||||||
backgroundColor: MaterialStateColor.resolveWith((st) =>
|
|
||||||
(isSuccess.value == true)
|
|
||||||
? Constant.textGrey
|
|
||||||
: Constant.buttonLoginBackgroundColor),
|
|
||||||
shape: MaterialStateProperty.all<RoundedRectangleBorder>(
|
|
||||||
RoundedRectangleBorder(
|
|
||||||
borderRadius: BorderRadius.circular(8.0),
|
|
||||||
side: BorderSide(color: Colors.red),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
shadowColor: MaterialStateProperty.all(Color(0xffff48423d)),
|
|
||||||
elevation: MaterialStateProperty.all(4.0),
|
|
||||||
),
|
|
||||||
child: Align(
|
|
||||||
alignment: Alignment.center,
|
|
||||||
child: Text(
|
|
||||||
'LOGIN',
|
|
||||||
style: Constant.titleH3_700(context: context)
|
|
||||||
.copyWith(color: Constant.textLoginColor),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
|
|
||||||
SizedBox(
|
|
||||||
height: Constant.getActualYPhone(context: context, y: 22),
|
|
||||||
),
|
|
||||||
|
|
||||||
// versi
|
|
||||||
Align(
|
|
||||||
alignment: Alignment.center,
|
|
||||||
child: Text(
|
|
||||||
'Versi ${Constant.version}',
|
|
||||||
style: Constant.titleH4Login(context: context)
|
|
||||||
.copyWith(color: Constant.textGrey),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
|
|
||||||
// text problem login
|
|
||||||
|
|
||||||
// SizedBox(
|
|
||||||
// width: Constant.getActualXPhone(context: context, x: 121),
|
|
||||||
// height: Constant.getActualYPhone(context: context, y: 20),
|
|
||||||
// // color: Colors.brown,
|
|
||||||
// child: Align(
|
|
||||||
// alignment: Alignment.center,
|
|
||||||
// child: InkWell(
|
|
||||||
// onTap: () {
|
|
||||||
// Navigator.of(context).pushNamed(problemLoginRoute);
|
|
||||||
// },
|
|
||||||
// child: Text(
|
|
||||||
// 'Problem Login ? ',
|
|
||||||
// style: Constant.body1_400(context: context)
|
|
||||||
// .copyWith(color: Constant.textRedProblemMaketing),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -78,7 +78,7 @@ class LoginFormScreen extends HookConsumerWidget {
|
|||||||
} else if (next is LoginStateDone) {
|
} else if (next is LoginStateDone) {
|
||||||
isLoading.value = false;
|
isLoading.value = false;
|
||||||
isSuccess.value = true;
|
isSuccess.value = true;
|
||||||
ref.read(currentPageProvider.state).update((state) => 0);
|
// ref.read(currentPageProvider.state).update((state) => 0);
|
||||||
ref.read(currentUserProvider.notifier).state = next.model;
|
ref.read(currentUserProvider.notifier).state = next.model;
|
||||||
|
|
||||||
// print(next.model.model.doctorName);
|
// print(next.model.model.doctorName);
|
||||||
@@ -102,7 +102,12 @@ class LoginFormScreen extends HookConsumerWidget {
|
|||||||
Container(
|
Container(
|
||||||
width: Constant.getActualXPhone(context: context, x: 390),
|
width: Constant.getActualXPhone(context: context, x: 390),
|
||||||
height: Constant.getActualYPhone(context: context, y: 359),
|
height: Constant.getActualYPhone(context: context, y: 359),
|
||||||
decoration: BoxDecoration(color: Colors.grey),
|
// decoration: BoxDecoration(color: Colors.grey),
|
||||||
|
child: Image.asset(
|
||||||
|
"images/login_top_bg.png",
|
||||||
|
fit: BoxFit.fill,
|
||||||
|
// scale: 1,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
Container(
|
Container(
|
||||||
width: Constant.getActualXPhone(context: context, x: 390),
|
width: Constant.getActualXPhone(context: context, x: 390),
|
||||||
@@ -138,7 +143,7 @@ class LoginFormScreen extends HookConsumerWidget {
|
|||||||
'Silahkan masuk untuk mengakses akun Anda',
|
'Silahkan masuk untuk mengakses akun Anda',
|
||||||
style: Constant.body1(context: context).copyWith(
|
style: Constant.body1(context: context).copyWith(
|
||||||
fontWeight: FontWeight.w600,
|
fontWeight: FontWeight.w600,
|
||||||
color: Constant.textBlack),
|
color: Constant.textGreyv2),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
@@ -176,11 +181,11 @@ class LoginFormScreen extends HookConsumerWidget {
|
|||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
hintStyle:
|
hintStyle:
|
||||||
Constant.body2_400(context: context).copyWith(
|
Constant.body2_400(context: context).copyWith(
|
||||||
color: Colors.orange,
|
color: Constant.textGreyv2,
|
||||||
),
|
),
|
||||||
labelStyle:
|
labelStyle:
|
||||||
Constant.body2_400(context: context).copyWith(
|
Constant.body2_400(context: context).copyWith(
|
||||||
color: Colors.orange,
|
color: Constant.textGreyv2,
|
||||||
),
|
),
|
||||||
border: OutlineInputBorder(
|
border: OutlineInputBorder(
|
||||||
borderSide: BorderSide(
|
borderSide: BorderSide(
|
||||||
@@ -190,11 +195,11 @@ class LoginFormScreen extends HookConsumerWidget {
|
|||||||
),
|
),
|
||||||
focusedBorder: OutlineInputBorder(
|
focusedBorder: OutlineInputBorder(
|
||||||
borderSide: BorderSide(
|
borderSide: BorderSide(
|
||||||
color: Colors.orange,
|
color: Constant.textGreyv2,
|
||||||
width: 1,
|
width: 1,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
// labelText: "Nama Pengirim",
|
// labelText: "Masukkan Email",
|
||||||
// hintText: 'Nama Pengirim',
|
// hintText: 'Nama Pengirim',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -259,15 +264,6 @@ class LoginFormScreen extends HookConsumerWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
||||||
if (isLoading.value)
|
|
||||||
SizedBox(
|
|
||||||
width:
|
|
||||||
Constant.getActualXPhone(context: context, x: 20),
|
|
||||||
height:
|
|
||||||
Constant.getActualYPhone(context: context, y: 20),
|
|
||||||
child: Center(child: CircularProgressIndicator()),
|
|
||||||
),
|
|
||||||
|
|
||||||
if (errorMessage.value != "") ...[
|
if (errorMessage.value != "") ...[
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height:
|
height:
|
||||||
@@ -297,51 +293,70 @@ class LoginFormScreen extends HookConsumerWidget {
|
|||||||
height:
|
height:
|
||||||
Constant.getActualYPhone(context: context, y: 50),
|
Constant.getActualYPhone(context: context, y: 50),
|
||||||
child: ElevatedButton(
|
child: ElevatedButton(
|
||||||
onPressed: () {
|
// onPressed: () {
|
||||||
Navigator.of(context).pushNamed(homeRoute);
|
// Navigator.of(context).pushNamed(homeRoute);
|
||||||
},
|
// },
|
||||||
// onPressed: (isSuccess.value == true)
|
onPressed: (isSuccess.value == true)
|
||||||
// ? () {}
|
? () {}
|
||||||
// : () {
|
: () {
|
||||||
// if (ctrlEmail.text.isEmpty ||
|
if (ctrlEmail.text.isEmpty ||
|
||||||
// ctrlDokterId.text.isEmpty ||
|
ctrlPassword.text.isEmpty) {
|
||||||
// ctrlPassword.text.isEmpty) {
|
isLoading.value = true;
|
||||||
// isLoading.value = true;
|
errorMessage.value = 'Inputan harus diisi';
|
||||||
// errorMessage.value = 'Inputan harus diisi';
|
Timer(const Duration(seconds: 3), () {
|
||||||
// Timer(const Duration(seconds: 3), () {
|
isLoading.value = false;
|
||||||
// isLoading.value = false;
|
errorMessage.value = "";
|
||||||
// errorMessage.value = "";
|
});
|
||||||
// });
|
} else {
|
||||||
// } else {
|
ref.read(loginProvider.notifier).login(
|
||||||
// ref.read(loginProvider.notifier).login(
|
email: ctrlEmail.text,
|
||||||
// username: ctrlEmail.text,
|
password: ctrlPassword.text,
|
||||||
// dokterId: ctrlDokterId.text,
|
);
|
||||||
// password: ctrlPassword.text);
|
}
|
||||||
// }
|
},
|
||||||
// },
|
|
||||||
style: ButtonStyle(
|
style: ButtonStyle(
|
||||||
backgroundColor: MaterialStateColor.resolveWith(
|
backgroundColor: MaterialStateColor.resolveWith(
|
||||||
(st) => (isSuccess.value == true)
|
(st) => (isSuccess.value == true)
|
||||||
? Constant.textGrey
|
? Constant.textGrey
|
||||||
: Colors.orange),
|
: Constant.pcBtnBackgroundColor),
|
||||||
shape: MaterialStateProperty.all<
|
shape: MaterialStateProperty.all<
|
||||||
RoundedRectangleBorder>(
|
RoundedRectangleBorder>(
|
||||||
RoundedRectangleBorder(
|
RoundedRectangleBorder(
|
||||||
borderRadius: BorderRadius.circular(8),
|
borderRadius: BorderRadius.circular(8),
|
||||||
side: BorderSide(color: Colors.orange),
|
side: BorderSide(
|
||||||
|
color: Constant.pcBtnBackgroundColor,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
shadowColor:
|
shadowColor:
|
||||||
MaterialStateProperty.all(Color(0xffff48423d)),
|
MaterialStateProperty.all(Color(0xffff48423d)),
|
||||||
elevation: MaterialStateProperty.all(4.0),
|
elevation: MaterialStateProperty.all(4.0),
|
||||||
),
|
),
|
||||||
child: Align(
|
child: Stack(
|
||||||
alignment: Alignment.center,
|
children: [
|
||||||
child: Text(
|
(isLoading.value)
|
||||||
'Login',
|
? SizedBox(
|
||||||
style: Constant.titleH3_700(context: context)
|
width: Constant.getActualXPhone(
|
||||||
.copyWith(color: Constant.textLoginColor),
|
context: context, x: 24),
|
||||||
),
|
height: Constant.getActualYPhone(
|
||||||
|
context: context, y: 32),
|
||||||
|
child: Center(
|
||||||
|
child: CircularProgressIndicator(
|
||||||
|
color: Colors.white,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: Align(
|
||||||
|
alignment: Alignment.center,
|
||||||
|
child: Text(
|
||||||
|
'Login',
|
||||||
|
style: Constant.titleH3_700(
|
||||||
|
context: context)
|
||||||
|
.copyWith(
|
||||||
|
color: Constant.textLoginColor),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -20,14 +20,14 @@ class LoginNotifier extends StateNotifier<LoginState> {
|
|||||||
final Ref ref;
|
final Ref ref;
|
||||||
LoginNotifier({required this.ref}) : super(LoginStateInit());
|
LoginNotifier({required this.ref}) : super(LoginStateInit());
|
||||||
void login({
|
void login({
|
||||||
required String username,
|
required String email,
|
||||||
required String dokterId,
|
// required String dokterId,
|
||||||
required String password,
|
required String password,
|
||||||
}) async {
|
}) async {
|
||||||
try {
|
try {
|
||||||
state = LoginStateLoading();
|
state = LoginStateLoading();
|
||||||
final resp = await AuthRepository(dio: ref.read(dioProvider))
|
final resp = await AuthRepository(dio: ref.read(dioProvider))
|
||||||
.login(username: username, dokterId: dokterId, password: password);
|
.login(email: email, password: password);
|
||||||
|
|
||||||
// print(resp);
|
// print(resp);
|
||||||
state = LoginStateDone(model: resp);
|
state = LoginStateDone(model: resp);
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ import '../../app/route.dart';
|
|||||||
import '../../model/auth_model.dart';
|
import '../../model/auth_model.dart';
|
||||||
import '../../provider/current_menu_provider.dart';
|
import '../../provider/current_menu_provider.dart';
|
||||||
import '../../provider/current_user_provider.dart';
|
import '../../provider/current_user_provider.dart';
|
||||||
import 'block_body.dart';
|
|
||||||
import 'block_bodyv2.dart';
|
import 'block_bodyv2.dart';
|
||||||
import 'login_form.dart';
|
import 'login_form.dart';
|
||||||
|
|
||||||
@@ -30,18 +29,20 @@ class LoginScreen extends HookConsumerWidget {
|
|||||||
final authModel = AuthModel(
|
final authModel = AuthModel(
|
||||||
token: xmodel["token"],
|
token: xmodel["token"],
|
||||||
model: AuthDoctorModel(
|
model: AuthDoctorModel(
|
||||||
M_UserM_DoctorID: xmodel["model"]["M_UserM_DoctorID"],
|
// M_UserM_DoctorID: xmodel["model"]["M_UserM_DoctorID"],
|
||||||
M_UserUsername: xmodel["model"]["M_UserUsername"],
|
M_UserEmail: xmodel["model"]["M_UserEmail"],
|
||||||
M_UserM_DoctorCode: xmodel["model"]["M_UserM_DoctorCode"],
|
M_UserUsername: xmodel["model"]["M_UserUsername"],
|
||||||
M_UserM_MouID: xmodel["model"]["M_UserM_MouID"] ?? "",
|
// M_UserM_DoctorCode: xmodel["model"]["M_UserM_DoctorCode"],
|
||||||
M_UserID: xmodel["model"]["M_UserID"]),
|
// M_UserM_MouID: xmodel["model"]["M_UserM_MouID"] ?? "",
|
||||||
|
M_UserID: xmodel["model"]["M_UserID"],
|
||||||
|
),
|
||||||
);
|
);
|
||||||
ref.read(currentUserProvider.notifier).state = authModel;
|
ref.read(currentUserProvider.notifier).state = authModel;
|
||||||
|
|
||||||
ref.read(currentPageProvider.state).update((state) => 0);
|
// ref.read(currentPageProvider.state).update((state) => 0);
|
||||||
|
|
||||||
Navigator.of(context).pushNamedAndRemoveUntil(
|
Navigator.of(context).pushNamedAndRemoveUntil(
|
||||||
menuRoute,
|
homeRoute,
|
||||||
(route) => false,
|
(route) => false,
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -52,8 +52,8 @@ class SplashScreen extends HookConsumerWidget {
|
|||||||
width: Constant.getActualXPhone(context: context, x: 390),
|
width: Constant.getActualXPhone(context: context, x: 390),
|
||||||
height: Constant.getActualYPhone(context: context, y: 844),
|
height: Constant.getActualYPhone(context: context, y: 844),
|
||||||
child: Image.asset(
|
child: Image.asset(
|
||||||
"images/splashscreen.png",
|
"images/logo_splash_screen.png",
|
||||||
fit: BoxFit.cover,
|
// fit: BoxFit.width,
|
||||||
// scale: 1,
|
// scale: 1,
|
||||||
),
|
),
|
||||||
// color: Colors.green,
|
// color: Colors.green,
|
||||||
|
|||||||
@@ -648,7 +648,7 @@ class TransaksiScreen extends HookConsumerWidget {
|
|||||||
|
|
||||||
// Upload File
|
// Upload File
|
||||||
Container(
|
Container(
|
||||||
width: Constant.getActualXPhone(context: context, x: 336),
|
width: Constant.getActualXPhone(context: context, x: 390),
|
||||||
height: Constant.getActualYPhone(context: context, y: 83),
|
height: Constant.getActualYPhone(context: context, y: 83),
|
||||||
decoration: BoxDecoration(color: Constant.bgUploadFile),
|
decoration: BoxDecoration(color: Constant.bgUploadFile),
|
||||||
child: Column(
|
child: Column(
|
||||||
@@ -657,12 +657,13 @@ class TransaksiScreen extends HookConsumerWidget {
|
|||||||
children: [
|
children: [
|
||||||
Icon(
|
Icon(
|
||||||
Icons.upload_outlined,
|
Icons.upload_outlined,
|
||||||
|
color: Constant.pcBtnBackgroundColor,
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
'Upload File',
|
'Upload File',
|
||||||
style: Constant.body1(context: context).copyWith(
|
style: Constant.body1(context: context).copyWith(
|
||||||
fontWeight: FontWeight.w600,
|
fontWeight: FontWeight.w600,
|
||||||
color: Constant.textBlack),
|
color: Constant.pcBtnBackgroundColor),
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@@ -684,6 +685,20 @@ class TransaksiScreen extends HookConsumerWidget {
|
|||||||
width: Constant.getActualXPhone(context: context, x: 336),
|
width: Constant.getActualXPhone(context: context, x: 336),
|
||||||
height: Constant.getActualYPhone(context: context, y: 42),
|
height: Constant.getActualYPhone(context: context, y: 42),
|
||||||
child: ElevatedButton(
|
child: ElevatedButton(
|
||||||
|
style: ButtonStyle(
|
||||||
|
backgroundColor: MaterialStateColor.resolveWith((st) =>
|
||||||
|
Constant.pcBtnBackgroundColor),
|
||||||
|
shape: MaterialStateProperty.all<RoundedRectangleBorder>(
|
||||||
|
RoundedRectangleBorder(
|
||||||
|
borderRadius: BorderRadius.circular(8),
|
||||||
|
side: BorderSide(
|
||||||
|
color: Constant.pcBtnBackgroundColor,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
shadowColor: MaterialStateProperty.all(Color(0xffff48423d)),
|
||||||
|
elevation: MaterialStateProperty.all(4.0),
|
||||||
|
),
|
||||||
child: Stack(
|
child: Stack(
|
||||||
children: [
|
children: [
|
||||||
(transaksiIsLoading.value)
|
(transaksiIsLoading.value)
|
||||||
@@ -700,7 +715,7 @@ class TransaksiScreen extends HookConsumerWidget {
|
|||||||
'Simpan',
|
'Simpan',
|
||||||
style: Constant.body1(context: context).copyWith(
|
style: Constant.body1(context: context).copyWith(
|
||||||
fontWeight: FontWeight.w600,
|
fontWeight: FontWeight.w600,
|
||||||
color: Constant.textBlack),
|
color: Constant.white),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|||||||
Reference in New Issue
Block a user