fixes add user view and table and user status

This commit is contained in:
mohammad
2025-01-13 11:07:18 +03:00
parent 15023e5882
commit eb7eeebf18
6 changed files with 37 additions and 32 deletions

View File

@ -237,10 +237,11 @@ class _AddNewUserDialogState extends State<AddNewUserDialog> {
onTap: () { onTap: () {
setState(() { setState(() {
currentStep = step; currentStep = step;
bloc.add(CheckStepStatus(isEditUser: false)); bloc.add(const CheckStepStatus(isEditUser: false));
if (step3 == 3) { if (step3 == 3) {
bloc.add(const CheckRoleStepStatus()); bloc.add(const CheckRoleStepStatus());
} }
}); });
}, },
child: Column( child: Column(

View File

@ -47,7 +47,9 @@ class BasicsView extends StatelessWidget {
), ),
Row( Row(
children: [ children: [
Expanded( SizedBox(
width: MediaQuery.of(context).size.width * 0.18,
height: MediaQuery.of(context).size.width * 0.08,
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
@ -76,12 +78,12 @@ class BasicsView extends StatelessWidget {
child: TextFormField( child: TextFormField(
style: style:
const TextStyle(color: ColorsManager.blackColor), const TextStyle(color: ColorsManager.blackColor),
onChanged: (value) { // onChanged: (value) {
Future.delayed(const Duration(milliseconds: 200), // Future.delayed(const Duration(milliseconds: 200),
() { // () {
_blocRole.add(ValidateBasicsStep()); // _blocRole.add(const ValidateBasicsStep());
}); // });
}, // },
controller: _blocRole.firstNameController, controller: _blocRole.firstNameController,
decoration: inputTextFormDeco( decoration: inputTextFormDeco(
hintText: "Enter first name", hintText: "Enter first name",
@ -103,7 +105,9 @@ class BasicsView extends StatelessWidget {
), ),
), ),
const SizedBox(width: 10), const SizedBox(width: 10),
Expanded( SizedBox(
width: MediaQuery.of(context).size.width * 0.18,
height: MediaQuery.of(context).size.width * 0.08,
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
@ -128,12 +132,12 @@ class BasicsView extends StatelessWidget {
Padding( Padding(
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: TextFormField( child: TextFormField(
onChanged: (value) { // onChanged: (value) {
Future.delayed(const Duration(milliseconds: 200), // Future.delayed(const Duration(milliseconds: 200),
() { // () {
_blocRole.add(ValidateBasicsStep()); // _blocRole.add(ValidateBasicsStep());
}); // });
}, // },
controller: _blocRole.lastNameController, controller: _blocRole.lastNameController,
style: const TextStyle(color: Colors.black), style: const TextStyle(color: Colors.black),
decoration: decoration:
@ -186,13 +190,13 @@ class BasicsView extends StatelessWidget {
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: TextFormField( child: TextFormField(
enabled: userId != '' ? false : true, enabled: userId != '' ? false : true,
onChanged: (value) { // onChanged: (value) {
Future.delayed(const Duration(milliseconds: 200), () { // Future.delayed(const Duration(milliseconds: 200), () {
_blocRole.add(CheckStepStatus( // _blocRole.add(CheckStepStatus(
isEditUser: userId != '' ? false : true)); // isEditUser: userId != '' ? false : true));
_blocRole.add(ValidateBasicsStep()); // _blocRole.add(ValidateBasicsStep());
}); // });
}, // },
controller: _blocRole.emailController, controller: _blocRole.emailController,
style: const TextStyle(color: ColorsManager.blackColor), style: const TextStyle(color: ColorsManager.blackColor),
decoration: inputTextFormDeco(hintText: "name@example.com") decoration: inputTextFormDeco(hintText: "name@example.com")

View File

@ -128,7 +128,7 @@ class _PermissionManagementState extends State<PermissionManagement> {
), ),
const SizedBox(width: 8), const SizedBox(width: 8),
Text( Text(
option.title, ' ${option.title[0].toUpperCase()}${option.title.substring(1)}',
style: context.textTheme.bodyMedium?.copyWith( style: context.textTheme.bodyMedium?.copyWith(
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
fontSize: 12, fontSize: 12,
@ -184,7 +184,7 @@ class _PermissionManagementState extends State<PermissionManagement> {
), ),
const SizedBox(width: 8), const SizedBox(width: 8),
Text( Text(
subOption.title, ' ${subOption.title[0].toUpperCase()}${subOption.title.substring(1)}',
style: context.textTheme.bodyMedium?.copyWith( style: context.textTheme.bodyMedium?.copyWith(
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
fontSize: 12, fontSize: 12,
@ -246,7 +246,7 @@ class _PermissionManagementState extends State<PermissionManagement> {
), ),
const SizedBox(width: 8), const SizedBox(width: 8),
Text( Text(
child.title, ' ${child.title[0].toUpperCase()}${child.title.substring(1)}',
style: context.textTheme.bodyMedium?.copyWith( style: context.textTheme.bodyMedium?.copyWith(
fontWeight: FontWeight.w400, fontWeight: FontWeight.w400,
fontSize: 12, fontSize: 12,

View File

@ -5,8 +5,8 @@ import 'package:syncrow_web/utils/style.dart';
Future<void> showPopUpFilterMenu({ Future<void> showPopUpFilterMenu({
required BuildContext context, required BuildContext context,
required Function(String value)? onSortAtoZ, // Accept a parameter required Function(String value)? onSortAtoZ,
required Function(String value)? onSortZtoA, // Accept a parameter required Function(String value)? onSortZtoA,
Function()? cancelButton, Function()? cancelButton,
required Map<String, bool> checkboxStates, required Map<String, bool> checkboxStates,
required RelativeRect position, required RelativeRect position,

View File

@ -93,7 +93,7 @@ class UserTableBloc extends Bloc<UserTableEvent, UserTableState> {
try { try {
emit(UsersLoadingState()); emit(UsersLoadingState());
bool res = await UserPermissionApi().changeUserStatusById( bool res = await UserPermissionApi().changeUserStatusById(
event.userId, event.newStatus == "disabled" ? true : false); event.userId, event.newStatus == "disabled" ? false : true);
if (res == true) { if (res == true) {
add(const GetUsers()); add(const GetUsers());
// users = users.map((user) { // users = users.map((user) {

View File

@ -46,7 +46,7 @@ class _DynamicTableScreenState extends State<DynamicTableScreen>
0.12; // 20% of screen width for the second column 0.12; // 20% of screen width for the second column
} else if (index == 9) { } else if (index == 9) {
return newScreenWidth * return newScreenWidth *
0.2; // 25% of screen width for the tenth column 0.1; // 25% of screen width for the tenth column
} }
return newScreenWidth * return newScreenWidth *
0.09; // Default to 10% of screen width for other columns 0.09; // Default to 10% of screen width for other columns
@ -57,14 +57,14 @@ class _DynamicTableScreenState extends State<DynamicTableScreen>
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final screenWidth = MediaQuery.of(context).size.width; final screenWidth = MediaQuery.of(context).size.width;
if (columnWidths.every((width) => width == 120.0)) { if (columnWidths.every((width) => width == screenWidth * 7)) {
columnWidths = List<double>.generate(widget.titles.length, (index) { columnWidths = List<double>.generate(widget.titles.length, (index) {
if (index == 1) { if (index == 1) {
return screenWidth * 0.11; return screenWidth * 0.11;
} else if (index == 9) { } else if (index == 9) {
return screenWidth * 0.2; return screenWidth * 0.1;
} }
return screenWidth * 0.11; return screenWidth * 0.09;
}); });
setState(() {}); setState(() {});
} }