|
|
|
@ -128,24 +128,26 @@ class _AppBarWidgetState extends State<AppBarWidget> with TickerProviderStateMix
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
8.width,
|
|
|
|
8.width,
|
|
|
|
SlideTransition(
|
|
|
|
Expanded(
|
|
|
|
position: _leftSlideAnimation,
|
|
|
|
child: SlideTransition(
|
|
|
|
child: FadeTransition(
|
|
|
|
position: _leftSlideAnimation,
|
|
|
|
opacity: _leftFadeAnimation,
|
|
|
|
child: FadeTransition(
|
|
|
|
child: Column(
|
|
|
|
opacity: _leftFadeAnimation,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
child: Column(
|
|
|
|
spacing: 4,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
spacing: 4,
|
|
|
|
Text(
|
|
|
|
children: [
|
|
|
|
snapshot.user?.username ?? "",
|
|
|
|
Text(
|
|
|
|
style: AppTextStyles.heading6.copyWith(color: AppColor.headingTextColor(context), fontSize: context.isTablet() ? 14 : null),
|
|
|
|
snapshot.user?.username ?? "",
|
|
|
|
),
|
|
|
|
style: AppTextStyles.heading6.copyWith(color: AppColor.headingTextColor(context), fontSize: context.isTablet() ? 14 : null),
|
|
|
|
Text(
|
|
|
|
),
|
|
|
|
snapshot.user?.type?.name.toCamelCase ?? "",
|
|
|
|
Text(
|
|
|
|
style: AppTextStyles.bodyText.copyWith(color: AppColor.lightTextColor(context), fontSize: context.isTablet() ? 12 : null),
|
|
|
|
snapshot.user?.type?.name.toCamelCase ?? "",
|
|
|
|
),
|
|
|
|
style: AppTextStyles.bodyText.copyWith(color: AppColor.lightTextColor(context), fontSize: context.isTablet() ? 12 : null),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
).expanded,
|
|
|
|
],
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
const Spacer(),
|
|
|
|
const Spacer(),
|
|
|
|
@ -232,91 +234,6 @@ class _AppBarWidgetState extends State<AppBarWidget> with TickerProviderStateMix
|
|
|
|
});
|
|
|
|
});
|
|
|
|
},
|
|
|
|
},
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
return Container(
|
|
|
|
|
|
|
|
padding: const EdgeInsets.all(10),
|
|
|
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
|
|
|
borderRadius: BorderRadius.circular(8),
|
|
|
|
|
|
|
|
color: AppColor.assetGroupBackground(context),
|
|
|
|
|
|
|
|
border: Border.all(color: AppColor.white936.withValues(alpha: .03), width: 1),
|
|
|
|
|
|
|
|
boxShadow: [
|
|
|
|
|
|
|
|
BoxShadow(color: Colors.black.withValues(alpha: 0.03), blurRadius: 4, offset: const Offset(0, 0), spreadRadius: 0),
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
child: Row(
|
|
|
|
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
|
|
|
|
spacing: 16,
|
|
|
|
|
|
|
|
children: [
|
|
|
|
|
|
|
|
Text(settingProvider.assetGroup?.name ?? "", style: AppTextStyles.bodyText2.copyWith(color: AppColor.headingTextColor(context))),
|
|
|
|
|
|
|
|
Icon(Icons.keyboard_arrow_down, color: AppColor.headingTextColor(context)),
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return Container(
|
|
|
|
|
|
|
|
padding: const EdgeInsets.fromLTRB(12, 6, 6, 6),
|
|
|
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
|
|
|
borderRadius: BorderRadius.circular(8),
|
|
|
|
|
|
|
|
color: AppColor.background(context),
|
|
|
|
|
|
|
|
boxShadow: const [
|
|
|
|
|
|
|
|
BoxShadow(
|
|
|
|
|
|
|
|
color: Color(0x07000000),
|
|
|
|
|
|
|
|
blurRadius: 14,
|
|
|
|
|
|
|
|
offset: Offset(0, 0),
|
|
|
|
|
|
|
|
spreadRadius: 0,
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
child: DropdownButton<AssetGroup?>(
|
|
|
|
|
|
|
|
// Made AssetGroup nullable
|
|
|
|
|
|
|
|
value: settingProvider.assetGroup,
|
|
|
|
|
|
|
|
//iconSize: 24,
|
|
|
|
|
|
|
|
isDense: true,
|
|
|
|
|
|
|
|
icon: Icon(Icons.keyboard_arrow_down, color: AppColor.headingTextColor(context)),
|
|
|
|
|
|
|
|
elevation: 8,
|
|
|
|
|
|
|
|
// dropdownColor: Colors.amber,
|
|
|
|
|
|
|
|
borderRadius: BorderRadius.circular(8),
|
|
|
|
|
|
|
|
style: AppTextStyles.tinyFont.copyWith(color: AppColor.headingTextColor(context)),
|
|
|
|
|
|
|
|
underline: const SizedBox.shrink(),
|
|
|
|
|
|
|
|
onChanged: (newValue) async {
|
|
|
|
|
|
|
|
if (settingProvider.assetGroup != newValue) {
|
|
|
|
|
|
|
|
AssetGroup? tempGroup = ApiManager.instance.assetGroup;
|
|
|
|
|
|
|
|
ApiManager.instance.assetGroup = newValue;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Utils.showLoading(context);
|
|
|
|
|
|
|
|
bool isSuccess = await context.userProvider.userChangeAssetGroup();
|
|
|
|
|
|
|
|
Utils.hideLoading(context);
|
|
|
|
|
|
|
|
if (isSuccess) {
|
|
|
|
|
|
|
|
await context.userProvider.getMobilePermissionByUser();
|
|
|
|
|
|
|
|
settingProvider.setAssetGroup(newValue);
|
|
|
|
|
|
|
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
|
|
|
|
|
|
|
context.settingProvider.setUser(ApiManager.instance.user!);
|
|
|
|
|
|
|
|
context.userProvider.setUser(ApiManager.instance.user!);
|
|
|
|
|
|
|
|
DashBoardProvider dashBoardProvider = Provider.of<DashBoardProvider>(context, listen: false);
|
|
|
|
|
|
|
|
dashBoardProvider.setTabs(userType: settingProvider.user!.type!, context: context);
|
|
|
|
|
|
|
|
dashBoardProvider.getDashBoardCount(usersType: settingProvider.user!.type!);
|
|
|
|
|
|
|
|
dashBoardProvider.resetRequestDataList();
|
|
|
|
|
|
|
|
dashBoardProvider.getRequestDetail(usersType: settingProvider.user!.type!, status: dashBoardProvider.tabs[dashBoardProvider.currentListIndex].tag);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
ApiManager.instance.assetGroup = tempGroup;
|
|
|
|
|
|
|
|
context.showConfirmDialog("Failed, Please Try again");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
items: Provider.of<UserProvider>(context, listen: false).user?.assetGroups?.map<DropdownMenuItem<AssetGroup?>>((value) {
|
|
|
|
|
|
|
|
// Added null check and made AssetGroup nullable
|
|
|
|
|
|
|
|
return DropdownMenuItem<AssetGroup?>(
|
|
|
|
|
|
|
|
value: value,
|
|
|
|
|
|
|
|
child: Text(
|
|
|
|
|
|
|
|
value.name ?? "",
|
|
|
|
|
|
|
|
style: Theme.of(context).textTheme.bodyLarge,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
}).toList() ??
|
|
|
|
|
|
|
|
[], // Added null check and empty list default
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
}),
|
|
|
|
}),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|