fix attachment error and display image in basic info
parent
d80b36ed8f
commit
5b8a67131f
|
@ -219,8 +219,7 @@ class EducationBloc extends Bloc<EducationEvent, EducationState> {
|
|||
}
|
||||
});
|
||||
on<EducationViewAttachment>((event, emit) {
|
||||
String fileUrl =
|
||||
'${Url.instance.prefixHost()}://${Url.instance.host()}${event.source}';
|
||||
String fileUrl = '${Url.instance.prefixHost()}://${Url.instance.host()}/media/${event.source}';
|
||||
emit(EducationAttachmentViewState(
|
||||
fileUrl: fileUrl, fileName: event.fileName));
|
||||
});
|
||||
|
|
|
@ -290,7 +290,7 @@ class EligibilityBloc extends Bloc<EligibilityEvent, EligibilityState> {
|
|||
}
|
||||
});
|
||||
on<EligibiltyViewAttachmentEvent>((event,emit){
|
||||
String fileUrl = '${Url.instance.prefixHost()}://${Url.instance.host()}${event.source}';
|
||||
String fileUrl = '${Url.instance.prefixHost()}://${Url.instance.host()}/media/${event.source}';
|
||||
emit(EligibilityAttachmentViewState(fileUrl: fileUrl,fileName: event.filename));
|
||||
});
|
||||
on<ShareAttachment>((event, emit) async {
|
||||
|
|
|
@ -334,7 +334,7 @@ class LearningDevelopmentBloc
|
|||
}
|
||||
});
|
||||
on<LearningDevelopmentViewAttachmentEvent>((event,emit){
|
||||
String fileUrl = '${Url.instance.prefixHost()}://${Url.instance.host()}${event.source}';
|
||||
String fileUrl = '${Url.instance.prefixHost()}://${Url.instance.host()}/media/${event.source}';
|
||||
emit(LearningAndDevelopmentAttachmentViewState(fileUrl: fileUrl, filename: event.filename));
|
||||
});
|
||||
on<ShareAttachment>((event, emit) async {
|
||||
|
|
|
@ -81,8 +81,8 @@ class _LearningDevelopmentViewAttachmentState
|
|||
),
|
||||
imageUrl: state.fileUrl,
|
||||
width: double.infinity,
|
||||
height: 220,
|
||||
fit: BoxFit.cover,
|
||||
|
||||
fit: BoxFit.fitHeight,
|
||||
),
|
||||
),
|
||||
);
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
import 'package:auto_size_text/auto_size_text.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../model/profile/attachment.dart';
|
||||
import '../../../theme-data.dart/box_shadow.dart';
|
||||
import '../../../theme-data.dart/colors.dart';
|
||||
import '../../../utils/alerts.dart';
|
||||
|
||||
class SingleAttachment extends StatelessWidget {
|
||||
final Function()? onpressed;
|
||||
|
@ -36,9 +34,9 @@ class SingleAttachment extends StatelessWidget {
|
|||
child:
|
||||
GestureDetector(
|
||||
onTap: view,
|
||||
child: AutoSizeText(
|
||||
child: Text(
|
||||
attachment.filename!,
|
||||
wrapWords: false,
|
||||
|
||||
maxLines: 1,
|
||||
),
|
||||
),
|
||||
|
|
|
@ -264,13 +264,13 @@ class RbacModuleObjectsScreen extends StatelessWidget {
|
|||
},
|
||||
groupHeaderBuilder: (BuildContext context, int section) {
|
||||
return ListTile(
|
||||
tileColor: second,
|
||||
tileColor: Colors.white,
|
||||
title: Text(
|
||||
moduleObjects.keys.toList()[section].toUpperCase(),
|
||||
style: Theme.of(context)
|
||||
.textTheme
|
||||
.titleMedium!
|
||||
.copyWith(color: Colors.white),
|
||||
.copyWith(color: primary,fontWeight: FontWeight.bold),
|
||||
),
|
||||
);
|
||||
},
|
||||
|
|
|
@ -5,10 +5,12 @@ import 'package:flutter_form_builder/flutter_form_builder.dart';
|
|||
import 'package:flutter_progress_hud/flutter_progress_hud.dart';
|
||||
import 'package:flutter_spinkit/flutter_spinkit.dart';
|
||||
import 'package:form_builder_validators/form_builder_validators.dart';
|
||||
import 'package:search_page/search_page.dart';
|
||||
import 'package:unit2/bloc/rbac/rbac_operations/role/role_bloc.dart';
|
||||
import 'package:unit2/screens/superadmin/role/shared_pop_up_menu.dart';
|
||||
import 'package:unit2/widgets/Leadings/add_leading.dart';
|
||||
import 'package:unit2/widgets/error_state.dart';
|
||||
import '../../../model/rbac/rbac.dart';
|
||||
import '../../../theme-data.dart/box_shadow.dart';
|
||||
import '../../../theme-data.dart/btn-style.dart';
|
||||
import '../../../theme-data.dart/colors.dart';
|
||||
|
@ -24,12 +26,38 @@ class RbacRoleScreen extends StatelessWidget {
|
|||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final formKey = GlobalKey<FormBuilderState>();
|
||||
List<RBAC> roles = [];
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
centerTitle: true,
|
||||
backgroundColor: primary,
|
||||
title: const Text("Role Screen"),
|
||||
actions: [
|
||||
IconButton(
|
||||
onPressed: () {
|
||||
showSearch(
|
||||
context: context,
|
||||
delegate: SearchPage(
|
||||
barTheme: ThemeData(cardColor: primary),
|
||||
builder: (RBAC rbac) {
|
||||
return ListTile(
|
||||
title: Text(rbac.name!),
|
||||
);
|
||||
},
|
||||
filter: (RBAC rbac) {
|
||||
return [rbac.name];
|
||||
},
|
||||
failure: const Center(
|
||||
child: Text("No Role found :("),
|
||||
),
|
||||
items: roles,
|
||||
searchLabel: "Search Role",
|
||||
suggestion: const Center(
|
||||
child: Text("Search role by name"),
|
||||
)),
|
||||
);
|
||||
},
|
||||
icon: const Icon(Icons.search)),
|
||||
AddLeading(onPressed: () {
|
||||
BuildContext parent = context;
|
||||
showDialog(
|
||||
|
@ -174,6 +202,7 @@ class RbacRoleScreen extends StatelessWidget {
|
|||
final parent = context;
|
||||
if (state is RoleLoadedState) {
|
||||
if (state.roles.isNotEmpty) {
|
||||
roles = state.roles;
|
||||
return ListView.builder(
|
||||
padding:
|
||||
const EdgeInsets.symmetric(vertical: 8, horizontal: 10),
|
||||
|
@ -191,8 +220,12 @@ class RbacRoleScreen extends StatelessWidget {
|
|||
Expanded(
|
||||
child: Row(
|
||||
children: [
|
||||
CircleAvatar(child: Text('${index+1}'),),
|
||||
const SizedBox(width: 12,),
|
||||
CircleAvatar(
|
||||
child: Text('${index + 1}'),
|
||||
),
|
||||
const SizedBox(
|
||||
width: 12,
|
||||
),
|
||||
Flexible(
|
||||
child: Text(state.roles[index].name!,
|
||||
style: Theme.of(context)
|
||||
|
@ -360,7 +393,8 @@ class RbacRoleScreen extends StatelessWidget {
|
|||
}
|
||||
if (state is RoleErrorState) {
|
||||
return SomethingWentWrong(
|
||||
message: state.message, onpressed: () {
|
||||
message: state.message,
|
||||
onpressed: () {
|
||||
context.read<RoleBloc>().add(GetRoles());
|
||||
});
|
||||
}
|
||||
|
|
|
@ -262,13 +262,13 @@ class RbacRoleExtendScreen extends StatelessWidget {
|
|||
},
|
||||
groupHeaderBuilder: (BuildContext context, int section) {
|
||||
return ListTile(
|
||||
tileColor: second,
|
||||
tileColor: Colors.white,
|
||||
title: Text(
|
||||
rolesExtend.keys.toList()[section].toUpperCase(),
|
||||
style: Theme.of(context)
|
||||
.textTheme
|
||||
.titleMedium!
|
||||
.copyWith(color: Colors.white),
|
||||
.copyWith(color: primary,fontWeight: FontWeight.bold),
|
||||
),
|
||||
);
|
||||
},
|
||||
|
|
|
@ -252,13 +252,13 @@ class RbacRoleModuleScreen extends StatelessWidget {
|
|||
},
|
||||
groupHeaderBuilder: (BuildContext context, int section) {
|
||||
return ListTile(
|
||||
tileColor: second,
|
||||
tileColor: Colors.white,
|
||||
title: Text(
|
||||
roleModules.keys.toList()[section].toUpperCase(),
|
||||
style: Theme.of(context)
|
||||
.textTheme
|
||||
.titleMedium!
|
||||
.copyWith(color: Colors.white),
|
||||
.copyWith(color: primary,fontWeight: FontWeight.bold),
|
||||
),
|
||||
);
|
||||
},
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import 'package:cached_network_image/cached_network_image.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:flutter_progress_hud/flutter_progress_hud.dart';
|
||||
|
@ -13,6 +14,7 @@ import 'package:unit2/utils/global.dart';
|
|||
import 'package:unit2/utils/text_container.dart';
|
||||
import '../../../bloc/user/user_bloc.dart';
|
||||
import '../../../theme-data.dart/colors.dart';
|
||||
import '../../../utils/urls.dart';
|
||||
import '../../../widgets/splash_screen.dart';
|
||||
import '../signature/signature_pad.dart';
|
||||
import './components/cover-image.dart';
|
||||
|
@ -29,7 +31,9 @@ class BasicInfo extends StatelessWidget {
|
|||
child: ProgressHUD(
|
||||
child: BlocBuilder<UserBloc, UserState>(
|
||||
builder: (context, state) {
|
||||
|
||||
if (state is UserLoggedIn) {
|
||||
String fileUrl = '${Url.instance.prefixHost()}://${Url.instance.host()}/media/${ state.userData!.employeeInfo!.profile!.photoPath!}';
|
||||
state.userData!.employeeInfo!.profile!.sex!.toUpperCase();
|
||||
return SafeArea(
|
||||
child: Scaffold(
|
||||
|
@ -47,16 +51,21 @@ class BasicInfo extends StatelessWidget {
|
|||
child: Stack(
|
||||
alignment: Alignment.center,
|
||||
children: [
|
||||
const CircleAvatar(
|
||||
radius: 72,
|
||||
backgroundColor: Colors.white,
|
||||
|
||||
CachedNetworkImage(
|
||||
imageUrl: fileUrl,
|
||||
imageBuilder: (context, imageProvider) => Container(
|
||||
width: 160,
|
||||
height: 160,
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(color: third,width: 3),
|
||||
shape: BoxShape.circle,
|
||||
image: DecorationImage(
|
||||
image: imageProvider, fit: BoxFit.cover),
|
||||
),
|
||||
CircleAvatar(
|
||||
radius: 69,
|
||||
backgroundColor: Colors.grey.shade800,
|
||||
child: SvgPicture.asset(
|
||||
'assets/svgs/male.svg',
|
||||
),
|
||||
placeholder: (context, url) => const CircularProgressIndicator(),
|
||||
errorWidget: (context, url, error) =>const Icon(Icons.error),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
|
Loading…
Reference in New Issue