perform patch
parent
3bfef21678
commit
d80b36ed8f
|
@ -29,7 +29,7 @@ class ReferencesBloc extends Bloc<ReferencesEvent, ReferencesState> {
|
||||||
references = refs;
|
references = refs;
|
||||||
emit(ReferencesLoadedState(references: references));
|
emit(ReferencesLoadedState(references: references));
|
||||||
}
|
}
|
||||||
|
emit(ReferencesLoadedState(references: references));
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
emit( ReferencesErrorState(message: e.toString()));
|
emit( ReferencesErrorState(message: e.toString()));
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@ import 'package:equatable/equatable.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:fluttertoast/fluttertoast.dart';
|
import 'package:fluttertoast/fluttertoast.dart';
|
||||||
import 'package:unit2/model/roles/pass_check/passer_info.dart';
|
import 'package:unit2/model/roles/pass_check/passer_info.dart';
|
||||||
|
import 'package:unit2/screens/unit2/homepage.dart/components/dashboard/dashboard.dart';
|
||||||
import 'package:unit2/sevices/roles/pass_check_services.dart';
|
import 'package:unit2/sevices/roles/pass_check_services.dart';
|
||||||
import '../../../utils/scanner.dart';
|
import '../../../utils/scanner.dart';
|
||||||
part 'pass_check_event.dart';
|
part 'pass_check_event.dart';
|
||||||
|
@ -12,7 +13,7 @@ part 'pass_check_state.dart';
|
||||||
|
|
||||||
class PassCheckBloc extends Bloc<PassCheckEvent, PassCheckState> {
|
class PassCheckBloc extends Bloc<PassCheckEvent, PassCheckState> {
|
||||||
PassCheckBloc() : super(PassCheckInitial()) {
|
PassCheckBloc() : super(PassCheckInitial()) {
|
||||||
int? roleId;
|
RoleIdRoleName? roleIdRoleName;
|
||||||
String? uuid;
|
String? uuid;
|
||||||
bool? otherInputs;
|
bool? otherInputs;
|
||||||
String? io;
|
String? io;
|
||||||
|
@ -25,9 +26,8 @@ class PassCheckBloc extends Bloc<PassCheckEvent, PassCheckState> {
|
||||||
try {
|
try {
|
||||||
emit(PassCheckLoadingState());
|
emit(PassCheckLoadingState());
|
||||||
List<dynamic> response = await PassCheckServices.instance
|
List<dynamic> response = await PassCheckServices.instance
|
||||||
.getPassCheckArea(roleId: event.roleId, userId: event.userId);
|
.getPassCheckArea(roleIdRoleName:RoleIdRoleName(roleId: event.roleIdRoleName.roleId, roleName: event.roleIdRoleName.roleName), userId: event.userId);
|
||||||
roleId = event.roleId;
|
emit(AssignAreaLoaded(assignedArea: response, roleIdRoleName: RoleIdRoleName(roleId: event.roleIdRoleName.roleId, roleName: event.roleIdRoleName.roleName)));
|
||||||
emit(AssignAreaLoaded(assignedArea: response, roleId: roleId!));
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
emit(PassCheckErrorState(message: e.toString()));
|
emit(PassCheckErrorState(message: e.toString()));
|
||||||
}
|
}
|
||||||
|
@ -37,14 +37,14 @@ class PassCheckBloc extends Bloc<PassCheckEvent, PassCheckState> {
|
||||||
checkerId = event.checkerId;
|
checkerId = event.checkerId;
|
||||||
io = event.entranceExit;
|
io = event.entranceExit;
|
||||||
token = event.token;
|
token = event.token;
|
||||||
roleId = event.roleId;
|
roleIdRoleName = event.roleIdRoleName;
|
||||||
assignedArea = event.assignedArea;
|
assignedArea = event.assignedArea;
|
||||||
emit(SettingSaved(
|
emit(SettingSaved(
|
||||||
assignedArea: assignedArea,
|
assignedArea: assignedArea,
|
||||||
checker: checkerId!,
|
checker: checkerId!,
|
||||||
io: io!,
|
io: io!,
|
||||||
otherInputs: otherInputs!,
|
otherInputs: otherInputs!,
|
||||||
roleId: roleId!,
|
roleIdRoleName: roleIdRoleName!,
|
||||||
token: token!));
|
token: token!));
|
||||||
});
|
});
|
||||||
on<ScanError>((event, emit) {
|
on<ScanError>((event, emit) {
|
||||||
|
@ -53,7 +53,7 @@ class PassCheckBloc extends Bloc<PassCheckEvent, PassCheckState> {
|
||||||
checker: checkerId!,
|
checker: checkerId!,
|
||||||
io: io!,
|
io: io!,
|
||||||
otherInputs: otherInputs!,
|
otherInputs: otherInputs!,
|
||||||
roleId: roleId!,
|
roleIdRoleName: roleIdRoleName!,
|
||||||
token: token!));
|
token: token!));
|
||||||
});
|
});
|
||||||
on<PerformIncomingPostLog>((event, emit) {
|
on<PerformIncomingPostLog>((event, emit) {
|
||||||
|
@ -64,7 +64,7 @@ class PassCheckBloc extends Bloc<PassCheckEvent, PassCheckState> {
|
||||||
io: io!.toLowerCase() == "incoming" ? "i" : "o",
|
io: io!.toLowerCase() == "incoming" ? "i" : "o",
|
||||||
otherInputs: otherInputs!,
|
otherInputs: otherInputs!,
|
||||||
passerId: uuid!,
|
passerId: uuid!,
|
||||||
roleId: roleId!,
|
roleId: roleIdRoleName!.roleId,
|
||||||
stationId: stationId,
|
stationId: stationId,
|
||||||
temp: event.temp));
|
temp: event.temp));
|
||||||
});
|
});
|
||||||
|
@ -77,7 +77,7 @@ class PassCheckBloc extends Bloc<PassCheckEvent, PassCheckState> {
|
||||||
io: io!.toLowerCase() == "incoming" ? "i" : "o",
|
io: io!.toLowerCase() == "incoming" ? "i" : "o",
|
||||||
otherInputs: otherInputs!,
|
otherInputs: otherInputs!,
|
||||||
passerId: uuid!,
|
passerId: uuid!,
|
||||||
roleId: roleId!,
|
roleId: roleIdRoleName!.roleId,
|
||||||
stationId: stationId,
|
stationId: stationId,
|
||||||
temp: null));
|
temp: null));
|
||||||
});
|
});
|
||||||
|
@ -89,13 +89,13 @@ class PassCheckBloc extends Bloc<PassCheckEvent, PassCheckState> {
|
||||||
try {
|
try {
|
||||||
PasserInfo? passerInfo = await PassCheckServices.instance
|
PasserInfo? passerInfo = await PassCheckServices.instance
|
||||||
.getPasserInfo(uuid: uuid!, token: event.token);
|
.getPasserInfo(uuid: uuid!, token: event.token);
|
||||||
if (roleId == 41 || roleId == 13 || roleId == 17 || roleId == 22) {
|
if (roleIdRoleName!.roleName.toLowerCase() == "41" || roleIdRoleName!.roleName.toLowerCase() == 'qr code scanner' || roleIdRoleName!.roleName.toLowerCase() == 'office/branch chief' || roleIdRoleName!.roleName.toLowerCase() == 'registration in-charge') {
|
||||||
stationId = assignedArea.id;
|
stationId = assignedArea.id;
|
||||||
} else if (roleId == 7) {
|
} else if (roleIdRoleName!.roleName.toLowerCase() == 'barangay chairperson') {
|
||||||
cpId = assignedArea.brgycode;
|
cpId = assignedArea.brgycode;
|
||||||
} else if (roleId == 10) {
|
} else if (roleIdRoleName!.roleName.toLowerCase() == 'purok pres') {
|
||||||
cpId = assignedArea.purokdesc;
|
cpId = assignedArea.purokdesc;
|
||||||
} else if (roleId == 16) {
|
} else if (roleIdRoleName!.roleName.toLowerCase() == 'establishment point-person') {
|
||||||
cpId = assignedArea.id;
|
cpId = assignedArea.id;
|
||||||
}
|
}
|
||||||
if (passerInfo == null) {
|
if (passerInfo == null) {
|
||||||
|
@ -122,7 +122,7 @@ class PassCheckBloc extends Bloc<PassCheckEvent, PassCheckState> {
|
||||||
io: io!.toLowerCase() == "incoming" ? "i" : "o",
|
io: io!.toLowerCase() == "incoming" ? "i" : "o",
|
||||||
otherInputs: otherInputs!,
|
otherInputs: otherInputs!,
|
||||||
passerId: uuid!,
|
passerId: uuid!,
|
||||||
roleId: roleId!,
|
roleId: roleIdRoleName!.roleId,
|
||||||
stationId: stationId,
|
stationId: stationId,
|
||||||
temp: null));
|
temp: null));
|
||||||
}
|
}
|
||||||
|
@ -136,7 +136,7 @@ class PassCheckBloc extends Bloc<PassCheckEvent, PassCheckState> {
|
||||||
checker: checkerId!,
|
checker: checkerId!,
|
||||||
io: io!,
|
io: io!,
|
||||||
otherInputs: otherInputs!,
|
otherInputs: otherInputs!,
|
||||||
roleId: roleId!,
|
roleIdRoleName: roleIdRoleName!,
|
||||||
token: token!));
|
token: token!));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -8,13 +8,13 @@ abstract class PassCheckEvent extends Equatable {
|
||||||
}
|
}
|
||||||
|
|
||||||
class GetPassCheckAreas extends PassCheckEvent {
|
class GetPassCheckAreas extends PassCheckEvent {
|
||||||
final int roleId;
|
final RoleIdRoleName roleIdRoleName;
|
||||||
final int userId;
|
final int userId;
|
||||||
const GetPassCheckAreas({required this.roleId, required this.userId});
|
const GetPassCheckAreas({required this.roleIdRoleName, required this.userId});
|
||||||
}
|
}
|
||||||
|
|
||||||
class SetScannerSettings extends PassCheckEvent {
|
class SetScannerSettings extends PassCheckEvent {
|
||||||
final int roleId;
|
final RoleIdRoleName roleIdRoleName;
|
||||||
final String token;
|
final String token;
|
||||||
final dynamic assignedArea;
|
final dynamic assignedArea;
|
||||||
final bool includeOtherInputs;
|
final bool includeOtherInputs;
|
||||||
|
@ -25,7 +25,7 @@ class SetScannerSettings extends PassCheckEvent {
|
||||||
required this.checkerId,
|
required this.checkerId,
|
||||||
required this.entranceExit,
|
required this.entranceExit,
|
||||||
required this.includeOtherInputs,
|
required this.includeOtherInputs,
|
||||||
required this.roleId,
|
required this.roleIdRoleName,
|
||||||
required this.token});
|
required this.token});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,8 +23,8 @@ class PassCheckLoadingState extends PassCheckState {}
|
||||||
|
|
||||||
class AssignAreaLoaded extends PassCheckState {
|
class AssignAreaLoaded extends PassCheckState {
|
||||||
final List<dynamic> assignedArea;
|
final List<dynamic> assignedArea;
|
||||||
final int roleId;
|
final RoleIdRoleName roleIdRoleName;
|
||||||
const AssignAreaLoaded({required this.assignedArea, required this.roleId});
|
const AssignAreaLoaded({required this.assignedArea, required this.roleIdRoleName});
|
||||||
}
|
}
|
||||||
|
|
||||||
class SettingSaved extends PassCheckState {
|
class SettingSaved extends PassCheckState {
|
||||||
|
@ -33,13 +33,13 @@ class SettingSaved extends PassCheckState {
|
||||||
final String io;
|
final String io;
|
||||||
final int checker;
|
final int checker;
|
||||||
final bool otherInputs;
|
final bool otherInputs;
|
||||||
final int roleId;
|
final RoleIdRoleName roleIdRoleName;
|
||||||
const SettingSaved(
|
const SettingSaved(
|
||||||
{required this.assignedArea,
|
{required this.assignedArea,
|
||||||
required this.checker,
|
required this.checker,
|
||||||
required this.io,
|
required this.io,
|
||||||
required this.otherInputs,
|
required this.otherInputs,
|
||||||
required this.roleId,
|
required this.roleIdRoleName,
|
||||||
required this.token});
|
required this.token});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -107,6 +107,8 @@ class UserBloc extends Bloc<UserEvent, UserState> {
|
||||||
emit(InternetTimeout(message: timeoutError));
|
emit(InternetTimeout(message: timeoutError));
|
||||||
} on Error catch (e) {
|
} on Error catch (e) {
|
||||||
emit(LoginErrorState(message: e.toString()));
|
emit(LoginErrorState(message: e.toString()));
|
||||||
|
}catch(e){
|
||||||
|
emit(LoginErrorState(message: e.toString()));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
on<UuidLogin>((event, emit) async {
|
on<UuidLogin>((event, emit) async {
|
||||||
|
|
|
@ -35,7 +35,7 @@ class RbacRoleAssignment extends StatelessWidget {
|
||||||
elevation: 0,
|
elevation: 0,
|
||||||
centerTitle: true,
|
centerTitle: true,
|
||||||
backgroundColor: primary,
|
backgroundColor: primary,
|
||||||
title: const Text("User Roles Screenss"),
|
title: const Text("User Roles Screens"),
|
||||||
actions: [
|
actions: [
|
||||||
AddLeading(onPressed: () {
|
AddLeading(onPressed: () {
|
||||||
BuildContext parent = context;
|
BuildContext parent = context;
|
||||||
|
|
|
@ -3,6 +3,7 @@ import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
import 'package:flutter_staggered_animations/flutter_staggered_animations.dart';
|
import 'package:flutter_staggered_animations/flutter_staggered_animations.dart';
|
||||||
import 'package:fluttericon/font_awesome5_icons.dart';
|
import 'package:fluttericon/font_awesome5_icons.dart';
|
||||||
import 'package:unit2/model/login_data/user_info/assigned_area.dart';
|
import 'package:unit2/model/login_data/user_info/assigned_area.dart';
|
||||||
|
import 'package:unit2/model/rbac/assigned_role.dart';
|
||||||
import 'package:unit2/screens/unit2/homepage.dart/components/dashboard/dashboard_icon_generator.dart';
|
import 'package:unit2/screens/unit2/homepage.dart/components/dashboard/dashboard_icon_generator.dart';
|
||||||
import 'package:unit2/screens/unit2/homepage.dart/components/dashboard/superadmin_expanded_menu.dart';
|
import 'package:unit2/screens/unit2/homepage.dart/components/dashboard/superadmin_expanded_menu.dart';
|
||||||
import 'package:unit2/screens/unit2/homepage.dart/module-screen.dart';
|
import 'package:unit2/screens/unit2/homepage.dart/module-screen.dart';
|
||||||
|
@ -68,10 +69,6 @@ class _DashBoardState extends State<DashBoard> {
|
||||||
docSmsCards.add(e);
|
docSmsCards.add(e);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
unit2Cards.forEach((element) {
|
|
||||||
print(
|
|
||||||
"${element.moduleName} - ${element.object.name!} - ${element.roleName} ");
|
|
||||||
});
|
|
||||||
if (superadminCards.length > 3) {
|
if (superadminCards.length > 3) {
|
||||||
tempSuperAdminCards = superadminCards.sublist(0, 4);
|
tempSuperAdminCards = superadminCards.sublist(0, 4);
|
||||||
}
|
}
|
||||||
|
@ -79,6 +76,10 @@ class _DashBoardState extends State<DashBoard> {
|
||||||
tempUnit2Cards = unit2Cards.sublist(0, 4);
|
tempUnit2Cards = unit2Cards.sublist(0, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
superadminCards.forEach((el) {
|
||||||
|
print(el.object.name);
|
||||||
|
});
|
||||||
|
|
||||||
return Container(
|
return Container(
|
||||||
padding:
|
padding:
|
||||||
const EdgeInsetsDirectional.symmetric(vertical: 24, horizontal: 24),
|
const EdgeInsetsDirectional.symmetric(vertical: 24, horizontal: 24),
|
||||||
|
@ -196,7 +197,7 @@ class _DashBoardState extends State<DashBoard> {
|
||||||
: e.object.name!,
|
: e.object.name!,
|
||||||
ontap: () {
|
ontap: () {
|
||||||
if (e.object.name!.toLowerCase() == 'pass check') {
|
if (e.object.name!.toLowerCase() == 'pass check') {
|
||||||
PassCheckArguments passCheckArguments = PassCheckArguments(roleId: e.roleId, userId: widget.userId);
|
PassCheckArguments passCheckArguments = PassCheckArguments(roleIdRoleName: RoleIdRoleName(roleId: e.roleId, roleName: e.roleName), userId: widget.userId);
|
||||||
Navigator.pushNamed(context, '/pass-check', arguments: passCheckArguments);
|
Navigator.pushNamed(context, '/pass-check', arguments: passCheckArguments);
|
||||||
}
|
}
|
||||||
if (e.object.name!.toLowerCase() == 'role based access control') {
|
if (e.object.name!.toLowerCase() == 'role based access control') {
|
||||||
|
@ -312,7 +313,7 @@ class _DashBoardState extends State<DashBoard> {
|
||||||
PassCheckArguments
|
PassCheckArguments
|
||||||
passCheckArguments =
|
passCheckArguments =
|
||||||
PassCheckArguments(
|
PassCheckArguments(
|
||||||
roleId: 10,
|
roleIdRoleName: RoleIdRoleName(roleId: e.roleId, roleName: e.roleName),
|
||||||
userId:
|
userId:
|
||||||
widget.userId);
|
widget.userId);
|
||||||
Navigator.pushNamed(
|
Navigator.pushNamed(
|
||||||
|
@ -386,7 +387,7 @@ class _DashBoardState extends State<DashBoard> {
|
||||||
PassCheckArguments
|
PassCheckArguments
|
||||||
passCheckArguments =
|
passCheckArguments =
|
||||||
PassCheckArguments(
|
PassCheckArguments(
|
||||||
roleId: 10,
|
roleIdRoleName: RoleIdRoleName(roleId: e.roleId,roleName: e.roleName),
|
||||||
userId: widget.userId);
|
userId: widget.userId);
|
||||||
Navigator.pushNamed(
|
Navigator.pushNamed(
|
||||||
context, '/pass-check',
|
context, '/pass-check',
|
||||||
|
@ -647,7 +648,8 @@ class _DashBoardState extends State<DashBoard> {
|
||||||
? "Field Surveyor"
|
? "Field Surveyor"
|
||||||
: e.object.name!,
|
: e.object.name!,
|
||||||
ontap: () {
|
ontap: () {
|
||||||
Navigator.pushNamed(context, '/passo-home');
|
Navigator.pushNamed(
|
||||||
|
context, '/passo-home');
|
||||||
})
|
})
|
||||||
: Container(
|
: Container(
|
||||||
color: Colors.black,
|
color: Colors.black,
|
||||||
|
@ -706,7 +708,13 @@ class _DashBoardState extends State<DashBoard> {
|
||||||
}
|
}
|
||||||
|
|
||||||
class PassCheckArguments {
|
class PassCheckArguments {
|
||||||
final int roleId;
|
final RoleIdRoleName roleIdRoleName;
|
||||||
final int userId;
|
final int userId;
|
||||||
const PassCheckArguments({required this.roleId, required this.userId});
|
const PassCheckArguments({required this.roleIdRoleName, required this.userId});
|
||||||
|
}
|
||||||
|
|
||||||
|
class RoleIdRoleName{
|
||||||
|
final int roleId;
|
||||||
|
final String roleName;
|
||||||
|
const RoleIdRoleName({required this.roleId, required this.roleName});
|
||||||
}
|
}
|
||||||
|
|
|
@ -271,6 +271,7 @@ class SuperAdminMenu extends StatelessWidget {
|
||||||
roleAssignmentKey
|
roleAssignmentKey
|
||||||
.currentState!
|
.currentState!
|
||||||
.value['lastname'];
|
.value['lastname'];
|
||||||
|
Navigator.of(context).pop();
|
||||||
Navigator.push(context,
|
Navigator.push(context,
|
||||||
MaterialPageRoute(builder:
|
MaterialPageRoute(builder:
|
||||||
(BuildContext
|
(BuildContext
|
||||||
|
|
|
@ -47,7 +47,7 @@ class _UniT2LoginState extends State<UniT2Login> {
|
||||||
indicatorWidget: const SpinKitFadingCircle(color: Colors.white),
|
indicatorWidget: const SpinKitFadingCircle(color: Colors.white),
|
||||||
child: BlocConsumer<UserBloc, UserState>(listener: (context, state) {
|
child: BlocConsumer<UserBloc, UserState>(listener: (context, state) {
|
||||||
print(state);
|
print(state);
|
||||||
if (state is UserLoggedIn || state is UuidLoaded) {
|
if (state is UserLoggedIn || state is UuidLoaded || state is LoginErrorState) {
|
||||||
final progress = ProgressHUD.of(context);
|
final progress = ProgressHUD.of(context);
|
||||||
progress!.dismiss();
|
progress!.dismiss();
|
||||||
}
|
}
|
||||||
|
@ -94,6 +94,7 @@ class _UniT2LoginState extends State<UniT2Login> {
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
}, builder: (context, state) {
|
}, builder: (context, state) {
|
||||||
|
print(state);
|
||||||
if (state is VersionLoaded) {
|
if (state is VersionLoaded) {
|
||||||
return Builder(builder: (context) {
|
return Builder(builder: (context) {
|
||||||
if (state.versionInfo!.version != state.apkVersion) {
|
if (state.versionInfo!.version != state.apkVersion) {
|
||||||
|
@ -251,9 +252,7 @@ class _UniT2LoginState extends State<UniT2Login> {
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
final progress =
|
final progress =
|
||||||
ProgressHUD.of(context);
|
ProgressHUD.of(context);
|
||||||
|
|
||||||
FocusScope.of(context).unfocus();
|
FocusScope.of(context).unfocus();
|
||||||
|
|
||||||
if (_formKey.currentState!
|
if (_formKey.currentState!
|
||||||
.saveAndValidate()) {
|
.saveAndValidate()) {
|
||||||
password = _formKey.currentState!
|
password = _formKey.currentState!
|
||||||
|
@ -263,7 +262,6 @@ class _UniT2LoginState extends State<UniT2Login> {
|
||||||
progress?.showWithText(
|
progress?.showWithText(
|
||||||
'Logging in...',
|
'Logging in...',
|
||||||
);
|
);
|
||||||
|
|
||||||
BlocProvider.of<UserBloc>(context)
|
BlocProvider.of<UserBloc>(context)
|
||||||
.add(UserLogin(
|
.add(UserLogin(
|
||||||
username: username,
|
username: username,
|
||||||
|
|
|
@ -302,28 +302,28 @@ class _QRCodeScannerState extends State<QRCodeScanner> {
|
||||||
children: [
|
children: [
|
||||||
SelectedState(
|
SelectedState(
|
||||||
//TODO add api data
|
//TODO add api data
|
||||||
title: state.roleId == 41 ||
|
title: state.roleIdRoleName.roleName.toLowerCase() == "41" ||
|
||||||
state.roleId == 13 ||
|
state.roleIdRoleName.roleName.toLowerCase() == 'qr code scanner' ||
|
||||||
state.roleId == 17 ||
|
state.roleIdRoleName.roleName.toLowerCase() == 'office/branch chief' ||
|
||||||
state.roleId == 22
|
state.roleIdRoleName.roleName.toLowerCase() == 'registration in-charge'
|
||||||
? state.assignedArea.stationName
|
? state.assignedArea.stationName
|
||||||
: state.roleId == 7
|
: state.roleIdRoleName.roleName.toLowerCase() == 'barangay chairperson'
|
||||||
? state.assignedArea.brgydesc
|
? state.assignedArea.brgydesc
|
||||||
: state.roleId == 10
|
: state.roleIdRoleName.roleName.toLowerCase() == 'purok president'
|
||||||
? state.assignedArea.purokdesc
|
? state.assignedArea.purokdesc
|
||||||
: state.roleId == 16
|
: state.roleIdRoleName.roleName.toLowerCase() == 'establishment point-person'
|
||||||
? "Agency"
|
? "Agency"
|
||||||
: "",
|
: "",
|
||||||
subtitle: state.roleId == 41 ||
|
subtitle: state.roleIdRoleName.roleName.toLowerCase() == "41" ||
|
||||||
state.roleId == 13 ||
|
state.roleIdRoleName.roleName.toLowerCase() == 'qr code scanner' ||
|
||||||
state.roleId == 17 ||
|
state.roleIdRoleName.roleName.toLowerCase() == 'office/branch chief' ||
|
||||||
state.roleId == 22
|
state.roleIdRoleName.roleName.toLowerCase() == 'registration in-charge'
|
||||||
? "Station"
|
? "Station"
|
||||||
: state.roleId == 7
|
: state.roleIdRoleName.roleName.toLowerCase() == 'barangay chairperson'
|
||||||
? "Barangay"
|
? "Barangay"
|
||||||
: state.roleId == 10
|
: state.roleIdRoleName.roleName.toLowerCase() == 'purok president'
|
||||||
? "Purok"
|
? "Purok"
|
||||||
: state.roleId == 16
|
: state.roleIdRoleName.roleName.toLowerCase() == 'establishment point-person'
|
||||||
? "Agency"
|
? "Agency"
|
||||||
: "",
|
: "",
|
||||||
),
|
),
|
||||||
|
|
|
@ -20,9 +20,9 @@ import '../../../../theme-data.dart/form-style.dart';
|
||||||
import '../../../../utils/global.dart';
|
import '../../../../utils/global.dart';
|
||||||
|
|
||||||
class QRCodeScannerSettings extends StatefulWidget {
|
class QRCodeScannerSettings extends StatefulWidget {
|
||||||
final int roleId;
|
final RoleIdRoleName roleIdRoleName;
|
||||||
final int userId;
|
final int userId;
|
||||||
const QRCodeScannerSettings({super.key, required this.roleId, required this.userId});
|
const QRCodeScannerSettings({super.key, required this.roleIdRoleName, required this.userId});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<QRCodeScannerSettings> createState() => _QRCodeScannerSettingsState();
|
State<QRCodeScannerSettings> createState() => _QRCodeScannerSettingsState();
|
||||||
|
@ -172,7 +172,7 @@ class _QRCodeScannerSettingsState extends State<QRCodeScannerSettings> {
|
||||||
|
|
||||||
////STATION
|
////STATION
|
||||||
Container(
|
Container(
|
||||||
child: state.roleId == 41
|
child: state.roleIdRoleName.roleName.toLowerCase() == "41"
|
||||||
? DropdownButtonFormField(
|
? DropdownButtonFormField(
|
||||||
isExpanded: true,
|
isExpanded: true,
|
||||||
validator: FormBuilderValidators
|
validator: FormBuilderValidators
|
||||||
|
@ -219,7 +219,7 @@ class _QRCodeScannerSettingsState extends State<QRCodeScannerSettings> {
|
||||||
},
|
},
|
||||||
////BARANGAY
|
////BARANGAY
|
||||||
)
|
)
|
||||||
: state.roleId == 7
|
: state.roleIdRoleName.roleName.toLowerCase() == 'barangay nurse'
|
||||||
? Column(
|
? Column(
|
||||||
crossAxisAlignment:
|
crossAxisAlignment:
|
||||||
CrossAxisAlignment
|
CrossAxisAlignment
|
||||||
|
@ -270,7 +270,7 @@ class _QRCodeScannerSettingsState extends State<QRCodeScannerSettings> {
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
////PUROK
|
////PUROK
|
||||||
state.roleId == 10
|
state.roleIdRoleName.roleName.toLowerCase() == 'checkpoint in-charge'
|
||||||
? Column(
|
? Column(
|
||||||
crossAxisAlignment:
|
crossAxisAlignment:
|
||||||
CrossAxisAlignment
|
CrossAxisAlignment
|
||||||
|
@ -323,7 +323,7 @@ class _QRCodeScannerSettingsState extends State<QRCodeScannerSettings> {
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
////Registration InCharge
|
////Registration InCharge
|
||||||
state.roleId == 22
|
state.roleIdRoleName.roleName.toLowerCase() == 'registration in-charge'
|
||||||
? Column(
|
? Column(
|
||||||
crossAxisAlignment:
|
crossAxisAlignment:
|
||||||
CrossAxisAlignment
|
CrossAxisAlignment
|
||||||
|
@ -398,7 +398,7 @@ class _QRCodeScannerSettingsState extends State<QRCodeScannerSettings> {
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
: ////QR Code Scanner
|
: ////QR Code Scanner
|
||||||
state.roleId == 13
|
state.roleIdRoleName.roleName.toLowerCase() == 'qr code scanner'
|
||||||
? Column(
|
? Column(
|
||||||
crossAxisAlignment:
|
crossAxisAlignment:
|
||||||
CrossAxisAlignment
|
CrossAxisAlignment
|
||||||
|
@ -469,7 +469,7 @@ class _QRCodeScannerSettingsState extends State<QRCodeScannerSettings> {
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
////Establishment Point-Person
|
////Establishment Point-Person
|
||||||
state.roleId == 16
|
state.roleIdRoleName.roleName.toLowerCase() == 'establishment point-person'
|
||||||
? Column(
|
? Column(
|
||||||
crossAxisAlignment:
|
crossAxisAlignment:
|
||||||
CrossAxisAlignment
|
CrossAxisAlignment
|
||||||
|
@ -516,8 +516,8 @@ class _QRCodeScannerSettingsState extends State<QRCodeScannerSettings> {
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
: ////Office Branch Chief
|
: ////Office Branch Chief
|
||||||
state.roleId ==
|
state.roleIdRoleName.roleName.toLowerCase() == 'office/branch chief'
|
||||||
17
|
|
||||||
? Column(
|
? Column(
|
||||||
crossAxisAlignment:
|
crossAxisAlignment:
|
||||||
CrossAxisAlignment.start,
|
CrossAxisAlignment.start,
|
||||||
|
@ -578,10 +578,6 @@ class _QRCodeScannerSettingsState extends State<QRCodeScannerSettings> {
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
if (_formKey.currentState!
|
if (_formKey.currentState!
|
||||||
.saveAndValidate()) {
|
.saveAndValidate()) {
|
||||||
print(scanMode);
|
|
||||||
print(_includeOtherInputs);
|
|
||||||
print(checkerId);
|
|
||||||
print(assignedArea);
|
|
||||||
Navigator.push(context,
|
Navigator.push(context,
|
||||||
MaterialPageRoute(builder:
|
MaterialPageRoute(builder:
|
||||||
(BuildContext context) {
|
(BuildContext context) {
|
||||||
|
@ -595,7 +591,7 @@ class _QRCodeScannerSettingsState extends State<QRCodeScannerSettings> {
|
||||||
entranceExit: scanMode,
|
entranceExit: scanMode,
|
||||||
includeOtherInputs:
|
includeOtherInputs:
|
||||||
_includeOtherInputs,
|
_includeOtherInputs,
|
||||||
roleId: state.roleId)),
|
roleIdRoleName: widget.roleIdRoleName)),
|
||||||
child: const QRCodeScanner(),
|
child: const QRCodeScanner(),
|
||||||
);
|
);
|
||||||
}));
|
}));
|
||||||
|
@ -615,7 +611,7 @@ class _QRCodeScannerSettingsState extends State<QRCodeScannerSettings> {
|
||||||
return SomethingWentWrong(
|
return SomethingWentWrong(
|
||||||
message: state.message, onpressed: () {
|
message: state.message, onpressed: () {
|
||||||
|
|
||||||
context.read<PassCheckBloc>().add(GetPassCheckAreas(roleId: widget.roleId, userId: widget.userId));
|
context.read<PassCheckBloc>().add(GetPassCheckAreas(roleIdRoleName: widget.roleIdRoleName, userId: widget.userId));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return Container();
|
return Container();
|
||||||
|
|
|
@ -39,16 +39,16 @@ class AuthService {
|
||||||
Map<String, String> baseHeaders = {'Content-Type': 'application/json'};
|
Map<String, String> baseHeaders = {'Content-Type': 'application/json'};
|
||||||
Map<dynamic, dynamic> responseStatus = {};
|
Map<dynamic, dynamic> responseStatus = {};
|
||||||
String path = Url.instance.authentication();
|
String path = Url.instance.authentication();
|
||||||
// try {
|
try {
|
||||||
http.Response response = await Request.instance
|
http.Response response = await Request.instance
|
||||||
.postRequest(path: path, param: {}, headers: baseHeaders, body: body);
|
.postRequest(path: path, param: {}, headers: baseHeaders, body: body);
|
||||||
Map data = jsonDecode(response.body);
|
Map data = jsonDecode(response.body);
|
||||||
responseStatus = data;
|
responseStatus = data;
|
||||||
|
|
||||||
return responseStatus;
|
return responseStatus;
|
||||||
// } catch (e) {
|
} catch (e) {
|
||||||
// throw (e.toString());
|
throw (e.toString());
|
||||||
// }
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<Map<dynamic,dynamic>> qrLogin({String? uuid, String? password}) async {
|
Future<Map<dynamic,dynamic>> qrLogin({String? uuid, String? password}) async {
|
||||||
|
|
|
@ -8,6 +8,7 @@ import 'package:unit2/model/roles/pass_check/agency_area_type.dart';
|
||||||
import 'package:unit2/model/roles/pass_check/assign_role_area_type.dart';
|
import 'package:unit2/model/roles/pass_check/assign_role_area_type.dart';
|
||||||
import 'package:unit2/model/roles/pass_check/barangay_assign_area.dart';
|
import 'package:unit2/model/roles/pass_check/barangay_assign_area.dart';
|
||||||
import 'package:unit2/model/roles/pass_check/passer_info.dart';
|
import 'package:unit2/model/roles/pass_check/passer_info.dart';
|
||||||
|
import 'package:unit2/screens/unit2/homepage.dart/components/dashboard/dashboard.dart';
|
||||||
import 'package:unit2/utils/global.dart';
|
import 'package:unit2/utils/global.dart';
|
||||||
import 'package:http/http.dart' as http;
|
import 'package:http/http.dart' as http;
|
||||||
import 'package:unit2/utils/request.dart';
|
import 'package:unit2/utils/request.dart';
|
||||||
|
@ -20,10 +21,10 @@ class PassCheckServices {
|
||||||
static PassCheckServices get instance => _instance;
|
static PassCheckServices get instance => _instance;
|
||||||
|
|
||||||
Future<List<dynamic>> getPassCheckArea(
|
Future<List<dynamic>> getPassCheckArea(
|
||||||
{required int roleId, required int userId}) async {
|
{required RoleIdRoleName roleIdRoleName, required int userId}) async {
|
||||||
String path = Url.instance.getAssignAreas();
|
String path = Url.instance.getAssignAreas();
|
||||||
Map<String, String> params = {
|
Map<String, String> params = {
|
||||||
"assigned_role__role__id": roleId.toString(),
|
"assigned_role__role__name__icontains": roleIdRoleName.roleName,
|
||||||
"assigned_role__user__id": userId.toString()
|
"assigned_role__user__id": userId.toString()
|
||||||
};
|
};
|
||||||
List<dynamic>? statusResponse;
|
List<dynamic>? statusResponse;
|
||||||
|
|
|
@ -67,9 +67,12 @@ class AppRouter {
|
||||||
return BlocProvider(
|
return BlocProvider(
|
||||||
create: (context) => PassCheckBloc()
|
create: (context) => PassCheckBloc()
|
||||||
..add(GetPassCheckAreas(
|
..add(GetPassCheckAreas(
|
||||||
roleId: arguments.roleId, userId: arguments.userId)),
|
roleIdRoleName: RoleIdRoleName(
|
||||||
|
roleId: arguments.roleIdRoleName.roleId,
|
||||||
|
roleName: arguments.roleIdRoleName.roleName),
|
||||||
|
userId: arguments.userId)),
|
||||||
child: QRCodeScannerSettings(
|
child: QRCodeScannerSettings(
|
||||||
roleId: arguments.roleId,
|
roleIdRoleName: arguments.roleIdRoleName,
|
||||||
userId: arguments.userId,
|
userId: arguments.userId,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
|
@ -22,20 +22,20 @@ class Request {
|
||||||
response = await get(Uri.https(host, path!, param), headers: headers)
|
response = await get(Uri.https(host, path!, param), headers: headers)
|
||||||
.timeout(Duration(seconds: requestTimeout));
|
.timeout(Duration(seconds: requestTimeout));
|
||||||
} on TimeoutException catch (_) {
|
} on TimeoutException catch (_) {
|
||||||
Fluttertoast.showToast(
|
// Fluttertoast.showToast(
|
||||||
msg: timeoutError,
|
// msg: timeoutError,
|
||||||
toastLength: Toast.LENGTH_LONG,
|
// toastLength: Toast.LENGTH_LONG,
|
||||||
gravity: ToastGravity.BOTTOM,
|
// gravity: ToastGravity.BOTTOM,
|
||||||
backgroundColor: Colors.black,
|
// backgroundColor: Colors.black,
|
||||||
);
|
// );
|
||||||
throw (timeoutError);
|
throw (timeoutError);
|
||||||
} on SocketException catch (_) {
|
} on SocketException catch (_) {
|
||||||
Fluttertoast.showToast(
|
// Fluttertoast.showToast(
|
||||||
msg: timeoutError,
|
// msg: timeoutError,
|
||||||
toastLength: Toast.LENGTH_LONG,
|
// toastLength: Toast.LENGTH_LONG,
|
||||||
gravity: ToastGravity.BOTTOM,
|
// gravity: ToastGravity.BOTTOM,
|
||||||
backgroundColor: Colors.black,
|
// backgroundColor: Colors.black,
|
||||||
);
|
// );
|
||||||
throw (timeoutError);
|
throw (timeoutError);
|
||||||
} on FormatException catch (_) {
|
} on FormatException catch (_) {
|
||||||
throw const FormatException(formatError);
|
throw const FormatException(formatError);
|
||||||
|
@ -43,12 +43,12 @@ class Request {
|
||||||
throw const HttpException(httpError);
|
throw const HttpException(httpError);
|
||||||
} on Error catch (e) {
|
} on Error catch (e) {
|
||||||
debugPrint("get request error: $e");
|
debugPrint("get request error: $e");
|
||||||
Fluttertoast.showToast(
|
// Fluttertoast.showToast(
|
||||||
msg: onError,
|
// msg: onError,
|
||||||
toastLength: Toast.LENGTH_LONG,
|
// toastLength: Toast.LENGTH_LONG,
|
||||||
gravity: ToastGravity.BOTTOM,
|
// gravity: ToastGravity.BOTTOM,
|
||||||
backgroundColor: Colors.black,
|
// backgroundColor: Colors.black,
|
||||||
);
|
// );
|
||||||
throw (onError);
|
throw (onError);
|
||||||
}
|
}
|
||||||
return response;
|
return response;
|
||||||
|
@ -65,20 +65,20 @@ class Request {
|
||||||
headers: headers, body: jsonEncode(body))
|
headers: headers, body: jsonEncode(body))
|
||||||
.timeout(Duration(seconds: requestTimeout));
|
.timeout(Duration(seconds: requestTimeout));
|
||||||
} on TimeoutException catch (_) {
|
} on TimeoutException catch (_) {
|
||||||
Fluttertoast.showToast(
|
// Fluttertoast.showToast(
|
||||||
msg: timeoutError,
|
// msg: timeoutError,
|
||||||
toastLength: Toast.LENGTH_LONG,
|
// toastLength: Toast.LENGTH_LONG,
|
||||||
gravity: ToastGravity.BOTTOM,
|
// gravity: ToastGravity.BOTTOM,
|
||||||
backgroundColor: Colors.black,
|
// backgroundColor: Colors.black,
|
||||||
);
|
// );
|
||||||
throw (timeoutError);
|
throw (timeoutError);
|
||||||
} on SocketException catch (_) {
|
} on SocketException catch (_) {
|
||||||
Fluttertoast.showToast(
|
// Fluttertoast.showToast(
|
||||||
msg: timeoutError,
|
// msg: timeoutError,
|
||||||
toastLength: Toast.LENGTH_LONG,
|
// toastLength: Toast.LENGTH_LONG,
|
||||||
gravity: ToastGravity.BOTTOM,
|
// gravity: ToastGravity.BOTTOM,
|
||||||
backgroundColor: Colors.black,
|
// backgroundColor: Colors.black,
|
||||||
);
|
// );
|
||||||
throw (timeoutError);
|
throw (timeoutError);
|
||||||
} on FormatException catch (_) {
|
} on FormatException catch (_) {
|
||||||
throw const FormatException(formatError);
|
throw const FormatException(formatError);
|
||||||
|
@ -86,12 +86,12 @@ class Request {
|
||||||
throw const HttpException(httpError);
|
throw const HttpException(httpError);
|
||||||
} on Error catch (e) {
|
} on Error catch (e) {
|
||||||
debugPrint("post request error: $e");
|
debugPrint("post request error: $e");
|
||||||
Fluttertoast.showToast(
|
// Fluttertoast.showToast(
|
||||||
msg: onError,
|
// msg: onError,
|
||||||
toastLength: Toast.LENGTH_LONG,
|
// toastLength: Toast.LENGTH_LONG,
|
||||||
gravity: ToastGravity.BOTTOM,
|
// gravity: ToastGravity.BOTTOM,
|
||||||
backgroundColor: Colors.black,
|
// backgroundColor: Colors.black,
|
||||||
);
|
// );
|
||||||
throw (e.toString());
|
throw (e.toString());
|
||||||
}
|
}
|
||||||
return response;
|
return response;
|
||||||
|
@ -107,20 +107,20 @@ class Request {
|
||||||
response = await put(Uri.https(host, path, param),
|
response = await put(Uri.https(host, path, param),
|
||||||
headers: headers, body: jsonEncode(body));
|
headers: headers, body: jsonEncode(body));
|
||||||
} on TimeoutException catch (_) {
|
} on TimeoutException catch (_) {
|
||||||
Fluttertoast.showToast(
|
// Fluttertoast.showToast(
|
||||||
msg: timeoutError,
|
// msg: timeoutError,
|
||||||
toastLength: Toast.LENGTH_LONG,
|
// toastLength: Toast.LENGTH_LONG,
|
||||||
gravity: ToastGravity.BOTTOM,
|
// gravity: ToastGravity.BOTTOM,
|
||||||
backgroundColor: Colors.black,
|
// backgroundColor: Colors.black,
|
||||||
);
|
// );
|
||||||
throw (timeoutError);
|
throw (timeoutError);
|
||||||
} on SocketException catch (_) {
|
} on SocketException catch (_) {
|
||||||
Fluttertoast.showToast(
|
// Fluttertoast.showToast(
|
||||||
msg: timeoutError,
|
// msg: timeoutError,
|
||||||
toastLength: Toast.LENGTH_LONG,
|
// toastLength: Toast.LENGTH_LONG,
|
||||||
gravity: ToastGravity.BOTTOM,
|
// gravity: ToastGravity.BOTTOM,
|
||||||
backgroundColor: Colors.black,
|
// backgroundColor: Colors.black,
|
||||||
);
|
// );
|
||||||
throw (timeoutError);
|
throw (timeoutError);
|
||||||
} on FormatException catch (_) {
|
} on FormatException catch (_) {
|
||||||
throw const FormatException(formatError);
|
throw const FormatException(formatError);
|
||||||
|
@ -128,12 +128,12 @@ class Request {
|
||||||
throw const HttpException(httpError);
|
throw const HttpException(httpError);
|
||||||
} on Error catch (e) {
|
} on Error catch (e) {
|
||||||
debugPrint("post request error: $e");
|
debugPrint("post request error: $e");
|
||||||
Fluttertoast.showToast(
|
// Fluttertoast.showToast(
|
||||||
msg: onError,
|
// msg: onError,
|
||||||
toastLength: Toast.LENGTH_LONG,
|
// toastLength: Toast.LENGTH_LONG,
|
||||||
gravity: ToastGravity.BOTTOM,
|
// gravity: ToastGravity.BOTTOM,
|
||||||
backgroundColor: Colors.black,
|
// backgroundColor: Colors.black,
|
||||||
);
|
// );
|
||||||
throw (e.toString());
|
throw (e.toString());
|
||||||
}
|
}
|
||||||
return response;
|
return response;
|
||||||
|
@ -149,20 +149,20 @@ class Request {
|
||||||
response = await patch(
|
response = await patch(
|
||||||
path: host + path, headers: headers, body: body, param: param);
|
path: host + path, headers: headers, body: body, param: param);
|
||||||
} on TimeoutException catch (_) {
|
} on TimeoutException catch (_) {
|
||||||
Fluttertoast.showToast(
|
// Fluttertoast.showToast(
|
||||||
msg: timeoutError,
|
// msg: timeoutError,
|
||||||
toastLength: Toast.LENGTH_LONG,
|
// toastLength: Toast.LENGTH_LONG,
|
||||||
gravity: ToastGravity.BOTTOM,
|
// gravity: ToastGravity.BOTTOM,
|
||||||
backgroundColor: Colors.black,
|
// backgroundColor: Colors.black,
|
||||||
);
|
// );
|
||||||
throw (timeoutError);
|
throw (timeoutError);
|
||||||
} on SocketException catch (_) {
|
} on SocketException catch (_) {
|
||||||
Fluttertoast.showToast(
|
// Fluttertoast.showToast(
|
||||||
msg: timeoutError,
|
// msg: timeoutError,
|
||||||
toastLength: Toast.LENGTH_LONG,
|
// toastLength: Toast.LENGTH_LONG,
|
||||||
gravity: ToastGravity.BOTTOM,
|
// gravity: ToastGravity.BOTTOM,
|
||||||
backgroundColor: Colors.black,
|
// backgroundColor: Colors.black,
|
||||||
);
|
// );
|
||||||
throw (timeoutError);
|
throw (timeoutError);
|
||||||
} on FormatException catch (_) {
|
} on FormatException catch (_) {
|
||||||
throw const FormatException(formatError);
|
throw const FormatException(formatError);
|
||||||
|
@ -170,12 +170,12 @@ class Request {
|
||||||
throw const HttpException(httpError);
|
throw const HttpException(httpError);
|
||||||
} on Error catch (e) {
|
} on Error catch (e) {
|
||||||
debugPrint("post request error: $e");
|
debugPrint("post request error: $e");
|
||||||
Fluttertoast.showToast(
|
// Fluttertoast.showToast(
|
||||||
msg: onError,
|
// msg: onError,
|
||||||
toastLength: Toast.LENGTH_LONG,
|
// toastLength: Toast.LENGTH_LONG,
|
||||||
gravity: ToastGravity.BOTTOM,
|
// gravity: ToastGravity.BOTTOM,
|
||||||
backgroundColor: Colors.black,
|
// backgroundColor: Colors.black,
|
||||||
);
|
// );
|
||||||
throw (e.toString());
|
throw (e.toString());
|
||||||
}
|
}
|
||||||
return response;
|
return response;
|
||||||
|
@ -192,32 +192,32 @@ class Request {
|
||||||
headers: headers, body: jsonEncode(body))
|
headers: headers, body: jsonEncode(body))
|
||||||
.timeout(Duration(seconds: requestTimeout));
|
.timeout(Duration(seconds: requestTimeout));
|
||||||
} on TimeoutException catch (_) {
|
} on TimeoutException catch (_) {
|
||||||
Fluttertoast.showToast(
|
// Fluttertoast.showToast(
|
||||||
msg: timeoutError,
|
// msg: timeoutError,
|
||||||
toastLength: Toast.LENGTH_LONG,
|
// toastLength: Toast.LENGTH_LONG,
|
||||||
gravity: ToastGravity.BOTTOM,
|
// gravity: ToastGravity.BOTTOM,
|
||||||
backgroundColor: Colors.black,
|
// backgroundColor: Colors.black,
|
||||||
);
|
// );
|
||||||
throw (timeoutError);
|
throw (timeoutError);
|
||||||
} on SocketException catch (_) {
|
} on SocketException catch (_) {
|
||||||
Fluttertoast.showToast(
|
// Fluttertoast.showToast(
|
||||||
msg: timeoutError,
|
// msg: timeoutError,
|
||||||
toastLength: Toast.LENGTH_LONG,
|
// toastLength: Toast.LENGTH_LONG,
|
||||||
gravity: ToastGravity.BOTTOM,
|
// gravity: ToastGravity.BOTTOM,
|
||||||
backgroundColor: Colors.black,
|
// backgroundColor: Colors.black,
|
||||||
);
|
// );
|
||||||
throw (timeoutError);
|
throw (timeoutError);
|
||||||
} on FormatException catch (_) {
|
} on FormatException catch (_) {
|
||||||
throw const FormatException(formatError);
|
throw const FormatException(formatError);
|
||||||
} on HttpException catch (_) {
|
} on HttpException catch (_) {
|
||||||
throw const HttpException(httpError);
|
throw const HttpException(httpError);
|
||||||
} on Error catch (e) {
|
} on Error catch (e) {
|
||||||
Fluttertoast.showToast(
|
// Fluttertoast.showToast(
|
||||||
msg: onError,
|
// msg: onError,
|
||||||
toastLength: Toast.LENGTH_LONG,
|
// toastLength: Toast.LENGTH_LONG,
|
||||||
gravity: ToastGravity.BOTTOM,
|
// gravity: ToastGravity.BOTTOM,
|
||||||
backgroundColor: Colors.black,
|
// backgroundColor: Colors.black,
|
||||||
);
|
// );
|
||||||
throw (e.toString());
|
throw (e.toString());
|
||||||
}
|
}
|
||||||
return response;
|
return response;
|
||||||
|
|
Loading…
Reference in New Issue