hotfix/communities_loading

This commit is contained in:
Faris Armoush
2025-06-18 14:33:39 +03:00
parent f5500dfe50
commit 45e6ea3259
4 changed files with 20 additions and 11 deletions

View File

@ -13,19 +13,25 @@ class HomePage extends StatefulWidget {
State<HomePage> createState() => _HomePageState();
}
class _HomePageState extends State<HomePage> with HelperResponsiveLayout{
class _HomePageState extends State<HomePage> with HelperResponsiveLayout {
@override
void initState() {
context.read<HomeBloc>().add(const FetchUserInfo());
_fetchUserInfo();
super.initState();
}
@override
Widget build(BuildContext context) {
final isSmallScreen = isSmallScreenSize(context);
final isMediumScreen = isMediumScreenSize(context);
return isSmallScreen || isMediumScreen
? HomeMobilePage()
: const HomeWebPage();
if (isSmallScreenSize(context) || isMediumScreenSize(context)) {
return HomeMobilePage();
}
return const HomeWebPage();
}
void _fetchUserInfo() {
final bloc = context.read<HomeBloc>();
if (bloc.user == null) bloc.add(const FetchUserInfo());
}
}