mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2025-11-27 11:04:54 +00:00
fixed AppBar null check
This commit is contained in:
@ -1,6 +1,7 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
import 'package:syncrow_app/features/app_layout/bloc/nav_cubit.dart';
|
import 'package:syncrow_app/features/app_layout/bloc/nav_cubit.dart';
|
||||||
|
import 'package:syncrow_app/features/app_layout/bloc/spaces_cubit.dart';
|
||||||
import 'package:syncrow_app/utils/resource_manager/constants.dart';
|
import 'package:syncrow_app/utils/resource_manager/constants.dart';
|
||||||
|
|
||||||
class DefaultAppBar extends StatelessWidget implements PreferredSizeWidget {
|
class DefaultAppBar extends StatelessWidget implements PreferredSizeWidget {
|
||||||
@ -10,19 +11,25 @@ class DefaultAppBar extends StatelessWidget implements PreferredSizeWidget {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return BlocBuilder<NavCubit, NavState>(
|
return BlocBuilder<NavCubit, NavState>(
|
||||||
builder: (context, state) {
|
builder: (context, state) {
|
||||||
return Padding(
|
return BlocBuilder<SpacesCubit, SpacesState>(
|
||||||
padding: const EdgeInsets.only(
|
builder: (context, state) {
|
||||||
top: 20,
|
return Padding(
|
||||||
),
|
padding: const EdgeInsets.only(
|
||||||
child: AppBar(
|
top: 20,
|
||||||
backgroundColor: Colors.transparent,
|
),
|
||||||
leadingWidth: 150,
|
child: AppBar(
|
||||||
toolbarHeight: Constants.appBarHeight,
|
backgroundColor: Colors.transparent,
|
||||||
leading: NavCubit.appBarLeading[
|
leadingWidth: 150,
|
||||||
NavCubit().bottomNavItems[NavCubit.pageIndex].label],
|
toolbarHeight: Constants.appBarHeight,
|
||||||
actions: NavCubit.appBarActions[
|
leading: SpacesCubit.spaces.isNotEmpty
|
||||||
NavCubit().bottomNavItems[NavCubit.pageIndex].label],
|
? NavCubit.appBarLeading[
|
||||||
),
|
NavCubit().bottomNavItems[NavCubit.pageIndex].label]
|
||||||
|
: null,
|
||||||
|
actions: NavCubit.appBarActions[
|
||||||
|
NavCubit().bottomNavItems[NavCubit.pageIndex].label],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|||||||
@ -27,6 +27,7 @@ class MyApp extends StatelessWidget {
|
|||||||
create: (context) => AuthCubit(),
|
create: (context) => AuthCubit(),
|
||||||
),
|
),
|
||||||
BlocProvider(
|
BlocProvider(
|
||||||
|
lazy: false,
|
||||||
create: (context) => NavCubit(),
|
create: (context) => NavCubit(),
|
||||||
),
|
),
|
||||||
BlocProvider(
|
BlocProvider(
|
||||||
|
|||||||
Reference in New Issue
Block a user