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 textWhite = Color(0xffFDFDFD);
|
||||
static Color textGreen = Color(0xff0BAF48);
|
||||
static Color textGreyv2 = Color(0xff637381);
|
||||
static Color pcBtnBackgroundColor = Color(0xffF15A29);
|
||||
|
||||
// background upload file
|
||||
static Color bgUploadFile = Color(0xffF5F5F5);
|
||||
static Color bgUploadFile = Color.fromRGBO(207, 207, 207, 0.20);
|
||||
|
||||
//typoGraphy
|
||||
static TextStyle titleH1Login({required BuildContext context}) {
|
||||
|
||||
@@ -38,9 +38,9 @@ class MyApp extends StatelessWidget {
|
||||
},
|
||||
),
|
||||
debugShowCheckedModeBanner: false,
|
||||
// initialRoute: loginRoute,
|
||||
initialRoute: loginRoute,
|
||||
// initialRoute: splashScreen,
|
||||
initialRoute: transaksiRoute,
|
||||
// initialRoute: transaksiRoute,
|
||||
// initialRoute: reportRoute,
|
||||
// initialRoute: testFilePickerRoute,
|
||||
onGenerateRoute: AppRoute.generateRoute,
|
||||
|
||||
@@ -18,16 +18,17 @@ class AuthDoctorModel {
|
||||
// "ip": "139.194.156.91",
|
||||
// "agent": "PostmanRuntime/7.29.2"
|
||||
|
||||
late String doctorID;
|
||||
late String doctorName;
|
||||
// late String doctorID;
|
||||
// late String doctorName;
|
||||
|
||||
// new
|
||||
late String M_UserID;
|
||||
late String M_UserUsername;
|
||||
late String M_UserM_DoctorCode;
|
||||
late String M_UserM_DoctorID;
|
||||
late String M_UserM_StaffID;
|
||||
late String M_UserM_MouID;
|
||||
late String M_UserEmail;
|
||||
// late String M_UserM_DoctorCode;
|
||||
// late String M_UserM_DoctorID;
|
||||
// late String M_UserM_StaffID;
|
||||
// late String M_UserM_MouID;
|
||||
late String ip;
|
||||
late String agent;
|
||||
|
||||
@@ -37,10 +38,11 @@ class AuthDoctorModel {
|
||||
|
||||
required this.M_UserID,
|
||||
required this.M_UserUsername,
|
||||
required this.M_UserM_DoctorCode,
|
||||
required this.M_UserM_DoctorID,
|
||||
this.M_UserM_StaffID = "",
|
||||
this.M_UserM_MouID = "",
|
||||
required this.M_UserEmail,
|
||||
// required this.M_UserM_DoctorCode,
|
||||
// required this.M_UserM_DoctorID,
|
||||
// this.M_UserM_StaffID = "",
|
||||
// this.M_UserM_MouID = "",
|
||||
this.ip = "",
|
||||
this.agent = ""
|
||||
});
|
||||
@@ -48,10 +50,11 @@ class AuthDoctorModel {
|
||||
AuthDoctorModel.fromJson(Map<String, dynamic> json) {
|
||||
M_UserID = json['M_UserID'].toString();
|
||||
M_UserUsername = json['M_UserUsername'].toString();
|
||||
M_UserM_DoctorCode = json['M_UserM_DoctorCode'].toString();
|
||||
M_UserM_DoctorID = json['M_UserM_DoctorID'].toString();
|
||||
M_UserM_StaffID = json['M_UserM_StaffID'].toString();
|
||||
M_UserM_MouID = json['M_UserM_MouID'].toString();
|
||||
M_UserEmail = json['M_UserEmail'].toString();
|
||||
// M_UserM_DoctorCode = json['M_UserM_DoctorCode'].toString();
|
||||
// M_UserM_DoctorID = json['M_UserM_DoctorID'].toString();
|
||||
// M_UserM_StaffID = json['M_UserM_StaffID'].toString();
|
||||
// M_UserM_MouID = json['M_UserM_MouID'].toString();
|
||||
ip = json['ip'].toString();
|
||||
agent = json['agent'].toString();
|
||||
}
|
||||
@@ -60,10 +63,11 @@ class AuthDoctorModel {
|
||||
final Map<String, dynamic> data = <String, dynamic>{};
|
||||
data['M_UserID'] = M_UserID;
|
||||
data['M_UserUsername'] = M_UserUsername;
|
||||
data['M_UserM_DoctorCode'] = M_UserM_DoctorCode;
|
||||
data['M_UserM_DoctorID'] = M_UserM_DoctorID;
|
||||
data['M_UserM_StaffID'] = M_UserM_StaffID;
|
||||
data['M_UserM_MouID'] = M_UserM_MouID;
|
||||
data['M_UserEmail'] = M_UserEmail;
|
||||
// data['M_UserM_DoctorCode'] = M_UserM_DoctorCode;
|
||||
// data['M_UserM_DoctorID'] = M_UserM_DoctorID;
|
||||
// data['M_UserM_StaffID'] = M_UserM_StaffID;
|
||||
// data['M_UserM_MouID'] = M_UserM_MouID;
|
||||
data['ip'] = ip;
|
||||
data['agent'] = agent;
|
||||
|
||||
|
||||
@@ -6,13 +6,13 @@ class AuthRepository extends BaseRepository {
|
||||
AuthRepository({required super.dio});
|
||||
|
||||
Future<AuthModel> login({
|
||||
required String username,
|
||||
required String dokterId,
|
||||
required String email,
|
||||
// required String dokterId,
|
||||
required String password,
|
||||
}) async {
|
||||
final param = {
|
||||
"username": username,
|
||||
"doctor_id": dokterId,
|
||||
"email": email,
|
||||
// "doctor_id": dokterId,
|
||||
"password": password
|
||||
|
||||
// "username": "alhadad1",
|
||||
@@ -21,6 +21,7 @@ class AuthRepository extends BaseRepository {
|
||||
};
|
||||
// final service = "${Constant.baseUrlDevone}xauth/login";
|
||||
final service = "${Constant.baseUrlDevone}auth/login";
|
||||
print('url login $service');
|
||||
final resp = await post(param: param, service: service);
|
||||
final result = AuthModel(
|
||||
token: resp["data"]["token"],
|
||||
@@ -42,6 +43,7 @@ class AuthRepository extends BaseRepository {
|
||||
};
|
||||
|
||||
final service = "${Constant.baseUrlDevone}auth/logout";
|
||||
print('url login $service');
|
||||
final resp = await post(param: param, service: service);
|
||||
|
||||
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) {
|
||||
isLoading.value = false;
|
||||
isSuccess.value = true;
|
||||
ref.read(currentPageProvider.state).update((state) => 0);
|
||||
// ref.read(currentPageProvider.state).update((state) => 0);
|
||||
ref.read(currentUserProvider.notifier).state = next.model;
|
||||
|
||||
// print(next.model.model.doctorName);
|
||||
@@ -102,7 +102,12 @@ class LoginFormScreen extends HookConsumerWidget {
|
||||
Container(
|
||||
width: Constant.getActualXPhone(context: context, x: 390),
|
||||
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(
|
||||
width: Constant.getActualXPhone(context: context, x: 390),
|
||||
@@ -138,7 +143,7 @@ class LoginFormScreen extends HookConsumerWidget {
|
||||
'Silahkan masuk untuk mengakses akun Anda',
|
||||
style: Constant.body1(context: context).copyWith(
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Constant.textBlack),
|
||||
color: Constant.textGreyv2),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
@@ -176,11 +181,11 @@ class LoginFormScreen extends HookConsumerWidget {
|
||||
decoration: InputDecoration(
|
||||
hintStyle:
|
||||
Constant.body2_400(context: context).copyWith(
|
||||
color: Colors.orange,
|
||||
color: Constant.textGreyv2,
|
||||
),
|
||||
labelStyle:
|
||||
Constant.body2_400(context: context).copyWith(
|
||||
color: Colors.orange,
|
||||
color: Constant.textGreyv2,
|
||||
),
|
||||
border: OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
@@ -190,11 +195,11 @@ class LoginFormScreen extends HookConsumerWidget {
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: Colors.orange,
|
||||
color: Constant.textGreyv2,
|
||||
width: 1,
|
||||
),
|
||||
),
|
||||
// labelText: "Nama Pengirim",
|
||||
// labelText: "Masukkan Email",
|
||||
// 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 != "") ...[
|
||||
SizedBox(
|
||||
height:
|
||||
@@ -297,51 +293,70 @@ class LoginFormScreen extends HookConsumerWidget {
|
||||
height:
|
||||
Constant.getActualYPhone(context: context, y: 50),
|
||||
child: ElevatedButton(
|
||||
onPressed: () {
|
||||
Navigator.of(context).pushNamed(homeRoute);
|
||||
},
|
||||
// onPressed: (isSuccess.value == true)
|
||||
// ? () {}
|
||||
// : () {
|
||||
// if (ctrlEmail.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: ctrlEmail.text,
|
||||
// dokterId: ctrlDokterId.text,
|
||||
// password: ctrlPassword.text);
|
||||
// }
|
||||
// },
|
||||
// onPressed: () {
|
||||
// Navigator.of(context).pushNamed(homeRoute);
|
||||
// },
|
||||
onPressed: (isSuccess.value == true)
|
||||
? () {}
|
||||
: () {
|
||||
if (ctrlEmail.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(
|
||||
email: ctrlEmail.text,
|
||||
password: ctrlPassword.text,
|
||||
);
|
||||
}
|
||||
},
|
||||
style: ButtonStyle(
|
||||
backgroundColor: MaterialStateColor.resolveWith(
|
||||
(st) => (isSuccess.value == true)
|
||||
? Constant.textGrey
|
||||
: Colors.orange),
|
||||
: Constant.pcBtnBackgroundColor),
|
||||
shape: MaterialStateProperty.all<
|
||||
RoundedRectangleBorder>(
|
||||
RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
side: BorderSide(color: Colors.orange),
|
||||
side: BorderSide(
|
||||
color: Constant.pcBtnBackgroundColor,
|
||||
),
|
||||
),
|
||||
),
|
||||
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),
|
||||
),
|
||||
child: Stack(
|
||||
children: [
|
||||
(isLoading.value)
|
||||
? SizedBox(
|
||||
width: Constant.getActualXPhone(
|
||||
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;
|
||||
LoginNotifier({required this.ref}) : super(LoginStateInit());
|
||||
void login({
|
||||
required String username,
|
||||
required String dokterId,
|
||||
required String email,
|
||||
// required String dokterId,
|
||||
required String password,
|
||||
}) async {
|
||||
try {
|
||||
state = LoginStateLoading();
|
||||
final resp = await AuthRepository(dio: ref.read(dioProvider))
|
||||
.login(username: username, dokterId: dokterId, password: password);
|
||||
.login(email: email, password: password);
|
||||
|
||||
// print(resp);
|
||||
state = LoginStateDone(model: resp);
|
||||
|
||||
@@ -12,7 +12,6 @@ import '../../app/route.dart';
|
||||
import '../../model/auth_model.dart';
|
||||
import '../../provider/current_menu_provider.dart';
|
||||
import '../../provider/current_user_provider.dart';
|
||||
import 'block_body.dart';
|
||||
import 'block_bodyv2.dart';
|
||||
import 'login_form.dart';
|
||||
|
||||
@@ -30,18 +29,20 @@ class LoginScreen extends HookConsumerWidget {
|
||||
final authModel = AuthModel(
|
||||
token: xmodel["token"],
|
||||
model: AuthDoctorModel(
|
||||
M_UserM_DoctorID: xmodel["model"]["M_UserM_DoctorID"],
|
||||
M_UserUsername: xmodel["model"]["M_UserUsername"],
|
||||
M_UserM_DoctorCode: xmodel["model"]["M_UserM_DoctorCode"],
|
||||
M_UserM_MouID: xmodel["model"]["M_UserM_MouID"] ?? "",
|
||||
M_UserID: xmodel["model"]["M_UserID"]),
|
||||
// M_UserM_DoctorID: xmodel["model"]["M_UserM_DoctorID"],
|
||||
M_UserEmail: xmodel["model"]["M_UserEmail"],
|
||||
M_UserUsername: xmodel["model"]["M_UserUsername"],
|
||||
// M_UserM_DoctorCode: xmodel["model"]["M_UserM_DoctorCode"],
|
||||
// M_UserM_MouID: xmodel["model"]["M_UserM_MouID"] ?? "",
|
||||
M_UserID: xmodel["model"]["M_UserID"],
|
||||
),
|
||||
);
|
||||
ref.read(currentUserProvider.notifier).state = authModel;
|
||||
|
||||
ref.read(currentPageProvider.state).update((state) => 0);
|
||||
// ref.read(currentPageProvider.state).update((state) => 0);
|
||||
|
||||
Navigator.of(context).pushNamedAndRemoveUntil(
|
||||
menuRoute,
|
||||
homeRoute,
|
||||
(route) => false,
|
||||
);
|
||||
});
|
||||
|
||||
@@ -52,8 +52,8 @@ class SplashScreen extends HookConsumerWidget {
|
||||
width: Constant.getActualXPhone(context: context, x: 390),
|
||||
height: Constant.getActualYPhone(context: context, y: 844),
|
||||
child: Image.asset(
|
||||
"images/splashscreen.png",
|
||||
fit: BoxFit.cover,
|
||||
"images/logo_splash_screen.png",
|
||||
// fit: BoxFit.width,
|
||||
// scale: 1,
|
||||
),
|
||||
// color: Colors.green,
|
||||
|
||||
@@ -648,7 +648,7 @@ class TransaksiScreen extends HookConsumerWidget {
|
||||
|
||||
// Upload File
|
||||
Container(
|
||||
width: Constant.getActualXPhone(context: context, x: 336),
|
||||
width: Constant.getActualXPhone(context: context, x: 390),
|
||||
height: Constant.getActualYPhone(context: context, y: 83),
|
||||
decoration: BoxDecoration(color: Constant.bgUploadFile),
|
||||
child: Column(
|
||||
@@ -657,12 +657,13 @@ class TransaksiScreen extends HookConsumerWidget {
|
||||
children: [
|
||||
Icon(
|
||||
Icons.upload_outlined,
|
||||
color: Constant.pcBtnBackgroundColor,
|
||||
),
|
||||
Text(
|
||||
'Upload File',
|
||||
style: Constant.body1(context: context).copyWith(
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Constant.textBlack),
|
||||
color: Constant.pcBtnBackgroundColor),
|
||||
)
|
||||
],
|
||||
),
|
||||
@@ -684,6 +685,20 @@ class TransaksiScreen extends HookConsumerWidget {
|
||||
width: Constant.getActualXPhone(context: context, x: 336),
|
||||
height: Constant.getActualYPhone(context: context, y: 42),
|
||||
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(
|
||||
children: [
|
||||
(transaksiIsLoading.value)
|
||||
@@ -700,7 +715,7 @@ class TransaksiScreen extends HookConsumerWidget {
|
||||
'Simpan',
|
||||
style: Constant.body1(context: context).copyWith(
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Constant.textBlack),
|
||||
color: Constant.white),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user