mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-09 22:57:21 +00:00
fix
This commit is contained in:
@ -5,19 +5,29 @@ 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';
|
||||
|
||||
class WebAppBar extends StatelessWidget with HelperResponsiveLayout {
|
||||
import '../pages/auth/model/user_model.dart';
|
||||
|
||||
class WebAppBar extends StatefulWidget{
|
||||
final Widget? title;
|
||||
final Widget? centerBody;
|
||||
final Widget? rightBody;
|
||||
|
||||
const WebAppBar({super.key, this.title, this.centerBody, this.rightBody});
|
||||
|
||||
@override
|
||||
State<WebAppBar> createState() => _WebAppBarState();
|
||||
}
|
||||
|
||||
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),
|
||||
@ -26,21 +36,21 @@ class WebAppBar extends StatelessWidget with HelperResponsiveLayout {
|
||||
? Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
if (title != null)
|
||||
if (widget.title != null)
|
||||
Align(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: title!,
|
||||
child: widget.title!,
|
||||
),
|
||||
if (centerBody != null)
|
||||
if (widget.centerBody != null)
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 8.0),
|
||||
child: centerBody,
|
||||
child: widget.centerBody,
|
||||
),
|
||||
if (rightBody != null || user != null)
|
||||
if (widget.rightBody != null || HomeBloc.user != null)
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
if (rightBody != null) rightBody!,
|
||||
if (widget.rightBody != null) widget.rightBody!,
|
||||
Row(
|
||||
children: [
|
||||
const SizedBox.square(
|
||||
@ -59,9 +69,9 @@ class WebAppBar extends StatelessWidget with HelperResponsiveLayout {
|
||||
const SizedBox(
|
||||
width: 10,
|
||||
),
|
||||
if (user != null)
|
||||
if (HomeBloc.user != null)
|
||||
Text(
|
||||
'${user.firstName} ${user.lastName}',
|
||||
'${HomeBloc.user!.firstName} ${HomeBloc.user!.lastName}',
|
||||
style: Theme.of(context).textTheme.bodyLarge,
|
||||
),
|
||||
],
|
||||
@ -77,11 +87,11 @@ class WebAppBar extends StatelessWidget with HelperResponsiveLayout {
|
||||
Expanded(
|
||||
child: Row(
|
||||
children: [
|
||||
title!,
|
||||
if (centerBody != null)
|
||||
widget.title!,
|
||||
if (widget.centerBody != null)
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 80),
|
||||
child: centerBody!,
|
||||
child: widget.centerBody!,
|
||||
),
|
||||
],
|
||||
),
|
||||
@ -89,10 +99,10 @@ class WebAppBar extends StatelessWidget with HelperResponsiveLayout {
|
||||
Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
if (rightBody != null)
|
||||
if (widget.rightBody != null)
|
||||
Align(
|
||||
alignment: Alignment.centerRight,
|
||||
child: rightBody,
|
||||
child: widget.rightBody,
|
||||
),
|
||||
const SizedBox(
|
||||
width: 10,
|
||||
@ -113,9 +123,9 @@ class WebAppBar extends StatelessWidget with HelperResponsiveLayout {
|
||||
const SizedBox(
|
||||
width: 10,
|
||||
),
|
||||
if (user != null)
|
||||
if (HomeBloc.user != null)
|
||||
Text(
|
||||
'${user.firstName} ${user.lastName}',
|
||||
'${HomeBloc.user!.firstName} ${HomeBloc.user!.lastName}',
|
||||
style: Theme.of(context).textTheme.bodyLarge,
|
||||
),
|
||||
],
|
||||
|
Reference in New Issue
Block a user