push search, space color selection, global user access fixes

This commit is contained in:
ashrafzarkanisala
2024-09-05 00:43:57 +03:00
parent c9160debd3
commit 74dccbf899
12 changed files with 203 additions and 192 deletions

View File

@ -5,9 +5,7 @@ import 'package:syncrow_web/pages/home/bloc/home_state.dart';
import 'package:syncrow_web/utils/color_manager.dart';
import 'package:syncrow_web/utils/helpers/responsice_layout_helper/responsive_layout_helper.dart';
import '../pages/auth/model/user_model.dart';
class WebAppBar extends StatefulWidget{
class WebAppBar extends StatefulWidget {
final Widget? title;
final Widget? centerBody;
final Widget? rightBody;
@ -18,16 +16,18 @@ class WebAppBar extends StatefulWidget{
State<WebAppBar> createState() => _WebAppBarState();
}
class _WebAppBarState extends State<WebAppBar> with HelperResponsiveLayout {
class _WebAppBarState extends State<WebAppBar> with HelperResponsiveLayout {
@override
void initState() {
super.initState();
}
@override
Widget build(BuildContext context) {
bool isSmallScreen = isSmallScreenSize(context);
bool isHalfMediumScreen = isHafMediumScreenSize(context);
return BlocBuilder<HomeBloc, HomeState>(builder: (context, state) {
final user = context.read<HomeBloc>().user;
return Container(
height: (isSmallScreen || isHalfMediumScreen) ? 130 : 100,
decoration: const BoxDecoration(color: ColorsManager.secondaryColor),
@ -46,7 +46,7 @@ class _WebAppBarState extends State<WebAppBar> with HelperResponsiveLayout {
padding: const EdgeInsets.only(top: 8.0),
child: widget.centerBody,
),
if (widget.rightBody != null || HomeBloc.user != null)
if (widget.rightBody != null || user != null)
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
@ -69,9 +69,9 @@ class _WebAppBarState extends State<WebAppBar> with HelperResponsiveLayout {
const SizedBox(
width: 10,
),
if (HomeBloc.user != null)
if (user != null)
Text(
'${HomeBloc.user!.firstName} ${HomeBloc.user!.lastName}',
'${user.firstName} ${user.lastName}',
style: Theme.of(context).textTheme.bodyLarge,
),
],
@ -123,9 +123,9 @@ class _WebAppBarState extends State<WebAppBar> with HelperResponsiveLayout {
const SizedBox(
width: 10,
),
if (HomeBloc.user != null)
if (user != null)
Text(
'${HomeBloc.user!.firstName} ${HomeBloc.user!.lastName}',
'${user.firstName} ${user.lastName}',
style: Theme.of(context).textTheme.bodyLarge,
),
],