roles_and_permission
18
assets/icons/active_user.svg
Normal file
@ -0,0 +1,18 @@
|
||||
<svg width="40" height="34" viewBox="0 0 40 34" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<rect y="2" width="33" height="20" rx="10" fill="#023DFE" fill-opacity="0.7"/>
|
||||
<g filter="url(#filter0_d_5216_2616)">
|
||||
<ellipse cx="22.9389" cy="12" rx="8.45122" ry="8.4" fill="white"/>
|
||||
</g>
|
||||
<defs>
|
||||
<filter id="filter0_d_5216_2616" x="6.48767" y="0.599976" width="32.9025" height="32.8" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
|
||||
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
|
||||
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
|
||||
<feOffset dy="5"/>
|
||||
<feGaussianBlur stdDeviation="4"/>
|
||||
<feComposite in2="hardAlpha" operator="out"/>
|
||||
<feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.15 0"/>
|
||||
<feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_5216_2616"/>
|
||||
<feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_5216_2616" result="shape"/>
|
||||
</filter>
|
||||
</defs>
|
||||
</svg>
|
After Width: | Height: | Size: 1011 B |
BIN
assets/icons/box_checked.png
Normal file
After Width: | Height: | Size: 754 B |
9
assets/icons/compleate_process_icon.svg
Normal file
@ -0,0 +1,9 @@
|
||||
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M10 20C15.5228 20 20 15.5228 20 10C20 4.47715 15.5228 0 10 0C4.47715 0 0 4.47715 0 10C0 15.5228 4.47715 20 10 20Z" fill="#BBEC6C"/>
|
||||
<path d="M9.9999 0C9.79708 0 9.59588 0.00676056 9.39604 0.018672C14.6376 0.330986 18.5355 4.67996 18.5355 10C18.5355 15.32 14.6376 19.669 9.396 19.9813C9.59588 19.9932 9.79708 20 9.9999 20C15.5228 20 19.9999 15.5229 19.9999 10C19.9999 4.47714 15.5228 0 9.9999 0Z" fill="#A2E62E"/>
|
||||
<path d="M10.0002 18.5355C14.7142 18.5355 18.5357 14.714 18.5357 9.99993C18.5357 5.28586 14.7142 1.46436 10.0002 1.46436C5.28611 1.46436 1.4646 5.28586 1.4646 9.99993C1.4646 14.714 5.28611 18.5355 10.0002 18.5355Z" fill="#4FC123"/>
|
||||
<path d="M9.99986 1.46436C9.7968 1.46436 9.59551 1.47196 9.396 1.48588C13.8282 1.79574 17.3277 5.48894 17.3277 9.99993C17.3277 14.511 13.8282 18.2041 9.396 18.514C9.59551 18.5279 9.7968 18.5355 9.99986 18.5355C14.7139 18.5355 18.5354 14.714 18.5354 9.99993C18.5354 5.28589 14.7139 1.46436 9.99986 1.46436Z" fill="#47A920"/>
|
||||
<path d="M15.1631 8.28358L9.71483 13.7323C9.13696 14.3097 8.20095 14.3097 7.62348 13.7323L4.83717 10.946C4.51684 10.626 4.51684 10.1069 4.83717 9.787L5.64924 8.97493V8.97452L5.92449 8.69927C6.24441 8.37935 6.76352 8.37935 7.08344 8.69927L8.47781 10.0936C8.62751 10.2437 8.87097 10.2437 9.02067 10.0936L12.9969 6.11738C13.3168 5.79746 13.836 5.79746 14.1559 6.11738L15.1631 7.12462C15.4834 7.44495 15.4834 7.96366 15.1631 8.28358Z" fill="#D1F19E"/>
|
||||
<path d="M9.02084 10.0938L8.55927 10.5553C8.37738 10.7376 8.08241 10.7388 7.89851 10.5582L6.48724 9.17265C6.26068 8.94569 5.93432 8.8805 5.64941 8.97507V8.97466L5.92467 8.69941C6.24459 8.37949 6.7637 8.37949 7.08362 8.69941L8.47799 10.0938C8.62768 10.2439 8.87114 10.2439 9.02084 10.0938Z" fill="#BBEC6C"/>
|
||||
<path d="M15.1633 7.1248L14.1559 6.11747C13.8359 5.79743 13.317 5.79743 12.997 6.11747L12.7366 6.37791C12.971 6.35606 13.213 6.43478 13.3925 6.61429L13.9555 7.12484C14.2755 7.44488 14.2755 7.96375 13.9555 8.28379L8.9588 13.3461C8.60206 13.7028 8.10838 13.8389 7.64697 13.7549C8.22609 14.3094 9.14488 14.3022 9.71466 13.7324L15.1633 8.28379C15.4833 7.96375 15.4833 7.44484 15.1633 7.1248Z" fill="#BBEC6C"/>
|
||||
</svg>
|
After Width: | Height: | Size: 2.2 KiB |
3
assets/icons/current_process_icon.svg
Normal file
@ -0,0 +1,3 @@
|
||||
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<circle cx="10" cy="10" r="10" fill="#023DFE"/>
|
||||
</svg>
|
After Width: | Height: | Size: 151 B |
18
assets/icons/deactive_user.svg
Normal file
@ -0,0 +1,18 @@
|
||||
<svg width="39" height="32" viewBox="0 0 39 32" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<rect x="6" y="1" width="33" height="20" rx="10" fill="#E9E9E9"/>
|
||||
<g filter="url(#filter0_d_5216_2749)">
|
||||
<circle cx="16" cy="11" r="8" fill="white"/>
|
||||
</g>
|
||||
<defs>
|
||||
<filter id="filter0_d_5216_2749" x="0" y="0" width="32" height="32" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
|
||||
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
|
||||
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
|
||||
<feOffset dy="5"/>
|
||||
<feGaussianBlur stdDeviation="4"/>
|
||||
<feComposite in2="hardAlpha" operator="out"/>
|
||||
<feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.15 0"/>
|
||||
<feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_5216_2749"/>
|
||||
<feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_5216_2749" result="shape"/>
|
||||
</filter>
|
||||
</defs>
|
||||
</svg>
|
After Width: | Height: | Size: 956 B |
BIN
assets/icons/empty_box.png
Normal file
After Width: | Height: | Size: 425 B |
7
assets/icons/invited_icon.svg
Normal file
@ -0,0 +1,7 @@
|
||||
<svg width="21" height="20" viewBox="0 0 21 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M18.4066 14.8703C18.0603 14.6128 17.571 14.6847 17.3134 15.0309C17.1718 15.2212 17.0202 15.408 16.8629 15.5859C16.5772 15.9092 16.6075 16.4029 16.9308 16.6887C17.0794 16.8201 17.264 16.8846 17.4479 16.8846C17.664 16.8846 17.8792 16.7955 18.0335 16.6208C18.2198 16.4101 18.3993 16.1889 18.5671 15.9634C18.8246 15.6173 18.7528 15.1278 18.4066 14.8703Z" fill="#D5D5D5"/>
|
||||
<path d="M19.7131 11.2064C19.2917 11.1146 18.8753 11.382 18.7835 11.8036C18.733 12.0355 18.672 12.2678 18.602 12.4942C18.4747 12.9065 18.7056 13.3439 19.1178 13.4713C19.1947 13.495 19.2723 13.5063 19.3487 13.5063C19.6823 13.5063 19.9912 13.2909 20.0949 12.9555C20.1779 12.6868 20.2504 12.411 20.3103 12.1359C20.402 11.7144 20.1347 11.2982 19.7131 11.2064Z" fill="#D5D5D5"/>
|
||||
<path d="M14.6462 17.3725C14.4387 17.4883 14.224 17.5965 14.0079 17.6941C13.6146 17.8717 13.4398 18.3344 13.6174 18.7277C13.7479 19.0166 14.0322 19.1875 14.3299 19.1875C14.4374 19.1875 14.5466 19.1652 14.651 19.1181C14.9073 19.0023 15.1619 18.874 15.4079 18.7367C15.7846 18.5264 15.9195 18.0505 15.7091 17.6737C15.4988 17.2971 15.0229 17.1622 14.6462 17.3725Z" fill="#D5D5D5"/>
|
||||
<path d="M9.71886 3.75V9.67641L6.85405 12.5412C6.54897 12.8463 6.54897 13.3409 6.85405 13.646C7.00663 13.7986 7.20651 13.8748 7.40651 13.8748C7.60644 13.8748 7.8064 13.7986 7.95898 13.646L11.0526 10.5524C11.1991 10.4059 11.2814 10.2072 11.2814 10V3.75C11.2814 3.31852 10.9316 2.96875 10.5001 2.96875C10.0686 2.96875 9.71886 3.31852 9.71886 3.75Z" fill="#D5D5D5"/>
|
||||
<path d="M19.7188 1.67969C19.2873 1.67969 18.9375 2.02945 18.9375 2.46094V4.63031C17.1191 1.77844 13.9434 0 10.5 0C7.82891 0 5.3177 1.0402 3.42891 2.92891C1.5402 4.8177 0.5 7.32891 0.5 10C0.5 12.6711 1.5402 15.1823 3.42891 17.0711C5.3177 18.9598 7.82891 20 10.5 20C10.5066 20 10.513 19.9992 10.5195 19.999C10.5261 19.9992 10.5325 20 10.5391 20C10.8206 20 11.105 19.9881 11.3843 19.9648C11.8142 19.9287 12.1336 19.551 12.0976 19.1211C12.0616 18.6911 11.6843 18.3716 11.2539 18.4077C11.0178 18.4275 10.7773 18.4375 10.5391 18.4375C10.5325 18.4375 10.5261 18.4383 10.5195 18.4385C10.513 18.4383 10.5066 18.4375 10.5 18.4375C5.84754 18.4375 2.0625 14.6525 2.0625 10C2.0625 5.34754 5.84754 1.5625 10.5 1.5625C13.4984 1.5625 16.2561 3.16066 17.7631 5.70312H15.615C15.1835 5.70312 14.8337 6.05289 14.8337 6.48438C14.8337 6.91586 15.1835 7.26562 15.615 7.26562H18C18.4758 7.26562 18.9209 7.13191 19.2999 6.90027C19.3243 6.88637 19.3477 6.87141 19.37 6.85527C20.05 6.40797 20.5 5.63855 20.5 4.76562V2.46094C20.5 2.02945 20.1502 1.67969 19.7188 1.67969Z" fill="#D5D5D5"/>
|
||||
</svg>
|
After Width: | Height: | Size: 2.6 KiB |
BIN
assets/icons/rectangle_check_box.png
Normal file
After Width: | Height: | Size: 523 B |
4
assets/icons/search_icon_user.svg
Normal file
@ -0,0 +1,4 @@
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M1.89852 11.08C-0.632759 8.54864 -0.632708 4.42983 1.89852 1.8985C4.42985 -0.632833 8.54861 -0.632833 11.0799 1.8985C13.2274 4.04599 13.5526 7.23986 12.0565 9.73392C12.0565 9.73392 11.949 9.91422 12.0942 10.0593C12.9222 10.8872 15.4065 13.3716 15.4065 13.3716C16.0658 14.0308 16.2227 14.9527 15.638 15.5374L15.5374 15.638C14.9527 16.2227 14.0308 16.0658 13.3716 15.4065C13.3716 15.4065 10.8926 12.9275 10.0662 12.1012C9.91414 11.9491 9.73389 12.0566 9.73389 12.0566C7.23988 13.5526 4.04601 13.2275 1.89852 11.08ZM9.88131 9.88133C11.7517 8.01094 11.7516 4.96763 9.88125 3.09724C8.01086 1.22689 4.96755 1.22684 3.09721 3.09724C1.22681 4.96758 1.22681 8.01094 3.09721 9.88133C4.9676 11.7516 8.01086 11.7516 9.88131 9.88133Z" fill="black" fill-opacity="0.3"/>
|
||||
<path d="M9.46694 6.10386C9.554 6.10386 9.6425 6.08674 9.7278 6.05072C10.0686 5.9065 10.228 5.51333 10.0838 5.17253C9.17732 3.03045 6.69723 2.0252 4.5552 2.93164C4.21445 3.07586 4.05503 3.46903 4.19924 3.80983C4.34351 4.15063 4.73658 4.30995 5.07749 4.16579C6.53894 3.54737 8.2312 4.23326 8.84956 5.69471C8.95775 5.95031 9.20588 6.10386 9.46694 6.10386Z" fill="black" fill-opacity="0.3"/>
|
||||
</svg>
|
After Width: | Height: | Size: 1.2 KiB |
3
assets/icons/uncompleate_process_icon.svg
Normal file
@ -0,0 +1,3 @@
|
||||
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<circle cx="10" cy="10" r="9" stroke="#D5D5D5" stroke-width="2"/>
|
||||
</svg>
|
After Width: | Height: | Size: 169 B |
10
assets/icons/wrong_process_icon.svg
Normal file
@ -0,0 +1,10 @@
|
||||
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M10 20C15.5228 20 20 15.5228 20 10C20 4.47715 15.5228 0 10 0C4.47715 0 0 4.47715 0 10C0 15.5228 4.47715 20 10 20Z" fill="#FFB09E"/>
|
||||
<path d="M9.9999 0C9.79708 0 9.59588 0.00676056 9.39604 0.018672C14.6376 0.330986 18.5355 4.67996 18.5355 10C18.5355 15.32 14.6376 19.669 9.396 19.9813C9.59588 19.9932 9.79708 20 9.9999 20C15.5228 20 19.9999 15.5229 19.9999 10C19.9999 4.47714 15.5228 0 9.9999 0Z" fill="#FFA78F"/>
|
||||
<path d="M10.0002 18.5355C14.7142 18.5355 18.5357 14.714 18.5357 9.99993C18.5357 5.28586 14.7142 1.46436 10.0002 1.46436C5.28611 1.46436 1.4646 5.28586 1.4646 9.99993C1.4646 14.714 5.28611 18.5355 10.0002 18.5355Z" fill="#F07281"/>
|
||||
<path d="M10.0006 1.46436C9.79753 1.46436 9.59625 1.47196 9.39673 1.48588C13.829 1.79574 17.3284 5.48894 17.3284 9.99993C17.3284 14.511 13.829 18.2041 9.39673 18.514C9.59625 18.5279 9.79753 18.5355 10.0006 18.5355C14.7147 18.5355 18.5362 14.714 18.5362 9.99993C18.5362 5.28589 14.7147 1.46436 10.0006 1.46436Z" fill="#EB5569"/>
|
||||
<path d="M14.074 12.1165L12.4961 10.5386C12.336 10.3786 12.336 10.119 12.4961 9.95887L14.074 8.38097C14.3867 8.06825 14.3867 7.56121 14.074 7.24849L13.0007 6.17521C12.688 5.86249 12.181 5.86249 11.8682 6.17521L10.2903 7.75312C10.1303 7.9132 9.8707 7.9132 9.71058 7.75312L8.13267 6.17521C7.81996 5.86249 7.31292 5.86249 7.0002 6.17521L5.92692 7.24849C5.6142 7.56121 5.6142 8.06825 5.92692 8.38097L7.50483 9.95887C7.66491 10.119 7.66491 10.3785 7.50483 10.5386L5.92692 12.1165C5.6142 12.4293 5.6142 12.9363 5.92692 13.249L7.0002 14.3223C7.31292 14.635 7.81996 14.635 8.13267 14.3223L9.71058 12.7444C9.87066 12.5843 10.1302 12.5843 10.2903 12.7444L11.8682 14.3223C12.181 14.635 12.688 14.635 13.0007 14.3223L14.074 13.249C14.3867 12.9363 14.3867 12.4293 14.074 12.1165Z" fill="#FFEEE6"/>
|
||||
<path d="M7.36483 6.63131L9.01368 8.35767C9.17377 8.51775 9.43332 8.51775 9.59344 8.35767L10.0004 7.8732C9.89546 7.8732 9.79055 7.83316 9.71051 7.75312L8.1326 6.17521C7.81988 5.86249 7.31284 5.86249 7.00012 6.17521L6.77759 6.39775C6.98946 6.39223 7.2031 6.46958 7.36483 6.63131Z" fill="#FFDFCF"/>
|
||||
<path d="M8.96663 12.2028L7.28639 13.9606C7.16578 14.0812 7.0162 14.1547 6.86011 14.1823L7.00011 14.3223C7.31282 14.6351 7.81987 14.6351 8.13258 14.3223L9.71049 12.7444C9.79053 12.6644 9.89544 12.6244 10.0003 12.6244L9.54635 12.2028C9.38627 12.0427 9.12671 12.0427 8.96663 12.2028Z" fill="#FFDFCF"/>
|
||||
<path d="M12.496 10.5386C12.3359 10.3785 12.3359 10.119 12.496 9.95887L14.0739 8.38097C14.3866 8.06825 14.3866 7.56121 14.0739 7.24849L13.0006 6.17521C12.6879 5.86249 12.1809 5.86249 11.8682 6.17521L11.5521 6.49131C11.8061 6.44008 12.0802 6.51272 12.2772 6.70974L12.8662 7.24845C13.1789 7.56117 13.1789 8.06821 12.8662 8.38093L11.2883 9.95883C11.1282 10.1189 11.1282 10.3785 11.2883 10.5386L12.8662 12.1165C13.1789 12.4292 13.1789 12.9362 12.8662 13.2489L12.3243 13.7721C12.105 13.9914 11.7904 14.0563 11.514 13.968L11.8682 14.3222C12.1809 14.6349 12.6879 14.6349 13.0006 14.3222L14.0739 13.2489C14.3866 12.9362 14.3866 12.4292 14.0739 12.1165L12.496 10.5386Z" fill="#FFDFCF"/>
|
||||
</svg>
|
After Width: | Height: | Size: 3.1 KiB |
@ -42,7 +42,8 @@ class HomeBloc extends Bloc<HomeEvent, HomeState> {
|
||||
|
||||
Future _fetchUserInfo(FetchUserInfo event, Emitter<HomeState> emit) async {
|
||||
try {
|
||||
var uuid = await const FlutterSecureStorage().read(key: UserModel.userUuidKey);
|
||||
var uuid =
|
||||
await const FlutterSecureStorage().read(key: UserModel.userUuidKey);
|
||||
user = await HomeApi().fetchUserInfo(uuid);
|
||||
emit(HomeInitial());
|
||||
} catch (e) {
|
||||
@ -93,8 +94,10 @@ class HomeBloc extends Bloc<HomeEvent, HomeState> {
|
||||
HomeItemModel(
|
||||
title: 'Move in',
|
||||
icon: Assets.moveinIcon,
|
||||
active: false,
|
||||
onPress: (context) {},
|
||||
active: true,
|
||||
onPress: (context) {
|
||||
context.go(RoutesConst.rolesAndPermissions);
|
||||
},
|
||||
color: ColorsManager.primaryColor,
|
||||
),
|
||||
HomeItemModel(
|
||||
|
@ -0,0 +1,42 @@
|
||||
import 'dart:async';
|
||||
import 'package:bloc/bloc.dart';
|
||||
import 'package:syncrow_web/pages/roles_and_permission/bloc/roles_permission_event.dart';
|
||||
import 'package:syncrow_web/pages/roles_and_permission/bloc/roles_permission_state.dart';
|
||||
import 'package:syncrow_web/pages/roles_and_permission/model/role_model.dart';
|
||||
|
||||
class RolesPermissionBloc
|
||||
extends Bloc<RolesPermissionEvent, RolesPermissionState> {
|
||||
RolesPermissionBloc() : super(RolesInitial()) {
|
||||
on<GetRoles>(_getRoles);
|
||||
on<ChangeTapSelected>(changeTapSelected);
|
||||
}
|
||||
List<RoleModel> roleModel = [];
|
||||
|
||||
FutureOr<void> _getRoles(
|
||||
GetRoles event, Emitter<RolesPermissionState> emit) async {
|
||||
emit(UsersLoadingState());
|
||||
try {
|
||||
roleModel = [
|
||||
RoleModel(roleId: '1', roleImage: '', roleName: 'Admin'),
|
||||
RoleModel(roleId: '2', roleImage: '', roleName: 'Security'),
|
||||
RoleModel(roleId: '2', roleImage: '', roleName: 'Reception'),
|
||||
];
|
||||
emit(UsersLoadedState());
|
||||
} catch (e) {
|
||||
emit(ErrorState(e.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
bool tapSelect = true;
|
||||
|
||||
changeTapSelected(
|
||||
ChangeTapSelected event, Emitter<RolesPermissionState> emit) {
|
||||
try {
|
||||
emit(RolesLoadingState());
|
||||
tapSelect = event.selected;
|
||||
emit(ChangeTapStatus(select: !tapSelect));
|
||||
} catch (e) {
|
||||
emit(ErrorState(e.toString()));
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
import 'package:equatable/equatable.dart';
|
||||
|
||||
sealed class RolesPermissionEvent extends Equatable {
|
||||
const RolesPermissionEvent();
|
||||
}
|
||||
|
||||
class GetRoles extends RolesPermissionEvent {
|
||||
const GetRoles();
|
||||
@override
|
||||
List<Object?> get props => [];
|
||||
}
|
||||
|
||||
class GetBatchStatus extends RolesPermissionEvent {
|
||||
final List<String> uuids;
|
||||
const GetBatchStatus(this.uuids);
|
||||
@override
|
||||
List<Object?> get props => [uuids];
|
||||
}
|
||||
|
||||
class GetDeviceRecords extends RolesPermissionEvent {
|
||||
final String uuid;
|
||||
|
||||
const GetDeviceRecords(this.uuid);
|
||||
@override
|
||||
List<Object?> get props => [uuid];
|
||||
}
|
||||
|
||||
class GetDeviceAutomationRecords extends RolesPermissionEvent {
|
||||
final String uuid;
|
||||
const GetDeviceAutomationRecords(this.uuid);
|
||||
@override
|
||||
List<Object?> get props => [uuid];
|
||||
}
|
||||
|
||||
class ChangeTapSelected extends RolesPermissionEvent {
|
||||
final bool selected;
|
||||
const ChangeTapSelected(this.selected);
|
||||
|
||||
@override
|
||||
List<Object?> get props => [selected];
|
||||
}
|
@ -0,0 +1,77 @@
|
||||
import 'package:equatable/equatable.dart';
|
||||
|
||||
sealed class RolesPermissionState extends Equatable {
|
||||
const RolesPermissionState();
|
||||
}
|
||||
|
||||
final class RolesInitial extends RolesPermissionState {
|
||||
@override
|
||||
List<Object> get props => [];
|
||||
}
|
||||
|
||||
final class RolesLoadingState extends RolesPermissionState {
|
||||
@override
|
||||
List<Object> get props => [];
|
||||
}
|
||||
final class UsersLoadingState extends RolesPermissionState {
|
||||
@override
|
||||
List<Object> get props => [];
|
||||
}
|
||||
|
||||
final class RolesLoadedState extends RolesPermissionState {
|
||||
@override
|
||||
List<Object> get props => [];
|
||||
}
|
||||
final class UsersLoadedState extends RolesPermissionState {
|
||||
@override
|
||||
List<Object> get props => [];
|
||||
}
|
||||
|
||||
final class ErrorState extends RolesPermissionState {
|
||||
final String message;
|
||||
|
||||
const ErrorState(this.message);
|
||||
|
||||
@override
|
||||
List<Object> get props => [message];
|
||||
}
|
||||
|
||||
/// report state
|
||||
final class SosReportLoadingState extends RolesPermissionState {
|
||||
@override
|
||||
List<Object> get props => [];
|
||||
}
|
||||
|
||||
final class RolesErrorState extends RolesPermissionState {
|
||||
final String message;
|
||||
|
||||
const RolesErrorState(this.message);
|
||||
|
||||
@override
|
||||
List<Object> get props => [message];
|
||||
}
|
||||
|
||||
/// automation reports
|
||||
|
||||
final class SosAutomationReportLoadingState extends RolesPermissionState {
|
||||
@override
|
||||
List<Object> get props => [];
|
||||
}
|
||||
|
||||
final class SosAutomationReportErrorState extends RolesPermissionState {
|
||||
final String message;
|
||||
|
||||
const SosAutomationReportErrorState(this.message);
|
||||
|
||||
@override
|
||||
List<Object> get props => [message];
|
||||
}
|
||||
|
||||
final class ChangeTapStatus extends RolesPermissionState {
|
||||
bool select = true;
|
||||
|
||||
ChangeTapStatus({required this.select});
|
||||
|
||||
@override
|
||||
List<Object> get props => [select];
|
||||
}
|
6
lib/pages/roles_and_permission/model/role_model.dart
Normal file
@ -0,0 +1,6 @@
|
||||
class RoleModel {
|
||||
String? roleId;
|
||||
String? roleName;
|
||||
String? roleImage;
|
||||
RoleModel({this.roleId, this.roleName, this.roleImage});
|
||||
}
|
22
lib/pages/roles_and_permission/model/roles_user_model.dart
Normal file
@ -0,0 +1,22 @@
|
||||
class RolesUserModel {
|
||||
String? id;
|
||||
String? userName;
|
||||
String? userEmail;
|
||||
String? userRole;
|
||||
String? creationDate;
|
||||
String? creationTime;
|
||||
String? createdBy;
|
||||
String? status;
|
||||
String? action;
|
||||
RolesUserModel(
|
||||
{this.id,
|
||||
this.userName,
|
||||
this.userEmail,
|
||||
this.userRole,
|
||||
this.creationDate,
|
||||
this.creationTime,
|
||||
this.status,
|
||||
this.action,
|
||||
this.createdBy,
|
||||
});
|
||||
}
|
136
lib/pages/roles_and_permission/users_page/bloc/users_bloc.dart
Normal file
@ -0,0 +1,136 @@
|
||||
import 'package:bloc/bloc.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:syncrow_web/pages/roles_and_permission/model/roles_user_model.dart';
|
||||
import 'package:syncrow_web/pages/roles_and_permission/users_page/bloc/users_event.dart';
|
||||
import 'package:syncrow_web/pages/roles_and_permission/users_page/bloc/users_status.dart';
|
||||
|
||||
class UsersBloc extends Bloc<UsersEvent, UsersState> {
|
||||
UsersBloc() : super(UsersInitial()) {
|
||||
on<GetUsers>(_getUsers);
|
||||
on<ChangeUserStatus>(_changeUserStatus);
|
||||
on<CheckStepStatus>(isCompleteBasicsFun);
|
||||
}
|
||||
|
||||
List<RolesUserModel> users = [];
|
||||
|
||||
Future<void> _getUsers(GetUsers event, Emitter<UsersState> emit) async {
|
||||
emit(UsersLoadingState());
|
||||
try {
|
||||
users = [
|
||||
RolesUserModel(
|
||||
id: '1',
|
||||
userName: 'user 1',
|
||||
userEmail: 'test1@test.com',
|
||||
action: '',
|
||||
createdBy: 'Admin',
|
||||
creationDate: '25/10/2024',
|
||||
creationTime: '10:30 AM',
|
||||
status: 'Invited',
|
||||
),
|
||||
RolesUserModel(
|
||||
id: '2',
|
||||
userName: 'user 2',
|
||||
userEmail: 'test2@test.com',
|
||||
action: '',
|
||||
createdBy: 'Admin',
|
||||
creationDate: '25/10/2024',
|
||||
creationTime: '10:30 AM',
|
||||
status: 'Active',
|
||||
),
|
||||
RolesUserModel(
|
||||
id: '3',
|
||||
userName: 'user 3',
|
||||
userEmail: 'test3@test.com',
|
||||
action: '',
|
||||
createdBy: 'Admin',
|
||||
creationDate: '25/10/2024',
|
||||
creationTime: '10:30 AM',
|
||||
status: 'Disabled',
|
||||
),
|
||||
];
|
||||
emit(UsersLoadedState(users: users));
|
||||
} catch (e) {
|
||||
emit(ErrorState(e.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
void _changeUserStatus(ChangeUserStatus event, Emitter<UsersState> emit) {
|
||||
try {
|
||||
// Update the user's status
|
||||
users = users.map((user) {
|
||||
if (user.id == event.userId) {
|
||||
return RolesUserModel(
|
||||
id: user.id,
|
||||
userName: user.userName,
|
||||
userEmail: user.userEmail,
|
||||
createdBy: user.createdBy,
|
||||
creationDate: user.creationDate,
|
||||
creationTime: user.creationTime,
|
||||
status: event.newStatus,
|
||||
action: user.action,
|
||||
);
|
||||
}
|
||||
return user;
|
||||
}).toList();
|
||||
|
||||
emit(UsersLoadedState(users: users));
|
||||
} catch (e) {
|
||||
emit(ErrorState(e.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
final formKey = GlobalKey<FormState>();
|
||||
final TextEditingController firstNameController = TextEditingController();
|
||||
final TextEditingController lastNameController = TextEditingController();
|
||||
final TextEditingController emailController = TextEditingController();
|
||||
final TextEditingController phoneController = TextEditingController();
|
||||
final TextEditingController jobTitleController = TextEditingController();
|
||||
|
||||
bool isCompleteBasics = false;
|
||||
bool isCompleteRolePermissions = false;
|
||||
bool isCompleteSpaces = false;
|
||||
|
||||
int numberBasics = 0;
|
||||
int numberSpaces = 0;
|
||||
int numberRole = 0;
|
||||
|
||||
isCompleteBasicsFun(CheckStepStatus event, Emitter<UsersState> emit) {
|
||||
emit(UsersLoadingState());
|
||||
isCompleteBasics = firstNameController.text.isNotEmpty &&
|
||||
lastNameController.text.isNotEmpty &&
|
||||
emailController.text.isNotEmpty &&
|
||||
phoneController.text.isNotEmpty &&
|
||||
jobTitleController.text.isNotEmpty;
|
||||
emit(ChangeStatusSteps());
|
||||
}
|
||||
|
||||
// void checkStatus(CheckStepStatus event, Emitter<UsersState> emit) {
|
||||
// try {
|
||||
// // Check if basic fields are completed
|
||||
// isCompleteBasics = firstNameController.text.isNotEmpty &&
|
||||
// lastNameController.text.isNotEmpty &&
|
||||
// emailController.text.isNotEmpty &&
|
||||
// phoneController.text.isNotEmpty &&
|
||||
// jobTitleController.text.isNotEmpty;
|
||||
// // Emit the updated state
|
||||
// if (isCompleteBasics && isCompleteRolePermissions && isCompleteSpaces) {
|
||||
// } else {
|
||||
// // emit(IncompleteState(
|
||||
// // isCompleteBasics, isCompleteRolePermissions, isCompleteSpaces));
|
||||
// }
|
||||
// } catch (e) {
|
||||
// emit(ErrorState(e.toString()));
|
||||
// }
|
||||
// }
|
||||
|
||||
// Example placeholder methods for role permissions and spaces
|
||||
bool checkRolePermissions() {
|
||||
// Add logic to check if role permissions are completed
|
||||
return true; // Replace with actual logic
|
||||
}
|
||||
|
||||
bool checkSpaces() {
|
||||
// Add logic to check if spaces are completed
|
||||
return true; // Replace with actual logic
|
||||
}
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
import 'package:equatable/equatable.dart';
|
||||
|
||||
sealed class UsersEvent extends Equatable {
|
||||
const UsersEvent();
|
||||
}
|
||||
|
||||
class GetUsers extends UsersEvent {
|
||||
const GetUsers();
|
||||
@override
|
||||
List<Object?> get props => [];
|
||||
}
|
||||
|
||||
class GetBatchStatus extends UsersEvent {
|
||||
final List<String> uuids;
|
||||
const GetBatchStatus(this.uuids);
|
||||
@override
|
||||
List<Object?> get props => [uuids];
|
||||
}
|
||||
|
||||
class ChangeUserStatus extends UsersEvent {
|
||||
final String userId;
|
||||
final String newStatus;
|
||||
|
||||
const ChangeUserStatus({required this.userId, required this.newStatus});
|
||||
|
||||
@override
|
||||
List<Object?> get props => [userId, newStatus];
|
||||
}
|
||||
|
||||
class CheckStepStatus extends UsersEvent {
|
||||
final int? steps;
|
||||
const CheckStepStatus({this.steps});
|
||||
@override
|
||||
List<Object?> get props => [steps];
|
||||
}
|
@ -0,0 +1,57 @@
|
||||
import 'package:equatable/equatable.dart';
|
||||
import 'package:syncrow_web/pages/roles_and_permission/model/roles_user_model.dart';
|
||||
|
||||
sealed class UsersState extends Equatable {
|
||||
const UsersState();
|
||||
}
|
||||
|
||||
final class UsersInitial extends UsersState {
|
||||
@override
|
||||
List<Object> get props => [];
|
||||
}
|
||||
|
||||
final class ChangeStatusSteps extends UsersState {
|
||||
@override
|
||||
List<Object> get props => [];
|
||||
}
|
||||
|
||||
final class UsersLoadingState extends UsersState {
|
||||
@override
|
||||
List<Object> get props => [];
|
||||
}
|
||||
|
||||
final class UsersLoadedState extends UsersState {
|
||||
List<RolesUserModel> users = [];
|
||||
UsersLoadedState({required this.users});
|
||||
@override
|
||||
List<Object> get props => [users];
|
||||
}
|
||||
|
||||
final class ErrorState extends UsersState {
|
||||
final String message;
|
||||
|
||||
const ErrorState(this.message);
|
||||
|
||||
@override
|
||||
List<Object> get props => [message];
|
||||
}
|
||||
|
||||
final class RolesErrorState extends UsersState {
|
||||
final String message;
|
||||
|
||||
const RolesErrorState(this.message);
|
||||
|
||||
@override
|
||||
List<Object> get props => [message];
|
||||
}
|
||||
|
||||
/// automation reports
|
||||
|
||||
final class ChangeTapStatus extends UsersState {
|
||||
bool select = true;
|
||||
|
||||
ChangeTapStatus({required this.select});
|
||||
|
||||
@override
|
||||
List<Object> get props => [select];
|
||||
}
|
@ -0,0 +1,214 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
import 'package:syncrow_web/pages/roles_and_permission/users_page/bloc/users_bloc.dart';
|
||||
import 'package:syncrow_web/pages/roles_and_permission/users_page/bloc/users_status.dart';
|
||||
import 'package:syncrow_web/pages/roles_and_permission/users_page/view/basics_view.dart';
|
||||
import 'package:syncrow_web/pages/roles_and_permission/users_page/view/roles_and_permission.dart';
|
||||
import 'package:syncrow_web/pages/roles_and_permission/users_page/view/spaces_access_view.dart';
|
||||
import 'package:syncrow_web/utils/color_manager.dart';
|
||||
import 'package:syncrow_web/utils/constants/assets.dart';
|
||||
|
||||
class AddNewUserDialog extends StatefulWidget {
|
||||
const AddNewUserDialog({super.key});
|
||||
|
||||
@override
|
||||
_AddNewUserDialogState createState() => _AddNewUserDialogState();
|
||||
}
|
||||
|
||||
class _AddNewUserDialogState extends State<AddNewUserDialog> {
|
||||
int currentStep = 1;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BlocProvider(
|
||||
create: (BuildContext context) => UsersBloc(),
|
||||
child: BlocConsumer<UsersBloc, UsersState>(
|
||||
listener: (context, state) {},
|
||||
builder: (context, state) {
|
||||
final _blocRole = BlocProvider.of<UsersBloc>(context);
|
||||
|
||||
return Dialog(
|
||||
child: Container(
|
||||
decoration: const BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.all(Radius.circular(20))),
|
||||
width: 900,
|
||||
child: Column(
|
||||
children: [
|
||||
// Title
|
||||
const Padding(
|
||||
padding: EdgeInsets.all(8.0),
|
||||
child: SizedBox(
|
||||
child: Text(
|
||||
"Add New User",
|
||||
style: TextStyle(
|
||||
fontSize: 18, fontWeight: FontWeight.bold),
|
||||
),
|
||||
),
|
||||
),
|
||||
const Divider(),
|
||||
Expanded(
|
||||
child: Row(
|
||||
children: [
|
||||
// Sidebar for Steps
|
||||
Expanded(
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(20),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
_buildStepIndicator(1, "Basics", _blocRole),
|
||||
_buildStepIndicator(2, "Spaces", _blocRole),
|
||||
_buildStepIndicator(
|
||||
3, "Role & Permissions", _blocRole),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: 1,
|
||||
color: ColorsManager.grayBorder,
|
||||
),
|
||||
// Main content (Form)
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(20.0),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const SizedBox(height: 10),
|
||||
Expanded(
|
||||
child: _getFormContent(),
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
child: const Text("Cancel"),
|
||||
),
|
||||
ElevatedButton(
|
||||
onPressed: () {
|
||||
if (_blocRole.formKey.currentState
|
||||
?.validate() ??
|
||||
false) {
|
||||
// Proceed to next step or finish
|
||||
setState(() {
|
||||
if (currentStep < 3) {
|
||||
currentStep++;
|
||||
} else {
|
||||
Navigator.of(context).pop();
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
child: Text(currentStep < 3
|
||||
? "Next"
|
||||
: "Finish"),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
));
|
||||
}));
|
||||
}
|
||||
|
||||
// Method to get the form content based on the current step
|
||||
Widget _getFormContent() {
|
||||
switch (currentStep) {
|
||||
case 1:
|
||||
return const BasicsView();
|
||||
case 2:
|
||||
return const SpacesAccessView();
|
||||
case 3:
|
||||
return const RolesAndPermission();
|
||||
default:
|
||||
return Container();
|
||||
}
|
||||
}
|
||||
|
||||
// Helper method to build step indicators
|
||||
Widget _buildStepIndicator(int step, String label, UsersBloc bloc) {
|
||||
return GestureDetector(
|
||||
onTap: () {
|
||||
// if (bloc.formKey.currentState?.validate() ?? false) {
|
||||
setState(() {
|
||||
currentStep = step;
|
||||
if (currentStep == 1) {
|
||||
bloc.numberBasics = 1;
|
||||
} else if (currentStep == 2) {
|
||||
bloc.numberSpaces = 2;
|
||||
} else if (currentStep == 3) {
|
||||
bloc.numberRole = 3;
|
||||
}
|
||||
});
|
||||
// }
|
||||
},
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(5.0),
|
||||
child: Row(
|
||||
children: [
|
||||
SvgPicture.asset(
|
||||
currentStep == step
|
||||
? Assets.currentProcessIcon
|
||||
: bloc.isCompleteBasics == false
|
||||
&& (bloc.numberBasics != 0 ||
|
||||
bloc.numberRole != 0 ||
|
||||
bloc.numberSpaces != 0)
|
||||
? Assets.wrongProcessIcon
|
||||
: Assets.uncomplete_ProcessIcon,
|
||||
|
||||
width: 25,
|
||||
height: 25,
|
||||
),
|
||||
const SizedBox(width: 10),
|
||||
Text(
|
||||
label,
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
color: currentStep == step
|
||||
? ColorsManager.blackColor
|
||||
: ColorsManager.greyColor,
|
||||
fontWeight: currentStep == step
|
||||
? FontWeight.bold
|
||||
: FontWeight.normal,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
if (step != 3)
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(5.0),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(left: 12),
|
||||
child: Container(
|
||||
height: 60,
|
||||
width: 1,
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
279
lib/pages/roles_and_permission/users_page/view/basics_view.dart
Normal file
@ -0,0 +1,279 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart'; // Import Bloc package
|
||||
import 'package:syncrow_web/pages/roles_and_permission/users_page/bloc/users_bloc.dart';
|
||||
import 'package:syncrow_web/pages/roles_and_permission/users_page/bloc/users_status.dart';
|
||||
import 'package:syncrow_web/utils/color_manager.dart';
|
||||
import 'package:syncrow_web/utils/extension/build_context_x.dart';
|
||||
import 'package:syncrow_web/utils/style.dart';
|
||||
|
||||
class BasicsView extends StatelessWidget {
|
||||
const BasicsView({super.key});
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BlocBuilder<UsersBloc, UsersState>(builder: (context, state) {
|
||||
final _blocRole = BlocProvider.of<UsersBloc>(context);
|
||||
return Form(
|
||||
key: _blocRole.formKey,
|
||||
child: ListView(
|
||||
shrinkWrap: true,
|
||||
children: [
|
||||
Text(
|
||||
'Set up the basics',
|
||||
style: context.textTheme.bodyLarge?.copyWith(
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 20,
|
||||
color: Colors.black),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 80,
|
||||
),
|
||||
Text(
|
||||
'To get started, fill out some basic information about who you’re adding as a user.',
|
||||
style: context.textTheme.bodyMedium?.copyWith(
|
||||
fontWeight: FontWeight.w400,
|
||||
fontSize: 14,
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 25,
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
// First Name
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
SizedBox(
|
||||
child: Row(
|
||||
children: [
|
||||
Text(
|
||||
"*",
|
||||
style: TextStyle(color: ColorsManager.red),
|
||||
),
|
||||
Text(
|
||||
'First Name',
|
||||
style: context.textTheme.bodyMedium?.copyWith(
|
||||
fontWeight: FontWeight.w400,
|
||||
fontSize: 13,
|
||||
),
|
||||
),
|
||||
],
|
||||
)),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: TextFormField(
|
||||
style: TextStyle(color: Colors.black),
|
||||
controller: _blocRole.firstNameController,
|
||||
decoration: inputTextFormDeco(
|
||||
hintText: "Enter first name",
|
||||
).copyWith(
|
||||
hintStyle: context.textTheme.bodyMedium?.copyWith(
|
||||
fontWeight: FontWeight.w400,
|
||||
fontSize: 12,
|
||||
color: ColorsManager.textGray),
|
||||
),
|
||||
validator: (value) {
|
||||
if (value == null || value.isEmpty) {
|
||||
return 'Enter first name';
|
||||
}
|
||||
return null;
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
SizedBox(width: 10),
|
||||
|
||||
// Last Name
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
SizedBox(
|
||||
child: Row(
|
||||
children: [
|
||||
const Text(
|
||||
"*",
|
||||
style: TextStyle(color: ColorsManager.red),
|
||||
),
|
||||
Text('Last Name',
|
||||
style: context.textTheme.bodyMedium?.copyWith(
|
||||
fontWeight: FontWeight.w400,
|
||||
fontSize: 13,
|
||||
)),
|
||||
],
|
||||
)),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: TextFormField(
|
||||
controller: _blocRole.lastNameController,
|
||||
style: TextStyle(color: Colors.black),
|
||||
decoration:
|
||||
inputTextFormDeco(hintText: "Enter last name")
|
||||
.copyWith(
|
||||
hintStyle: context
|
||||
.textTheme.bodyMedium
|
||||
?.copyWith(
|
||||
fontWeight: FontWeight.w400,
|
||||
fontSize: 12,
|
||||
color: ColorsManager.textGray)),
|
||||
validator: (value) {
|
||||
if (value == null || value.isEmpty) {
|
||||
return 'Enter last name';
|
||||
}
|
||||
return null;
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 10),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
SizedBox(
|
||||
child: Row(
|
||||
children: [
|
||||
Text(
|
||||
"*",
|
||||
style: TextStyle(color: ColorsManager.red),
|
||||
),
|
||||
Text(
|
||||
'Email Address',
|
||||
style: context.textTheme.bodyMedium?.copyWith(
|
||||
fontWeight: FontWeight.w400,
|
||||
fontSize: 13,
|
||||
),
|
||||
),
|
||||
],
|
||||
)),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: TextFormField(
|
||||
controller: _blocRole.emailController,
|
||||
style: TextStyle(color: Colors.black),
|
||||
decoration: inputTextFormDeco(hintText: "name@example.com")
|
||||
.copyWith(
|
||||
hintStyle: context.textTheme.bodyMedium?.copyWith(
|
||||
fontWeight: FontWeight.w400,
|
||||
fontSize: 12,
|
||||
color: ColorsManager.textGray),
|
||||
),
|
||||
validator: (value) {
|
||||
if (value == null || value.isEmpty) {
|
||||
return 'Enter last name';
|
||||
}
|
||||
return null;
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 10),
|
||||
Row(
|
||||
children: [
|
||||
// Phone Number
|
||||
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
SizedBox(
|
||||
child: Row(
|
||||
children: [
|
||||
Text(
|
||||
"*",
|
||||
style: TextStyle(color: ColorsManager.red),
|
||||
),
|
||||
Text(
|
||||
'Mobile Number',
|
||||
style: context.textTheme.bodyMedium?.copyWith(
|
||||
fontWeight: FontWeight.w400,
|
||||
fontSize: 13,
|
||||
),
|
||||
),
|
||||
],
|
||||
)),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: TextFormField(
|
||||
style: const TextStyle(color: Colors.black),
|
||||
controller: _blocRole.phoneController,
|
||||
decoration: inputTextFormDeco(
|
||||
hintText: "05x xxx xxxx",
|
||||
).copyWith(
|
||||
hintStyle: context.textTheme.bodyMedium?.copyWith(
|
||||
fontWeight: FontWeight.w400,
|
||||
fontSize: 12,
|
||||
color: ColorsManager.textGray),
|
||||
),
|
||||
validator: (value) {
|
||||
if (value == null || value.isEmpty) {
|
||||
return 'Please enter a phone number';
|
||||
}
|
||||
return null;
|
||||
},
|
||||
keyboardType: TextInputType.phone,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
SizedBox(width: 10),
|
||||
|
||||
// Job Title
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
SizedBox(
|
||||
child: Row(
|
||||
children: [
|
||||
Text(
|
||||
"*",
|
||||
style: TextStyle(color: ColorsManager.red),
|
||||
),
|
||||
Text(
|
||||
'Job Title',
|
||||
style: context.textTheme.bodyMedium?.copyWith(
|
||||
fontWeight: FontWeight.w400,
|
||||
fontSize: 13,
|
||||
),
|
||||
),
|
||||
],
|
||||
)),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: TextFormField(
|
||||
controller: _blocRole.jobTitleController,
|
||||
style: TextStyle(color: Colors.black),
|
||||
decoration: inputTextFormDeco(
|
||||
hintText: "Job Title (Optional)")
|
||||
.copyWith(
|
||||
hintStyle: context.textTheme.bodyMedium?.copyWith(
|
||||
fontWeight: FontWeight.w400,
|
||||
fontSize: 12,
|
||||
color: ColorsManager.textGray),
|
||||
),
|
||||
keyboardType: TextInputType.phone,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 20),
|
||||
],
|
||||
),
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
@ -0,0 +1,498 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart'; // Import Bloc package
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
import 'package:syncrow_web/pages/roles_and_permission/users_page/bloc/users_bloc.dart';
|
||||
import 'package:syncrow_web/pages/roles_and_permission/users_page/bloc/users_status.dart';
|
||||
import 'package:syncrow_web/utils/color_manager.dart';
|
||||
import 'package:syncrow_web/utils/constants/assets.dart';
|
||||
import 'package:syncrow_web/utils/extension/build_context_x.dart';
|
||||
import 'package:syncrow_web/utils/style.dart';
|
||||
|
||||
class RolesAndPermission extends StatelessWidget {
|
||||
const RolesAndPermission({super.key});
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final size = MediaQuery.of(context).size;
|
||||
|
||||
return BlocBuilder<UsersBloc, UsersState>(builder: (context, state) {
|
||||
final _blocRole = BlocProvider.of<UsersBloc>(context);
|
||||
return Container(
|
||||
color: Colors.white,
|
||||
child: Form(
|
||||
key: _blocRole.formKey,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'Role & Permissions',
|
||||
style: context.textTheme.bodyLarge?.copyWith(
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 20,
|
||||
color: Colors.black),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 15,
|
||||
),
|
||||
const SizedBox(width: 300, height: 110, child: DropdownExample()),
|
||||
const SizedBox(height: 10),
|
||||
Expanded(
|
||||
child: SizedBox(
|
||||
child: Column(
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Container(
|
||||
decoration: const BoxDecoration(
|
||||
color: ColorsManager.CircleRolesBackground,
|
||||
borderRadius: BorderRadius.only(
|
||||
topRight: Radius.circular(20),
|
||||
topLeft: Radius.circular(20)),
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: const BorderRadius.all(
|
||||
Radius.circular(20)),
|
||||
border: Border.all(
|
||||
color: ColorsManager.grayBorder)),
|
||||
child: TextFormField(
|
||||
style:
|
||||
const TextStyle(color: Colors.black),
|
||||
controller: _blocRole.firstNameController,
|
||||
decoration: textBoxDecoration(radios: 20)!
|
||||
.copyWith(
|
||||
fillColor: Colors.white,
|
||||
suffixIcon: Padding(
|
||||
padding:
|
||||
const EdgeInsets.only(right: 16),
|
||||
child: SvgPicture.asset(
|
||||
Assets.textFieldSearch,
|
||||
width: 24,
|
||||
height: 24,
|
||||
),
|
||||
),
|
||||
hintStyle: context.textTheme.bodyMedium
|
||||
?.copyWith(
|
||||
fontWeight: FontWeight.w400,
|
||||
fontSize: 12,
|
||||
color: ColorsManager.textGray),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 7,
|
||||
child: Container(
|
||||
color: ColorsManager.CircleRolesBackground,
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Container(
|
||||
color: ColorsManager.whiteColors,
|
||||
child: const DeviceManagement())))
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
class DropdownExample extends StatefulWidget {
|
||||
const DropdownExample({super.key});
|
||||
|
||||
@override
|
||||
_DropdownExampleState createState() => _DropdownExampleState();
|
||||
}
|
||||
|
||||
class _DropdownExampleState extends State<DropdownExample> {
|
||||
String? selectedRole;
|
||||
List<String> roles = ['Admin', 'User', 'Guest', 'Moderator'];
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(10.0),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const Text(
|
||||
"Role",
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 16,
|
||||
color: Colors.black,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
SizedBox(
|
||||
child: DropdownButtonFormField<String>(
|
||||
alignment: Alignment.center,
|
||||
focusColor: ColorsManager.whiteColors,
|
||||
autofocus: true,
|
||||
value: selectedRole,
|
||||
items: roles.map((role) {
|
||||
return DropdownMenuItem(
|
||||
value: role,
|
||||
child: Text(role),
|
||||
);
|
||||
}).toList(),
|
||||
onChanged: (value) {
|
||||
setState(() {
|
||||
selectedRole = value;
|
||||
});
|
||||
},
|
||||
padding: EdgeInsets.zero,
|
||||
icon: const SizedBox.shrink(),
|
||||
borderRadius: const BorderRadius.all(Radius.circular(10)),
|
||||
hint: const Padding(
|
||||
padding: EdgeInsets.only(left: 20),
|
||||
child: Text("Please Select"),
|
||||
),
|
||||
decoration: inputTextFormDeco().copyWith(
|
||||
contentPadding: EdgeInsets.zero,
|
||||
suffixIcon: Container(
|
||||
padding: EdgeInsets.zero,
|
||||
width: 70,
|
||||
height: 50,
|
||||
decoration: BoxDecoration(
|
||||
color: ColorsManager.graysColor,
|
||||
borderRadius: const BorderRadius.only(
|
||||
bottomRight: Radius.circular(10),
|
||||
topRight: Radius.circular(10),
|
||||
),
|
||||
border: Border.all(
|
||||
color: ColorsManager.grayBorder,
|
||||
width: 1.0,
|
||||
),
|
||||
),
|
||||
child: const Center(
|
||||
child: Icon(Icons.keyboard_arrow_down),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class DeviceManagement extends StatefulWidget {
|
||||
const DeviceManagement({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
_DeviceManagementState createState() => _DeviceManagementState();
|
||||
}
|
||||
|
||||
class _DeviceManagementState extends State<DeviceManagement> {
|
||||
final List<MainRoleOption> options = [
|
||||
MainRoleOption(
|
||||
id: '1',
|
||||
title: "Device Management",
|
||||
subOptions: [
|
||||
SubRoleOption(
|
||||
id: '11',
|
||||
title: "Manage devices in private spaces",
|
||||
children: [
|
||||
ChildRoleOption(id: '111', title: "Control"),
|
||||
ChildRoleOption(id: '112', title: "Assign device"),
|
||||
ChildRoleOption(id: '113', title: "View"),
|
||||
],
|
||||
),
|
||||
SubRoleOption(
|
||||
id: '12',
|
||||
title: "Manage",
|
||||
children: [
|
||||
ChildRoleOption(id: '121', title: "cc"),
|
||||
ChildRoleOption(id: '122', title: "Assign"),
|
||||
ChildRoleOption(id: '123', title: "s"),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
MainRoleOption(
|
||||
id: '2',
|
||||
title: "Device Management",
|
||||
subOptions: [
|
||||
SubRoleOption(
|
||||
id: '22',
|
||||
title: "Manage devices in private spaces",
|
||||
children: [
|
||||
ChildRoleOption(id: '211', title: "Control"),
|
||||
ChildRoleOption(id: '212', title: "Assign device"),
|
||||
ChildRoleOption(id: '213', title: "View"),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
];
|
||||
|
||||
void toggleOptionById(String id) {
|
||||
setState(() {
|
||||
for (var mainOption in options) {
|
||||
if (mainOption.id == id) {
|
||||
final isChecked =
|
||||
checkifOneOfthemChecked(mainOption) == CheckState.all;
|
||||
mainOption.isChecked = !isChecked;
|
||||
|
||||
for (var subOption in mainOption.subOptions) {
|
||||
subOption.isChecked = !isChecked;
|
||||
for (var child in subOption.children) {
|
||||
child.isChecked = !isChecked;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
for (var subOption in mainOption.subOptions) {
|
||||
if (subOption.id == id) {
|
||||
subOption.isChecked = !subOption.isChecked;
|
||||
for (var child in subOption.children) {
|
||||
child.isChecked = subOption.isChecked;
|
||||
}
|
||||
mainOption.isChecked =
|
||||
mainOption.subOptions.every((sub) => sub.isChecked);
|
||||
return;
|
||||
}
|
||||
|
||||
for (var child in subOption.children) {
|
||||
if (child.id == id) {
|
||||
child.isChecked = !child.isChecked;
|
||||
subOption.isChecked =
|
||||
subOption.children.every((child) => child.isChecked);
|
||||
mainOption.isChecked =
|
||||
mainOption.subOptions.every((sub) => sub.isChecked);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
CheckState checkifOneOfthemChecked(MainRoleOption mainOption) {
|
||||
bool allSelected = true;
|
||||
bool someSelected = false;
|
||||
|
||||
for (var subOption in mainOption.subOptions) {
|
||||
if (subOption.isChecked) {
|
||||
someSelected = true;
|
||||
} else {
|
||||
allSelected = false;
|
||||
}
|
||||
|
||||
for (var child in subOption.children) {
|
||||
if (child.isChecked) {
|
||||
someSelected = true;
|
||||
} else {
|
||||
allSelected = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (allSelected) {
|
||||
return CheckState.all;
|
||||
} else if (someSelected) {
|
||||
return CheckState.some;
|
||||
} else {
|
||||
return CheckState.none;
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ListView.builder(
|
||||
padding: const EdgeInsets.all(8),
|
||||
itemCount: options.length,
|
||||
itemBuilder: (context, index) {
|
||||
final option = options[index];
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
InkWell(
|
||||
onTap: () => toggleOptionById(option.id),
|
||||
child: Builder(
|
||||
builder: (context) {
|
||||
final checkState = checkifOneOfthemChecked(option);
|
||||
|
||||
if (checkState == CheckState.all) {
|
||||
return Image.asset(
|
||||
Assets.CheckBoxChecked,
|
||||
width: 20,
|
||||
height: 20,
|
||||
);
|
||||
} else if (checkState == CheckState.some) {
|
||||
return Image.asset(
|
||||
Assets.rectangleCheckBox,
|
||||
width: 20,
|
||||
height: 20,
|
||||
);
|
||||
} else {
|
||||
return Image.asset(
|
||||
Assets.emptyBox,
|
||||
width: 20,
|
||||
height: 20,
|
||||
);
|
||||
}
|
||||
},
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
Text(
|
||||
option.title,
|
||||
style: context.textTheme.bodyMedium?.copyWith(
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 12,
|
||||
color: ColorsManager.blackColor),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
...option.subOptions.map((subOption) {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
InkWell(
|
||||
onTap: () => toggleOptionById(subOption.id),
|
||||
child: Builder(
|
||||
builder: (context) {
|
||||
final checkState =
|
||||
checkifOneOfthemChecked(MainRoleOption(
|
||||
id: subOption.id,
|
||||
title: subOption.title,
|
||||
subOptions: [subOption],
|
||||
));
|
||||
|
||||
if (checkState == CheckState.all) {
|
||||
return Image.asset(
|
||||
Assets.CheckBoxChecked,
|
||||
width: 20,
|
||||
height: 20,
|
||||
);
|
||||
} else if (checkState == CheckState.some) {
|
||||
return Image.asset(
|
||||
Assets.rectangleCheckBox,
|
||||
width: 20,
|
||||
height: 20,
|
||||
);
|
||||
} else {
|
||||
return Image.asset(
|
||||
Assets.emptyBox,
|
||||
width: 20,
|
||||
height: 20,
|
||||
);
|
||||
}
|
||||
},
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
Text(
|
||||
subOption.title,
|
||||
style: context.textTheme.bodyMedium?.copyWith(
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 12,
|
||||
color: ColorsManager.lightGreyColor),
|
||||
),
|
||||
],
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 50.0),
|
||||
child: GridView.builder(
|
||||
shrinkWrap: true,
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
gridDelegate:
|
||||
const SliverGridDelegateWithFixedCrossAxisCount(
|
||||
crossAxisCount: 2, // 2 items per row
|
||||
mainAxisSpacing: 2.0, // Space between rows
|
||||
crossAxisSpacing: 0.2, // Space between columns
|
||||
childAspectRatio: 5, // Adjust aspect ratio as needed
|
||||
),
|
||||
itemCount: subOption.children.length,
|
||||
itemBuilder: (context, index) {
|
||||
final child = subOption.children[index];
|
||||
return CheckboxListTile(
|
||||
dense: true,
|
||||
controlAffinity: ListTileControlAffinity.leading,
|
||||
title: Text(
|
||||
child.title,
|
||||
style: context.textTheme.bodyMedium?.copyWith(
|
||||
fontWeight: FontWeight.w400,
|
||||
fontSize: 12,
|
||||
color: ColorsManager.lightGreyColor),
|
||||
),
|
||||
value: child.isChecked,
|
||||
onChanged: (value) => toggleOptionById(child.id),
|
||||
);
|
||||
},
|
||||
),
|
||||
)
|
||||
],
|
||||
);
|
||||
}).toList(),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class MainRoleOption {
|
||||
String id;
|
||||
String title;
|
||||
bool isChecked;
|
||||
List<SubRoleOption> subOptions;
|
||||
MainRoleOption({
|
||||
required this.id,
|
||||
required this.title,
|
||||
this.isChecked = false,
|
||||
this.subOptions = const [],
|
||||
});
|
||||
}
|
||||
|
||||
class SubRoleOption {
|
||||
String id;
|
||||
String title;
|
||||
bool isChecked;
|
||||
List<ChildRoleOption> children;
|
||||
|
||||
SubRoleOption({
|
||||
required this.id,
|
||||
required this.title,
|
||||
this.isChecked = false,
|
||||
this.children = const [],
|
||||
});
|
||||
}
|
||||
|
||||
class ChildRoleOption {
|
||||
String id;
|
||||
String title;
|
||||
bool isChecked;
|
||||
|
||||
ChildRoleOption({
|
||||
required this.id,
|
||||
required this.title,
|
||||
this.isChecked = false,
|
||||
});
|
||||
}
|
||||
|
||||
enum CheckState { none, some, all }
|
@ -0,0 +1,338 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:flutter_svg/svg.dart';
|
||||
import 'package:syncrow_web/pages/roles_and_permission/users_page/bloc/users_bloc.dart';
|
||||
import 'package:syncrow_web/pages/roles_and_permission/users_page/bloc/users_status.dart';
|
||||
import 'package:syncrow_web/utils/color_manager.dart';
|
||||
import 'package:syncrow_web/utils/constants/assets.dart';
|
||||
import 'package:syncrow_web/utils/extension/build_context_x.dart';
|
||||
import 'package:syncrow_web/utils/style.dart';
|
||||
|
||||
class SpacesAccessView extends StatelessWidget {
|
||||
const SpacesAccessView({super.key});
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final size = MediaQuery.of(context).size;
|
||||
|
||||
return BlocBuilder<UsersBloc, UsersState>(builder: (context, state) {
|
||||
final _blocRole = BlocProvider.of<UsersBloc>(context);
|
||||
return Container(
|
||||
color: Colors.white,
|
||||
child: Form(
|
||||
key: _blocRole.formKey,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'Spaces access',
|
||||
style: context.textTheme.bodyLarge?.copyWith(
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 20,
|
||||
color: Colors.black),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 35,
|
||||
),
|
||||
const SizedBox(
|
||||
child: Text(
|
||||
'Select the spaces you would like to grant access to for the user you are adding'),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 25,
|
||||
),
|
||||
Expanded(
|
||||
child: SizedBox(
|
||||
child: Column(
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Container(
|
||||
decoration: const BoxDecoration(
|
||||
color: ColorsManager.CircleRolesBackground,
|
||||
borderRadius: BorderRadius.only(
|
||||
topRight: Radius.circular(20),
|
||||
topLeft: Radius.circular(20)),
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: const BorderRadius.all(
|
||||
Radius.circular(20)),
|
||||
border: Border.all(
|
||||
color: ColorsManager.grayBorder)),
|
||||
child: TextFormField(
|
||||
style:
|
||||
const TextStyle(color: Colors.black),
|
||||
controller: _blocRole.firstNameController,
|
||||
decoration: textBoxDecoration(radios: 20)!
|
||||
.copyWith(
|
||||
fillColor: Colors.white,
|
||||
suffixIcon: Padding(
|
||||
padding:
|
||||
const EdgeInsets.only(right: 16),
|
||||
child: SvgPicture.asset(
|
||||
Assets.textFieldSearch,
|
||||
width: 24,
|
||||
height: 24,
|
||||
),
|
||||
),
|
||||
hintStyle: context.textTheme.bodyMedium
|
||||
?.copyWith(
|
||||
fontWeight: FontWeight.w400,
|
||||
fontSize: 12,
|
||||
color: ColorsManager.textGray),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 7,
|
||||
child: Container(
|
||||
color: ColorsManager.CircleRolesBackground,
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Container(
|
||||
color: ColorsManager.whiteColors,
|
||||
child: TreeView())))
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
class TreeNode {
|
||||
String title;
|
||||
bool isChecked;
|
||||
bool isHighlighted;
|
||||
bool isExpanded; // New property to manage expansion
|
||||
List<TreeNode> children;
|
||||
|
||||
TreeNode({
|
||||
required this.title,
|
||||
this.isChecked = false,
|
||||
this.isHighlighted = false,
|
||||
this.isExpanded = false, // Default to collapsed
|
||||
this.children = const [],
|
||||
});
|
||||
}
|
||||
|
||||
class TreeView extends StatefulWidget {
|
||||
@override
|
||||
_TreeViewState createState() => _TreeViewState();
|
||||
}
|
||||
|
||||
class _TreeViewState extends State<TreeView> {
|
||||
List<TreeNode> treeData = [
|
||||
TreeNode(
|
||||
title: 'Downtown Dubai',
|
||||
),
|
||||
TreeNode(title: 'Dubai Creek Harbour', isHighlighted: true),
|
||||
TreeNode(
|
||||
title: 'Dubai Hills Estate',
|
||||
isHighlighted: true,
|
||||
children: [
|
||||
TreeNode(title: 'North Side'),
|
||||
TreeNode(
|
||||
title: 'South Side',
|
||||
isHighlighted: true,
|
||||
children: [
|
||||
TreeNode(title: 'Hills Business Park'),
|
||||
TreeNode(title: 'Park Point'),
|
||||
TreeNode(title: 'Acacia'),
|
||||
TreeNode(
|
||||
title: 'Executive Residence',
|
||||
children: [
|
||||
TreeNode(title: 'Residence I'),
|
||||
TreeNode(
|
||||
title: 'Residence II',
|
||||
children: [
|
||||
TreeNode(title: 'Ground Floor', isHighlighted: true),
|
||||
TreeNode(title: '1st Floor', isHighlighted: true),
|
||||
TreeNode(title: 'Pool', isHighlighted: true),
|
||||
TreeNode(title: 'Gym', isHighlighted: true),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
TreeNode(
|
||||
title: 'South Side',
|
||||
isHighlighted: true,
|
||||
children: [
|
||||
TreeNode(title: 'Hills Business Park'),
|
||||
TreeNode(title: 'Park Point'),
|
||||
TreeNode(title: 'Acacia'),
|
||||
TreeNode(
|
||||
title: 'Executive Residence',
|
||||
children: [
|
||||
TreeNode(title: 'Residence I'),
|
||||
TreeNode(
|
||||
title: 'Residence II',
|
||||
children: [
|
||||
TreeNode(title: 'Ground Floor', isHighlighted: true),
|
||||
TreeNode(title: '1st Floor', isHighlighted: true),
|
||||
TreeNode(title: 'Pool', isHighlighted: true),
|
||||
TreeNode(title: 'Gym', isHighlighted: true),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
];
|
||||
|
||||
Widget _buildTree(List<TreeNode> nodes, {int level = 0}) {
|
||||
return Column(
|
||||
children: nodes.map((node) => _buildNode(node, level: level)).toList(),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildNode(TreeNode node, {int level = 0}) {
|
||||
return Container(
|
||||
color: node.isHighlighted ? Colors.blue.shade100 : Colors.transparent,
|
||||
child: Padding(
|
||||
padding: EdgeInsets.only(left: level * 8.0),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
setState(() {
|
||||
node.isExpanded = !node.isExpanded; // Toggle expansion
|
||||
});
|
||||
},
|
||||
child: Icon(
|
||||
node.children.isNotEmpty
|
||||
? (node.isExpanded
|
||||
? Icons.arrow_drop_down
|
||||
: Icons.arrow_right)
|
||||
: Icons.arrow_right,
|
||||
color: node.children.isNotEmpty
|
||||
? Colors.black
|
||||
: Colors.transparent,
|
||||
),
|
||||
),
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
setState(() {
|
||||
node.isChecked = !node.isChecked;
|
||||
_updateChildrenCheckStatus(node, node.isChecked);
|
||||
_updateParentCheckStatus(node);
|
||||
});
|
||||
},
|
||||
child: Image.asset(
|
||||
_getCheckBoxImage(node),
|
||||
width: 20,
|
||||
height: 20,
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Text(
|
||||
node.title,
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
color: Colors.black87,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
if (node.isExpanded && node.children.isNotEmpty)
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 24.0),
|
||||
child: _buildTree(node.children, level: level + 1),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
// Determine the appropriate image based on the check state
|
||||
String _getCheckBoxImage(TreeNode node) {
|
||||
if (node.children.isEmpty) {
|
||||
return node.isChecked ? Assets.CheckBoxChecked : Assets.emptyBox;
|
||||
}
|
||||
if (_areAllChildrenChecked(node)) {
|
||||
return Assets.CheckBoxChecked;
|
||||
} else if (_areSomeChildrenChecked(node)) {
|
||||
return Assets.rectangleCheckBox;
|
||||
} else {
|
||||
return Assets.emptyBox;
|
||||
}
|
||||
}
|
||||
|
||||
// Helper to determine if all children are checked
|
||||
bool _areAllChildrenChecked(TreeNode node) {
|
||||
return node.children.isNotEmpty &&
|
||||
node.children.every((child) =>
|
||||
child.isChecked &&
|
||||
(child.children.isEmpty || _areAllChildrenChecked(child)));
|
||||
}
|
||||
|
||||
// Helper to determine if some children are checked
|
||||
bool _areSomeChildrenChecked(TreeNode node) {
|
||||
return node.children.isNotEmpty &&
|
||||
node.children.any((child) =>
|
||||
child.isChecked ||
|
||||
(child.children.isNotEmpty && _areSomeChildrenChecked(child)));
|
||||
}
|
||||
|
||||
// Update the checkbox state for all children
|
||||
void _updateChildrenCheckStatus(TreeNode node, bool isChecked) {
|
||||
for (var child in node.children) {
|
||||
child.isChecked = isChecked;
|
||||
_updateChildrenCheckStatus(child, isChecked);
|
||||
}
|
||||
}
|
||||
|
||||
// Update the checkbox state for parent nodes
|
||||
void _updateParentCheckStatus(TreeNode node) {
|
||||
TreeNode? parent = _findParent(treeData, node);
|
||||
if (parent != null) {
|
||||
setState(() {
|
||||
parent.isChecked = _areAllChildrenChecked(parent);
|
||||
_updateParentCheckStatus(parent); // Recursively update ancestors
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// Helper to find a node's parent
|
||||
TreeNode? _findParent(List<TreeNode> nodes, TreeNode target) {
|
||||
for (var node in nodes) {
|
||||
if (node.children.contains(target)) {
|
||||
return node;
|
||||
}
|
||||
var parent = _findParent(node.children, target);
|
||||
if (parent != null) return parent;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return SingleChildScrollView(
|
||||
child: _buildTree(treeData),
|
||||
);
|
||||
}
|
||||
}
|
256
lib/pages/roles_and_permission/users_page/view/user_table.dart
Normal file
@ -0,0 +1,256 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:syncrow_web/utils/color_manager.dart';
|
||||
|
||||
class DynamicTableScreen extends StatefulWidget {
|
||||
final List<String> titles;
|
||||
final List<List<Widget>> rows;
|
||||
|
||||
DynamicTableScreen({required this.titles, required this.rows});
|
||||
|
||||
@override
|
||||
_DynamicTableScreenState createState() => _DynamicTableScreenState();
|
||||
}
|
||||
|
||||
class _DynamicTableScreenState extends State<DynamicTableScreen>
|
||||
with WidgetsBindingObserver {
|
||||
late List<double> columnWidths;
|
||||
|
||||
// @override
|
||||
// void initState() {
|
||||
// super.initState();
|
||||
// // Initialize column widths with default sizes proportional to the screen width
|
||||
// // Assigning placeholder values here. The actual sizes will be updated in `build`.
|
||||
// }
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
columnWidths = List<double>.filled(widget.titles.length, 150.0);
|
||||
|
||||
WidgetsBinding.instance.addObserver(this);
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
WidgetsBinding.instance.removeObserver(this);
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
void didChangeMetrics() {
|
||||
super.didChangeMetrics();
|
||||
// Screen size might have changed
|
||||
final newScreenWidth = MediaQuery.of(context).size.width;
|
||||
setState(() {
|
||||
columnWidths = List<double>.generate(widget.titles.length, (index) {
|
||||
if (index == 1) {
|
||||
return newScreenWidth *
|
||||
0.12; // 20% of screen width for the second column
|
||||
} else if (index == 9) {
|
||||
return newScreenWidth *
|
||||
0.2; // 25% of screen width for the tenth column
|
||||
}
|
||||
return newScreenWidth *
|
||||
0.09; // Default to 10% of screen width for other columns
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final screenWidth = MediaQuery.of(context).size.width;
|
||||
|
||||
// Initialize column widths if they are still set to placeholder values
|
||||
if (columnWidths.every((width) => width == 150.0)) {
|
||||
columnWidths = List<double>.generate(widget.titles.length, (index) {
|
||||
if (index == 1) {
|
||||
return screenWidth *
|
||||
0.12; // 20% of screen width for the second column
|
||||
} else if (index == 9) {
|
||||
return screenWidth * 0.2; // 25% of screen width for the tenth column
|
||||
}
|
||||
return screenWidth *
|
||||
0.09; // Default to 10% of screen width for other columns
|
||||
});
|
||||
setState(() {});
|
||||
}
|
||||
return SizedBox(
|
||||
child: SingleChildScrollView(
|
||||
scrollDirection: Axis.horizontal,
|
||||
child: FittedBox(
|
||||
child: Column(
|
||||
children: [
|
||||
// Header Row with Resizable Columns
|
||||
Container(
|
||||
color: ColorsManager.CircleRolesBackground,
|
||||
child: Row(
|
||||
children: List.generate(widget.titles.length, (index) {
|
||||
return Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
FittedBox(
|
||||
child: Container(
|
||||
padding: const EdgeInsets.only(left: 10, right: 10),
|
||||
width: columnWidths[index],
|
||||
child: Text(
|
||||
widget.titles[index],
|
||||
style: const TextStyle(
|
||||
fontWeight: FontWeight.w400,
|
||||
fontSize: 13,
|
||||
color: ColorsManager.grayColor,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
GestureDetector(
|
||||
onHorizontalDragUpdate: (details) {
|
||||
setState(() {
|
||||
columnWidths[index] = (columnWidths[index] +
|
||||
details.delta.dx)
|
||||
.clamp(
|
||||
150.0, 300.0); // Minimum & Maximum size
|
||||
});
|
||||
},
|
||||
child: MouseRegion(
|
||||
cursor: SystemMouseCursors
|
||||
.resizeColumn, // Set the cursor to resize
|
||||
child: Container(
|
||||
color: Colors.green,
|
||||
child: Container(
|
||||
color: ColorsManager.boxDivider,
|
||||
width: 1,
|
||||
height: 50, // Height of the header cell
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}),
|
||||
),
|
||||
),
|
||||
// Data Rows with Dividers
|
||||
Container(
|
||||
color: ColorsManager.whiteColors,
|
||||
child: Column(
|
||||
children: widget.rows.map((row) {
|
||||
int rowIndex = widget.rows.indexOf(row);
|
||||
return Column(
|
||||
children: [
|
||||
Container(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
left: 5, top: 10, right: 5, bottom: 10),
|
||||
child: Row(
|
||||
children: List.generate(row.length, (index) {
|
||||
return SizedBox(
|
||||
width: columnWidths[index],
|
||||
child: SizedBox(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
left: 15, right: 10),
|
||||
child: row[index],
|
||||
),
|
||||
),
|
||||
);
|
||||
}),
|
||||
),
|
||||
),
|
||||
),
|
||||
if (rowIndex < widget.rows.length - 1)
|
||||
Row(
|
||||
children:
|
||||
List.generate(widget.titles.length, (index) {
|
||||
return SizedBox(
|
||||
width: columnWidths[index],
|
||||
child: const Divider(
|
||||
color: ColorsManager.boxDivider,
|
||||
thickness: 1,
|
||||
height: 1,
|
||||
),
|
||||
);
|
||||
}))
|
||||
// Add a Divider below each row except the last one
|
||||
],
|
||||
);
|
||||
}).toList(),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Widget build(BuildContext context) {
|
||||
// return Scaffold(
|
||||
// body: SingleChildScrollView(
|
||||
// scrollDirection: Axis.horizontal,
|
||||
// child: SingleChildScrollView(
|
||||
// scrollDirection: Axis.vertical,
|
||||
// child: Column(
|
||||
// children: [
|
||||
// // Header Row with Resizable Columns
|
||||
// Container(
|
||||
// color: Colors.green,
|
||||
// child: Row(
|
||||
// children: List.generate(widget.titles.length, (index) {
|
||||
// return Row(
|
||||
// children: [
|
||||
// Container(
|
||||
// width: columnWidths[index],
|
||||
// decoration: const BoxDecoration(
|
||||
// color: Colors.green,
|
||||
// ),
|
||||
// child: Text(
|
||||
// widget.titles[index],
|
||||
// style: TextStyle(fontWeight: FontWeight.bold),
|
||||
// textAlign: TextAlign.center,
|
||||
// ),
|
||||
// ),
|
||||
// GestureDetector(
|
||||
// onHorizontalDragUpdate: (details) {
|
||||
// setState(() {
|
||||
// columnWidths[index] = (columnWidths[index] +
|
||||
// details.delta.dx)
|
||||
// .clamp(50.0, 300.0); // Minimum & Maximum size
|
||||
// });
|
||||
// },
|
||||
// child: MouseRegion(
|
||||
// cursor: SystemMouseCursors
|
||||
// .resizeColumn, // Set the cursor to resize
|
||||
// child: Container(
|
||||
// color: Colors.green,
|
||||
// child: Container(
|
||||
// color: Colors.black,
|
||||
// width: 1,
|
||||
// height: 50, // Height of the header cell
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// );
|
||||
// }),
|
||||
// ),
|
||||
// ),
|
||||
// // Data Rows
|
||||
// ...widget.rows.map((row) {
|
||||
// return Row(
|
||||
// children: List.generate(row.length, (index) {
|
||||
// return Container(
|
||||
// width: columnWidths[index],
|
||||
// child: row[index],
|
||||
// );
|
||||
// }),
|
||||
// );
|
||||
// }).toList(),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// );
|
||||
// }
|
241
lib/pages/roles_and_permission/users_page/view/users_page.dart
Normal file
@ -0,0 +1,241 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart'; // Import Bloc package
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
import 'package:syncrow_web/pages/roles_and_permission/users_page/bloc/users_bloc.dart';
|
||||
import 'package:syncrow_web/pages/roles_and_permission/users_page/bloc/users_event.dart';
|
||||
import 'package:syncrow_web/pages/roles_and_permission/users_page/bloc/users_status.dart';
|
||||
import 'package:syncrow_web/pages/roles_and_permission/users_page/view/add_user_dialog.dart';
|
||||
import 'package:syncrow_web/pages/roles_and_permission/users_page/view/user_table.dart';
|
||||
import 'package:syncrow_web/utils/color_manager.dart';
|
||||
import 'package:syncrow_web/utils/constants/assets.dart';
|
||||
import 'package:syncrow_web/utils/extension/build_context_x.dart';
|
||||
import 'package:syncrow_web/utils/style.dart';
|
||||
|
||||
class UsersPage extends StatelessWidget {
|
||||
const UsersPage({super.key});
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final TextEditingController searchController = TextEditingController();
|
||||
|
||||
Widget actionButton({required String title, required Function()? onTap}) {
|
||||
return InkWell(
|
||||
onTap: onTap,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(left: 8, right: 8),
|
||||
child: Text(
|
||||
title,
|
||||
style: Theme.of(context).textTheme.bodySmall?.copyWith(
|
||||
color: title == "Delete"
|
||||
? ColorsManager.red
|
||||
: ColorsManager.spaceColor,
|
||||
fontWeight: FontWeight.w400,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget status({required String status}) {
|
||||
return Center(
|
||||
child: Container(
|
||||
padding: const EdgeInsets.only(left: 5, right: 5, bottom: 5, top: 5),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: const BorderRadius.all(Radius.circular(20)),
|
||||
color: status == "Invited"
|
||||
? ColorsManager.invitedOrange.withOpacity(0.5)
|
||||
: status == "Active"
|
||||
? ColorsManager.activeGreen.withOpacity(0.5)
|
||||
: ColorsManager.disabledPink.withOpacity(0.5),
|
||||
),
|
||||
child: Padding(
|
||||
padding:
|
||||
const EdgeInsets.only(left: 10, right: 10, bottom: 5, top: 5),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
status,
|
||||
style: Theme.of(context).textTheme.bodySmall?.copyWith(
|
||||
color: status == "Invited"
|
||||
? ColorsManager.invitedOrangeText
|
||||
: status == "Active"
|
||||
? ColorsManager.activeGreenText
|
||||
: ColorsManager.disabledRedText,
|
||||
fontWeight: FontWeight.w400,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget changeIconStatus(
|
||||
{required String userId,
|
||||
required String status,
|
||||
required Function()? onTap}) {
|
||||
return Center(
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
final newStatus = status == 'Active'
|
||||
? 'Disabled'
|
||||
: status == 'Disabled'
|
||||
? 'Invited'
|
||||
: 'Active';
|
||||
context
|
||||
.read<UsersBloc>()
|
||||
.add(ChangeUserStatus(userId: userId, newStatus: newStatus));
|
||||
},
|
||||
child: Padding(
|
||||
padding:
|
||||
const EdgeInsets.only(left: 5, right: 5, bottom: 5, top: 5),
|
||||
child: SvgPicture.asset(
|
||||
status == "Invited"
|
||||
? Assets.invitedIcon
|
||||
: status == "Active"
|
||||
? Assets.activeUser
|
||||
: Assets.deActiveUser,
|
||||
height: 35,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
// return RolesAndPermission();
|
||||
// }
|
||||
// }
|
||||
return BlocBuilder<UsersBloc, UsersState>(
|
||||
builder: (context, state) {
|
||||
final screenSize = MediaQuery.of(context).size;
|
||||
|
||||
if (state is UsersLoadingState) {
|
||||
return const Center(child: CircularProgressIndicator());
|
||||
} else if (state is UsersLoadedState) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(20),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Container(
|
||||
decoration: containerDecoration.copyWith(
|
||||
borderRadius: const BorderRadius.all(
|
||||
Radius.circular(20),
|
||||
),
|
||||
),
|
||||
width: screenSize.width * 0.4,
|
||||
child: TextFormField(
|
||||
controller: searchController,
|
||||
style: const TextStyle(color: Colors.black),
|
||||
decoration: textBoxDecoration(radios: 15)!.copyWith(
|
||||
fillColor: ColorsManager.whiteColors,
|
||||
errorStyle: const TextStyle(height: 0),
|
||||
hintStyle: context.textTheme.titleSmall?.copyWith(
|
||||
color: Colors.grey,
|
||||
fontSize: 12,
|
||||
),
|
||||
hintText: 'Search',
|
||||
suffixIcon: SizedBox(
|
||||
child: SvgPicture.asset(
|
||||
Assets.searchIconUser,
|
||||
fit: BoxFit.none,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 20),
|
||||
InkWell(
|
||||
onTap: () {
|
||||
showDialog(
|
||||
context: context,
|
||||
barrierDismissible: false,
|
||||
builder: (BuildContext context) {
|
||||
return const AddNewUserDialog();
|
||||
},
|
||||
).then((listDevice) {
|
||||
if (listDevice != null) {}
|
||||
});
|
||||
},
|
||||
child: Container(
|
||||
decoration: containerWhiteDecoration,
|
||||
width: screenSize.width * 0.18,
|
||||
height: 50,
|
||||
child: const Center(
|
||||
child: Text(
|
||||
'Add New User',
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: ColorsManager.blueColor,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 25),
|
||||
DynamicTableScreen(
|
||||
titles: const [
|
||||
"Full Name",
|
||||
"Email Address",
|
||||
"Job Title",
|
||||
"Role",
|
||||
"Creation Date",
|
||||
"Creation Time",
|
||||
"Created By",
|
||||
"Status",
|
||||
"De/Activate",
|
||||
"Action"
|
||||
],
|
||||
rows: state.users.map((user) {
|
||||
return [
|
||||
Text(user.userName!),
|
||||
Text(user.userEmail!),
|
||||
const Text("Test"),
|
||||
const Text("Member"),
|
||||
Text(user.creationDate!),
|
||||
Text(user.creationTime!),
|
||||
Text(user.createdBy!),
|
||||
changeIconStatus(
|
||||
status: user.status!,
|
||||
userId: user.id!,
|
||||
onTap: () {},
|
||||
),
|
||||
status(status: user.status!),
|
||||
Row(
|
||||
children: [
|
||||
actionButton(
|
||||
title: "Activity Log",
|
||||
onTap: () {},
|
||||
),
|
||||
actionButton(
|
||||
title: "Edit",
|
||||
onTap: () {},
|
||||
),
|
||||
actionButton(
|
||||
title: "Delete",
|
||||
onTap: () {},
|
||||
),
|
||||
],
|
||||
),
|
||||
];
|
||||
}).toList(),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
} else if (state is ErrorState) {
|
||||
return Center(child: Text(state.message));
|
||||
} else {
|
||||
return const Center(child: Text('No data available.'));
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
57
lib/pages/roles_and_permission/view/role_card.dart
Normal file
@ -0,0 +1,57 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:syncrow_web/utils/color_manager.dart';
|
||||
|
||||
class RoleCard extends StatelessWidget {
|
||||
final String name;
|
||||
const RoleCard({super.key, required this.name});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
color: ColorsManager.whiteColors, // Card background color
|
||||
borderRadius: BorderRadius.circular(20), // Rounded corners
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: ColorsManager.blackColor.withOpacity(0.2), // Shadow color
|
||||
blurRadius: 20, // Spread of the shadow
|
||||
offset: const Offset(2, 2), // No directional bias
|
||||
spreadRadius: 1, // Ensures the shadow is more noticeable
|
||||
),
|
||||
],
|
||||
),
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: ColorsManager.whiteColors,
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
const CircleAvatar(
|
||||
backgroundColor: ColorsManager.neutralGray,
|
||||
radius: 65,
|
||||
child: CircleAvatar(
|
||||
backgroundColor: ColorsManager.CircleRolesBackground,
|
||||
radius: 62,
|
||||
child: Icon(
|
||||
Icons.admin_panel_settings,
|
||||
size: 40,
|
||||
color: Colors.blue,
|
||||
),
|
||||
),
|
||||
),
|
||||
Text(
|
||||
name,
|
||||
style: const TextStyle(
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.black87,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,96 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/shared/navigate_home_grid_view.dart';
|
||||
import 'package:syncrow_web/pages/roles_and_permission/bloc/roles_permission_bloc.dart';
|
||||
import 'package:syncrow_web/pages/roles_and_permission/bloc/roles_permission_event.dart';
|
||||
import 'package:syncrow_web/pages/roles_and_permission/bloc/roles_permission_state.dart';
|
||||
import 'package:syncrow_web/pages/roles_and_permission/users_page/bloc/users_bloc.dart';
|
||||
import 'package:syncrow_web/pages/roles_and_permission/users_page/bloc/users_event.dart';
|
||||
import 'package:syncrow_web/pages/roles_and_permission/users_page/view/users_page.dart';
|
||||
import 'package:syncrow_web/utils/color_manager.dart';
|
||||
import 'package:syncrow_web/utils/extension/build_context_x.dart';
|
||||
import 'package:syncrow_web/web_layout/web_scaffold.dart';
|
||||
|
||||
class RolesAndPermissionPage extends StatelessWidget {
|
||||
const RolesAndPermissionPage({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BlocProvider(
|
||||
create: (BuildContext context) =>
|
||||
RolesPermissionBloc()..add(const GetRoles()),
|
||||
child: BlocConsumer<RolesPermissionBloc, RolesPermissionState>(
|
||||
listener: (context, state) {},
|
||||
builder: (context, state) {
|
||||
final _blocRole = BlocProvider.of<RolesPermissionBloc>(context);
|
||||
|
||||
return state is RolesLoadingState
|
||||
? const Center(child: CircularProgressIndicator())
|
||||
: WebScaffold(
|
||||
enableMenuSidebar: false,
|
||||
appBarTitle: FittedBox(
|
||||
child: Text(
|
||||
'Roles & Permissions',
|
||||
style: Theme.of(context).textTheme.headlineLarge,
|
||||
),
|
||||
),
|
||||
rightBody: const NavigateHomeGridView(),
|
||||
centerBody: Row(
|
||||
children: [
|
||||
// TextButton(
|
||||
// style: TextButton.styleFrom(
|
||||
// backgroundColor: null,
|
||||
// ),
|
||||
// onPressed: () {
|
||||
// _blocRole.add(const ChangeTapSelected(true));
|
||||
// },
|
||||
// child: Text(
|
||||
// 'Roles',
|
||||
// style: context.textTheme.titleMedium?.copyWith(
|
||||
// color: (_blocRole.tapSelect == true)
|
||||
// ? ColorsManager.whiteColors
|
||||
// : ColorsManager.grayColor,
|
||||
// fontWeight: (_blocRole.tapSelect == true)
|
||||
// ? FontWeight.w700
|
||||
// : FontWeight.w400,
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
TextButton(
|
||||
style: TextButton.styleFrom(
|
||||
backgroundColor: null,
|
||||
),
|
||||
onPressed: () {
|
||||
// _blocRole.add(const ChangeTapSelected(false));
|
||||
},
|
||||
child: Text(
|
||||
'Users',
|
||||
style: context.textTheme.titleMedium?.copyWith(
|
||||
color: (_blocRole.tapSelect == true)
|
||||
? ColorsManager.whiteColors
|
||||
: ColorsManager.grayColor,
|
||||
fontWeight: (_blocRole.tapSelect == true)
|
||||
? FontWeight.w700
|
||||
: FontWeight.w400,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
scaffoldBody: BlocProvider<UsersBloc>(
|
||||
create: (context) => UsersBloc()..add(const GetUsers()),
|
||||
child: const UsersPage(),
|
||||
)
|
||||
// _blocRole.tapSelect == false
|
||||
// ? UsersPage(
|
||||
// blocRole: _blocRole,
|
||||
// )
|
||||
// : RolesPage(
|
||||
// blocRole: _blocRole,
|
||||
// )
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
69
lib/pages/roles_and_permission/view/roles_page.dart
Normal file
@ -0,0 +1,69 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
import 'package:syncrow_web/pages/roles_and_permission/bloc/roles_permission_bloc.dart';
|
||||
import 'package:syncrow_web/pages/roles_and_permission/view/role_card.dart';
|
||||
import 'package:syncrow_web/utils/color_manager.dart';
|
||||
import 'package:syncrow_web/utils/constants/assets.dart';
|
||||
import 'package:syncrow_web/utils/extension/build_context_x.dart';
|
||||
import 'package:syncrow_web/utils/style.dart';
|
||||
|
||||
class RolesPage extends StatelessWidget {
|
||||
final RolesPermissionBloc blocRole;
|
||||
const RolesPage({super.key, required this.blocRole});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final TextEditingController searchController = TextEditingController();
|
||||
double screenWidth = MediaQuery.of(context).size.width;
|
||||
|
||||
int crossAxisCount = (screenWidth ~/ 200).clamp(1, 6);
|
||||
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Container(
|
||||
decoration: containerDecoration.copyWith(
|
||||
borderRadius: const BorderRadius.all(
|
||||
Radius.circular(20),
|
||||
),
|
||||
),
|
||||
width: 250,
|
||||
child: TextFormField(
|
||||
controller: searchController,
|
||||
style: const TextStyle(color: Colors.black),
|
||||
decoration: textBoxDecoration(radios: 15)!.copyWith(
|
||||
fillColor: ColorsManager.whiteColors,
|
||||
errorStyle: const TextStyle(height: 0),
|
||||
hintStyle: context.textTheme.titleSmall?.copyWith(
|
||||
color: Colors.grey,
|
||||
fontSize: 12,
|
||||
),
|
||||
hintText: 'Search',
|
||||
suffixIcon: SvgPicture.asset(Assets.searchIconUser)),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: GridView.builder(
|
||||
padding: const EdgeInsets.all(10),
|
||||
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
||||
crossAxisCount: crossAxisCount,
|
||||
crossAxisSpacing: 16,
|
||||
mainAxisSpacing: 16,
|
||||
childAspectRatio: 2 / 2.5,
|
||||
),
|
||||
itemCount: blocRole.roleModel.length ?? 0,
|
||||
itemBuilder: (context, index) {
|
||||
final role = blocRole.roleModel[index];
|
||||
if (role == null) {
|
||||
return const SizedBox.shrink();
|
||||
}
|
||||
return RoleCard(
|
||||
name: role.roleName ?? 'Unknown',
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
@ -3,6 +3,7 @@ import 'package:syncrow_web/pages/access_management/view/access_management.dart'
|
||||
import 'package:syncrow_web/pages/auth/view/login_page.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/all_devices/view/device_managment_page.dart';
|
||||
import 'package:syncrow_web/pages/home/view/home_page.dart';
|
||||
import 'package:syncrow_web/pages/roles_and_permission/view/roles_and_permission_page.dart';
|
||||
import 'package:syncrow_web/pages/spaces_management/view/spaces_management_page.dart';
|
||||
import 'package:syncrow_web/pages/visitor_password/view/visitor_password_dialog.dart';
|
||||
import 'package:syncrow_web/utils/constants/routes_const.dart';
|
||||
@ -32,7 +33,10 @@ class AppRoutes {
|
||||
),
|
||||
GoRoute(
|
||||
path: RoutesConst.spacesManagementPage,
|
||||
builder: (context, state) => SpaceManagementPage()),
|
||||
builder: (context, state) => const SpaceManagementPage()),
|
||||
GoRoute(
|
||||
path: RoutesConst.rolesAndPermissions,
|
||||
builder: (context, state) => const RolesAndPermissionPage()),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,8 @@ abstract class ColorsManager {
|
||||
static const Color switchOffColor = Color(0x7F8D99AE);
|
||||
static const Color primaryColor = Color(0xFF0030CB); //023DFE
|
||||
static const Color secondaryTextColor = Color(0xFF848484);
|
||||
static Color primaryColorWithOpacity = const Color(0xFF023DFE).withOpacity(0.6);
|
||||
static Color primaryColorWithOpacity =
|
||||
const Color(0xFF023DFE).withOpacity(0.6);
|
||||
static const Color whiteColors = Colors.white;
|
||||
static const Color secondaryColor = Color(0xFF023DFE);
|
||||
static const Color onSecondaryColor = Color(0xFF023DFE);
|
||||
@ -54,5 +55,13 @@ abstract class ColorsManager {
|
||||
static const Color warningRed = Color(0xFFFF6465);
|
||||
static const Color borderColor = Color(0xFFE5E5E5);
|
||||
static const Color CircleImageBackground = Color(0xFFF4F4F4);
|
||||
static const Color CircleRolesBackground = Color(0xFFF8F8F8);
|
||||
static const Color activeGreen = Color(0xFF99FF93);
|
||||
static const Color activeGreenText = Color(0xFF008905);
|
||||
static const Color disabledPink = Color(0xFFFF9395);
|
||||
static const Color disabledRedText = Color(0xFF890002);
|
||||
static const Color invitedOrange = Color(0xFFFFE193);
|
||||
static const Color invitedOrangeText = Color(0xFFFFBF00);
|
||||
//background: #F8F8F8;
|
||||
|
||||
}
|
||||
//background: #background: #5D5D5D;
|
||||
|
@ -13,10 +13,12 @@ class Assets {
|
||||
static const String rightLine = "assets/images/right_line.png";
|
||||
static const String google = "assets/images/google.svg";
|
||||
static const String facebook = "assets/images/facebook.svg";
|
||||
static const String invisiblePassword = "assets/images/Password_invisible.svg";
|
||||
static const String invisiblePassword =
|
||||
"assets/images/Password_invisible.svg";
|
||||
static const String visiblePassword = "assets/images/password_visible.svg";
|
||||
static const String accessIcon = "assets/images/access_icon.svg";
|
||||
static const String spaseManagementIcon = "assets/images/spase_management_icon.svg";
|
||||
static const String spaseManagementIcon =
|
||||
"assets/images/spase_management_icon.svg";
|
||||
static const String devicesIcon = "assets/images/devices_icon.svg";
|
||||
static const String moveinIcon = "assets/images/movein_icon.svg";
|
||||
static const String constructionIcon = "assets/images/construction_icon.svg";
|
||||
@ -29,13 +31,15 @@ class Assets {
|
||||
static const String emptyTable = "assets/images/empty_table.svg";
|
||||
|
||||
// General assets
|
||||
static const String motionlessDetection = "assets/icons/motionless_detection.svg";
|
||||
static const String motionlessDetection =
|
||||
"assets/icons/motionless_detection.svg";
|
||||
static const String acHeating = "assets/icons/ac_heating.svg";
|
||||
static const String acPowerOff = "assets/icons/ac_power_off.svg";
|
||||
static const String acFanMiddle = "assets/icons/ac_fan_middle.svg";
|
||||
static const String switchAlarmSound = "assets/icons/switch_alarm_sound.svg";
|
||||
static const String resetOff = "assets/icons/reset_off.svg";
|
||||
static const String sensitivityOperationIcon = "assets/icons/sesitivity_operation_icon.svg";
|
||||
static const String sensitivityOperationIcon =
|
||||
"assets/icons/sesitivity_operation_icon.svg";
|
||||
static const String motionDetection = "assets/icons/motion_detection.svg";
|
||||
static const String freezing = "assets/icons/freezing.svg";
|
||||
static const String indicator = "assets/icons/indicator.svg";
|
||||
@ -56,7 +60,8 @@ class Assets {
|
||||
static const String celsiusDegrees = "assets/icons/celsius_degrees.svg";
|
||||
static const String masterState = "assets/icons/master_state.svg";
|
||||
static const String acPower = "assets/icons/ac_power.svg";
|
||||
static const String farDetectionFunction = "assets/icons/far_detection_function.svg";
|
||||
static const String farDetectionFunction =
|
||||
"assets/icons/far_detection_function.svg";
|
||||
static const String nobodyTime = "assets/icons/nobody_time.svg";
|
||||
|
||||
// Automation functions
|
||||
@ -64,33 +69,47 @@ class Assets {
|
||||
"assets/icons/automation_functions/temp_password_unlock.svg";
|
||||
static const String doorlockNormalOpen =
|
||||
"assets/icons/automation_functions/doorlock_normal_open.svg";
|
||||
static const String doorbell = "assets/icons/automation_functions/doorbell.svg";
|
||||
static const String doorbell =
|
||||
"assets/icons/automation_functions/doorbell.svg";
|
||||
static const String remoteUnlockViaApp =
|
||||
"assets/icons/automation_functions/remote_unlock_via_app.svg";
|
||||
static const String doubleLock = "assets/icons/automation_functions/double_lock.svg";
|
||||
static const String selfTestResult = "assets/icons/automation_functions/self_test_result.svg";
|
||||
static const String lockAlarm = "assets/icons/automation_functions/lock_alarm.svg";
|
||||
static const String presenceState = "assets/icons/automation_functions/presence_state.svg";
|
||||
static const String currentTemp = "assets/icons/automation_functions/current_temp.svg";
|
||||
static const String presence = "assets/icons/automation_functions/presence.svg";
|
||||
static const String doubleLock =
|
||||
"assets/icons/automation_functions/double_lock.svg";
|
||||
static const String selfTestResult =
|
||||
"assets/icons/automation_functions/self_test_result.svg";
|
||||
static const String lockAlarm =
|
||||
"assets/icons/automation_functions/lock_alarm.svg";
|
||||
static const String presenceState =
|
||||
"assets/icons/automation_functions/presence_state.svg";
|
||||
static const String currentTemp =
|
||||
"assets/icons/automation_functions/current_temp.svg";
|
||||
static const String presence =
|
||||
"assets/icons/automation_functions/presence.svg";
|
||||
static const String residualElectricity =
|
||||
"assets/icons/automation_functions/residual_electricity.svg";
|
||||
static const String hijackAlarm = "assets/icons/automation_functions/hijack_alarm.svg";
|
||||
static const String passwordUnlock = "assets/icons/automation_functions/password_unlock.svg";
|
||||
static const String hijackAlarm =
|
||||
"assets/icons/automation_functions/hijack_alarm.svg";
|
||||
static const String passwordUnlock =
|
||||
"assets/icons/automation_functions/password_unlock.svg";
|
||||
static const String remoteUnlockRequest =
|
||||
"assets/icons/automation_functions/remote_unlock_req.svg";
|
||||
static const String cardUnlock = "assets/icons/automation_functions/card_unlock.svg";
|
||||
static const String cardUnlock =
|
||||
"assets/icons/automation_functions/card_unlock.svg";
|
||||
static const String motion = "assets/icons/automation_functions/motion.svg";
|
||||
static const String fingerprintUnlock =
|
||||
"assets/icons/automation_functions/fingerprint_unlock.svg";
|
||||
|
||||
// Presence Sensor Assets
|
||||
static const String sensorMotionIcon = "assets/icons/sensor_motion_ic.svg";
|
||||
static const String sensorPresenceIcon = "assets/icons/sensor_presence_ic.svg";
|
||||
static const String sensorPresenceIcon =
|
||||
"assets/icons/sensor_presence_ic.svg";
|
||||
static const String sensorVacantIcon = "assets/icons/sensor_vacant_ic.svg";
|
||||
static const String illuminanceRecordIcon = "assets/icons/illuminance_record_ic.svg";
|
||||
static const String presenceRecordIcon = "assets/icons/presence_record_ic.svg";
|
||||
static const String helpDescriptionIcon = "assets/icons/help_description_ic.svg";
|
||||
static const String illuminanceRecordIcon =
|
||||
"assets/icons/illuminance_record_ic.svg";
|
||||
static const String presenceRecordIcon =
|
||||
"assets/icons/presence_record_ic.svg";
|
||||
static const String helpDescriptionIcon =
|
||||
"assets/icons/help_description_ic.svg";
|
||||
|
||||
static const String lightPulp = "assets/icons/light_pulb.svg";
|
||||
static const String acDevice = "assets/icons/ac_device.svg";
|
||||
@ -140,10 +159,12 @@ class Assets {
|
||||
static const String unit = 'assets/icons/unit_icon.svg';
|
||||
static const String villa = 'assets/icons/villa_icon.svg';
|
||||
static const String iconEdit = 'assets/icons/icon_edit_icon.svg';
|
||||
static const String textFieldSearch = 'assets/icons/textfield_search_icon.svg';
|
||||
static const String textFieldSearch =
|
||||
'assets/icons/textfield_search_icon.svg';
|
||||
static const String roundedAddIcon = 'assets/icons/rounded_add_icon.svg';
|
||||
static const String addIcon = 'assets/icons/add_icon.svg';
|
||||
static const String smartThermostatIcon = 'assets/icons/smart_thermostat_icon.svg';
|
||||
static const String smartThermostatIcon =
|
||||
'assets/icons/smart_thermostat_icon.svg';
|
||||
static const String smartLightIcon = 'assets/icons/smart_light_icon.svg';
|
||||
static const String presenceSensor = 'assets/icons/presence_sensor.svg';
|
||||
static const String Gang3SwitchIcon = 'assets/icons/3_Gang_switch_icon.svg';
|
||||
@ -191,7 +212,8 @@ class Assets {
|
||||
//assets/icons/water_leak_normal.svg
|
||||
static const String waterLeakNormal = 'assets/icons/water_leak_normal.svg';
|
||||
//assets/icons/water_leak_detected.svg
|
||||
static const String waterLeakDetected = 'assets/icons/water_leak_detected.svg';
|
||||
static const String waterLeakDetected =
|
||||
'assets/icons/water_leak_detected.svg';
|
||||
|
||||
//assets/icons/automation_records.svg
|
||||
static const String automationRecords = 'assets/icons/automation_records.svg';
|
||||
@ -256,40 +278,64 @@ class Assets {
|
||||
static const String delay = 'assets/icons/routine/delay.svg';
|
||||
|
||||
// Assets for functions_icons
|
||||
static const String assetsSensitivityFunction = "assets/icons/functions_icons/sensitivity.svg";
|
||||
static const String assetsSensitivityFunction =
|
||||
"assets/icons/functions_icons/sensitivity.svg";
|
||||
static const String assetsSensitivityOperationIcon =
|
||||
"assets/icons/functions_icons/sesitivity_operation_icon.svg";
|
||||
static const String assetsAcPower = "assets/icons/functions_icons/ac_power.svg";
|
||||
static const String assetsAcPowerOFF = "assets/icons/functions_icons/ac_power_off.svg";
|
||||
static const String assetsChildLock = "assets/icons/functions_icons/child_lock.svg";
|
||||
static const String assetsFreezing = "assets/icons/functions_icons/freezing.svg";
|
||||
static const String assetsFanSpeed = "assets/icons/functions_icons/fan_speed.svg";
|
||||
static const String assetsAcCooling = "assets/icons/functions_icons/ac_cooling.svg";
|
||||
static const String assetsAcHeating = "assets/icons/functions_icons/ac_heating.svg";
|
||||
static const String assetsCelsiusDegrees = "assets/icons/functions_icons/celsius_degrees.svg";
|
||||
static const String assetsTempreture = "assets/icons/functions_icons/tempreture.svg";
|
||||
static const String assetsAcFanLow = "assets/icons/functions_icons/ac_fan_low.svg";
|
||||
static const String assetsAcFanMiddle = "assets/icons/functions_icons/ac_fan_middle.svg";
|
||||
static const String assetsAcFanHigh = "assets/icons/functions_icons/ac_fan_high.svg";
|
||||
static const String assetsAcFanAuto = "assets/icons/functions_icons/ac_fan_auto.svg";
|
||||
static const String assetsSceneChildLock = "assets/icons/functions_icons/scene_child_lock.svg";
|
||||
static const String assetsAcPower =
|
||||
"assets/icons/functions_icons/ac_power.svg";
|
||||
static const String assetsAcPowerOFF =
|
||||
"assets/icons/functions_icons/ac_power_off.svg";
|
||||
static const String assetsChildLock =
|
||||
"assets/icons/functions_icons/child_lock.svg";
|
||||
static const String assetsFreezing =
|
||||
"assets/icons/functions_icons/freezing.svg";
|
||||
static const String assetsFanSpeed =
|
||||
"assets/icons/functions_icons/fan_speed.svg";
|
||||
static const String assetsAcCooling =
|
||||
"assets/icons/functions_icons/ac_cooling.svg";
|
||||
static const String assetsAcHeating =
|
||||
"assets/icons/functions_icons/ac_heating.svg";
|
||||
static const String assetsCelsiusDegrees =
|
||||
"assets/icons/functions_icons/celsius_degrees.svg";
|
||||
static const String assetsTempreture =
|
||||
"assets/icons/functions_icons/tempreture.svg";
|
||||
static const String assetsAcFanLow =
|
||||
"assets/icons/functions_icons/ac_fan_low.svg";
|
||||
static const String assetsAcFanMiddle =
|
||||
"assets/icons/functions_icons/ac_fan_middle.svg";
|
||||
static const String assetsAcFanHigh =
|
||||
"assets/icons/functions_icons/ac_fan_high.svg";
|
||||
static const String assetsAcFanAuto =
|
||||
"assets/icons/functions_icons/ac_fan_auto.svg";
|
||||
static const String assetsSceneChildLock =
|
||||
"assets/icons/functions_icons/scene_child_lock.svg";
|
||||
static const String assetsSceneChildUnlock =
|
||||
"assets/icons/functions_icons/scene_child_unlock.svg";
|
||||
static const String assetsSceneRefresh = "assets/icons/functions_icons/scene_refresh.svg";
|
||||
static const String assetsLightCountdown = "assets/icons/functions_icons/light_countdown.svg";
|
||||
static const String assetsFarDetection = "assets/icons/functions_icons/far_detection.svg";
|
||||
static const String assetsSceneRefresh =
|
||||
"assets/icons/functions_icons/scene_refresh.svg";
|
||||
static const String assetsLightCountdown =
|
||||
"assets/icons/functions_icons/light_countdown.svg";
|
||||
static const String assetsFarDetection =
|
||||
"assets/icons/functions_icons/far_detection.svg";
|
||||
static const String assetsFarDetectionFunction =
|
||||
"assets/icons/functions_icons/far_detection_function.svg";
|
||||
static const String assetsIndicator = "assets/icons/functions_icons/indicator.svg";
|
||||
static const String assetsMotionDetection = "assets/icons/functions_icons/motion_detection.svg";
|
||||
static const String assetsIndicator =
|
||||
"assets/icons/functions_icons/indicator.svg";
|
||||
static const String assetsMotionDetection =
|
||||
"assets/icons/functions_icons/motion_detection.svg";
|
||||
static const String assetsMotionlessDetection =
|
||||
"assets/icons/functions_icons/motionless_detection.svg";
|
||||
static const String assetsNobodyTime = "assets/icons/functions_icons/nobody_time.svg";
|
||||
static const String assetsFactoryReset = "assets/icons/functions_icons/factory_reset.svg";
|
||||
static const String assetsMasterState = "assets/icons/functions_icons/master_state.svg";
|
||||
static const String assetsNobodyTime =
|
||||
"assets/icons/functions_icons/nobody_time.svg";
|
||||
static const String assetsFactoryReset =
|
||||
"assets/icons/functions_icons/factory_reset.svg";
|
||||
static const String assetsMasterState =
|
||||
"assets/icons/functions_icons/master_state.svg";
|
||||
static const String assetsSwitchAlarmSound =
|
||||
"assets/icons/functions_icons/switch_alarm_sound.svg";
|
||||
static const String assetsResetOff = "assets/icons/functions_icons/reset_off.svg";
|
||||
static const String assetsResetOff =
|
||||
"assets/icons/functions_icons/reset_off.svg";
|
||||
|
||||
// Assets for automation_functions
|
||||
static const String assetsCardUnlock =
|
||||
@ -320,11 +366,29 @@ class Assets {
|
||||
"assets/icons/functions_icons/automation_functions/self_test_result.svg";
|
||||
static const String assetsPresence =
|
||||
"assets/icons/functions_icons/automation_functions/presence.svg";
|
||||
static const String assetsMotion = "assets/icons/functions_icons/automation_functions/motion.svg";
|
||||
static const String assetsMotion =
|
||||
"assets/icons/functions_icons/automation_functions/motion.svg";
|
||||
static const String assetsCurrentTemp =
|
||||
"assets/icons/functions_icons/automation_functions/current_temp.svg";
|
||||
static const String assetsPresenceState =
|
||||
"assets/icons/functions_icons/automation_functions/presence_state.svg";
|
||||
//assets/icons/routine/automation.svg
|
||||
static const String automation = 'assets/icons/routine/automation.svg';
|
||||
static const String searchIconUser = 'assets/icons/search_icon_user.svg';
|
||||
static const String searchIcoUser = 'assets/icons/search_icon_user.svg';
|
||||
static const String activeUser = 'assets/icons/active_user.svg';
|
||||
static const String deActiveUser = 'assets/icons/deactive_user.svg';
|
||||
static const String invitedIcon = 'assets/icons/invited_icon.svg';
|
||||
static const String rectangleCheckBox =
|
||||
'assets/icons/rectangle_check_box.png';
|
||||
static const String CheckBoxChecked = 'assets/icons/box_checked.png';
|
||||
static const String emptyBox = 'assets/icons/empty_box.png';
|
||||
static const String completeProcessIcon =
|
||||
'assets/icons/compleate_process_icon.svg';
|
||||
static const String currentProcessIcon =
|
||||
'assets/icons/current_process_icon.svg';
|
||||
static const String uncomplete_ProcessIcon =
|
||||
'assets/icons/uncompleate_process_icon.svg';
|
||||
static const String wrongProcessIcon =
|
||||
'assets/icons/wrong_process_icon.svg';
|
||||
}
|
||||
|
@ -5,4 +5,5 @@ class RoutesConst {
|
||||
static const String accessManagementPage = '/access-management-page';
|
||||
static const String deviceManagementPage = '/device-management-page';
|
||||
static const String spacesManagementPage = '/spaces_management-page';
|
||||
static const String rolesAndPermissions = '/roles_and_Permissions-page';
|
||||
}
|
||||
|
@ -2,51 +2,59 @@ import 'package:flutter/material.dart';
|
||||
|
||||
import 'color_manager.dart';
|
||||
|
||||
InputDecoration? textBoxDecoration({bool suffixIcon = false}) => InputDecoration(
|
||||
InputDecoration? textBoxDecoration(
|
||||
{bool suffixIcon = false, double radios = 8}) =>
|
||||
InputDecoration(
|
||||
focusColor: ColorsManager.grayColor,
|
||||
suffixIcon: suffixIcon ? const Icon(Icons.search) : null,
|
||||
hintText: 'Search',
|
||||
filled: true, // Enable background filling
|
||||
fillColor: const Color(0xffF5F6F7), // Set the background color
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(8), // Add border radius
|
||||
borderRadius: BorderRadius.circular(radios), // Add border radius
|
||||
borderSide: BorderSide.none, // Remove the underline
|
||||
),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(8), // Add border radius
|
||||
borderRadius: BorderRadius.circular(radios), // Add border radius
|
||||
borderSide: BorderSide.none, // Remove the underline
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(8), // Add border radius
|
||||
borderRadius: BorderRadius.circular(radios), // Add border radius
|
||||
borderSide: BorderSide.none, // Remove the underline
|
||||
),
|
||||
errorBorder: OutlineInputBorder(
|
||||
borderSide: const BorderSide(color: Colors.red, width: 2),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
borderRadius: BorderRadius.circular(radios),
|
||||
),
|
||||
focusedErrorBorder: OutlineInputBorder(
|
||||
borderSide: const BorderSide(color: Colors.red, width: 2),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
borderRadius: BorderRadius.circular(radios),
|
||||
),
|
||||
);
|
||||
|
||||
BoxDecoration containerDecoration = BoxDecoration(boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.grey.withOpacity(0.3),
|
||||
spreadRadius: 2,
|
||||
blurRadius: 4,
|
||||
offset: const Offset(0, 5), // changes position of shadow
|
||||
),
|
||||
], color: ColorsManager.boxColor, borderRadius: const BorderRadius.all(Radius.circular(10)));
|
||||
BoxDecoration containerDecoration = BoxDecoration(
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.grey.withOpacity(0.3),
|
||||
spreadRadius: 2,
|
||||
blurRadius: 4,
|
||||
offset: const Offset(0, 5), // changes position of shadow
|
||||
),
|
||||
],
|
||||
color: ColorsManager.boxColor,
|
||||
borderRadius: const BorderRadius.all(Radius.circular(10)));
|
||||
|
||||
BoxDecoration containerWhiteDecoration = BoxDecoration(boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.grey.withOpacity(0.3),
|
||||
spreadRadius: 2,
|
||||
blurRadius: 4,
|
||||
offset: const Offset(0, 5), // changes position of shadow
|
||||
),
|
||||
], color: ColorsManager.whiteColors, borderRadius: const BorderRadius.all(Radius.circular(15)));
|
||||
BoxDecoration containerWhiteDecoration = BoxDecoration(
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.grey.withOpacity(0.3),
|
||||
spreadRadius: 2,
|
||||
blurRadius: 4,
|
||||
offset: const Offset(0, 5), // changes position of shadow
|
||||
),
|
||||
],
|
||||
color: ColorsManager.whiteColors,
|
||||
borderRadius: const BorderRadius.all(Radius.circular(15)));
|
||||
|
||||
BoxDecoration subSectionContainerDecoration = BoxDecoration(
|
||||
color: ColorsManager.whiteColors,
|
||||
@ -59,3 +67,30 @@ BoxDecoration subSectionContainerDecoration = BoxDecoration(
|
||||
),
|
||||
],
|
||||
);
|
||||
|
||||
InputDecoration inputTextFormDeco({hintText}) => InputDecoration(
|
||||
hintText: hintText,
|
||||
border: const OutlineInputBorder(
|
||||
|
||||
borderSide: BorderSide(
|
||||
width: 1,
|
||||
color: ColorsManager.textGray, // Border color for unfocused state
|
||||
),
|
||||
borderRadius: BorderRadius.all(Radius.circular(10)),
|
||||
),
|
||||
focusedBorder: const OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
width: 2,
|
||||
color: ColorsManager.textGray, // Border color when focused
|
||||
),
|
||||
borderRadius: BorderRadius.all(Radius.circular(10)),
|
||||
),
|
||||
enabledBorder: const OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
width: 1,
|
||||
color: ColorsManager
|
||||
.textGray // Border color for enabled (but unfocused) state
|
||||
),
|
||||
borderRadius: BorderRadius.all(Radius.circular(10)),
|
||||
),
|
||||
);
|
||||
|
24
pubspec.lock
@ -316,18 +316,18 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: leak_tracker
|
||||
sha256: "3f87a60e8c63aecc975dda1ceedbc8f24de75f09e4856ea27daf8958f2f0ce05"
|
||||
sha256: "7f0df31977cb2c0b88585095d168e689669a2cc9b97c309665e3386f3e9d341a"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "10.0.5"
|
||||
version: "10.0.4"
|
||||
leak_tracker_flutter_testing:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: leak_tracker_flutter_testing
|
||||
sha256: "932549fb305594d82d7183ecd9fa93463e9914e1b67cacc34bc40906594a1806"
|
||||
sha256: "06e98f569d004c1315b991ded39924b21af84cf14cc94791b8aea337d25b57f8"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.0.5"
|
||||
version: "3.0.3"
|
||||
leak_tracker_testing:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -364,18 +364,18 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: material_color_utilities
|
||||
sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec
|
||||
sha256: "0e0a020085b65b6083975e499759762399b4475f766c21668c4ecca34ea74e5a"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.11.1"
|
||||
version: "0.8.0"
|
||||
meta:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: meta
|
||||
sha256: bdb68674043280c3428e9ec998512fb681678676b3c54e773629ffe74419f8c7
|
||||
sha256: "7687075e408b093f36e6bbf6c91878cc0d4cd10f409506f7bc996f68220b9136"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.15.0"
|
||||
version: "1.12.0"
|
||||
nested:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -593,10 +593,10 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: test_api
|
||||
sha256: "5b8a98dafc4d5c4c9c72d8b31ab2b23fc13422348d2997120294d3bac86b4ddb"
|
||||
sha256: "9955ae474176f7ac8ee4e989dadfb411a58c30415bcfb648fa04b2b8a03afa7f"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.7.2"
|
||||
version: "0.7.0"
|
||||
time_picker_spinner:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
@ -657,10 +657,10 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: vm_service
|
||||
sha256: f652077d0bdf60abe4c1f6377448e8655008eef28f128bc023f7b5e8dfeb48fc
|
||||
sha256: "3923c89304b715fb1eb6423f017651664a03bf5f4b29983627c4da791f74a4ec"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "14.2.4"
|
||||
version: "14.2.1"
|
||||
web:
|
||||
dependency: transitive
|
||||
description:
|
||||
|