Added appbar actions for all the views

Added appbar leading logo for the menu view
This commit is contained in:
Mohammad Salameh
2024-03-05 13:42:58 +03:00
parent 5a9c96b0a8
commit b99247c937
8 changed files with 121 additions and 18 deletions

BIN
assets/icons/filter.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.8 KiB

BIN
assets/icons/qr_scan.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

BIN
assets/icons/settings.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 130 KiB

View File

@ -1,6 +1,7 @@
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:syncrow_app/features/app_layout/view/widgets/app_bar_home_dropdown.dart';
import 'package:syncrow_app/features/dashboard/view/dashboard_view.dart';
import 'package:syncrow_app/features/devices/view/widgets/devices_view_body.dart';
import 'package:syncrow_app/features/menu/view/menu_view.dart';
@ -17,13 +18,117 @@ class NavCubit extends Cubit<NavState> {
static NavCubit of(context) => BlocProvider.of<NavCubit>(context);
static int pageIndex = 0;
int get getPageIndex => pageIndex;
static Map<String, List<Widget>> appBarActions = {
'Dashboard': [
IconButton(
icon: const Icon(
Icons.add,
size: 25,
),
style: ButtonStyle(
foregroundColor:
MaterialStateProperty.all(ColorsManager.textPrimaryColor),
),
onPressed: () {},
),
],
'Devices': [
IconButton(
icon: Image.asset(
Assets.iconsFilter,
height: 20,
width: 20,
),
onPressed: () {},
),
IconButton(
icon: const Icon(
Icons.add,
size: 25,
),
style: ButtonStyle(
foregroundColor:
MaterialStateProperty.all(ColorsManager.textPrimaryColor),
),
onPressed: () {},
),
IconButton(
icon: const Icon(
Icons.more_vert,
size: 25,
),
style: ButtonStyle(
foregroundColor:
MaterialStateProperty.all(ColorsManager.textPrimaryColor),
),
onPressed: () {},
),
],
'Routine': [
IconButton(
icon: Image.asset(
Assets.iconsFilter,
height: 20,
width: 20,
),
onPressed: () {},
),
IconButton(
icon: const Icon(
Icons.add,
size: 25,
),
style: ButtonStyle(
foregroundColor:
MaterialStateProperty.all(ColorsManager.textPrimaryColor),
),
onPressed: () {},
),
IconButton(
icon: const Icon(
Icons.more_vert,
size: 25,
),
style: ButtonStyle(
foregroundColor:
MaterialStateProperty.all(ColorsManager.textPrimaryColor),
),
onPressed: () {},
),
],
'Menu': [
IconButton(
icon: Image.asset(
Assets.iconsQrScan,
height: 20,
width: 20,
),
onPressed: () {},
),
IconButton(
icon: Image.asset(
Assets.iconsSettings,
height: 20,
width: 20,
),
onPressed: () {},
),
],
};
Map<String, List<Widget>> appBarActions = {
'Home': [],
'Scene': [],
'Smart': [],
'Profile': [],
static Map<String, Widget?> appBarLeading = {
'Dashboard': const AppBarHomeDropdown(),
'Devices': const AppBarHomeDropdown(),
'Routine': const AppBarHomeDropdown(),
'Menu': Padding(
padding: const EdgeInsets.only(left: 15),
child: Image.asset(
Assets.imagesLogoHorizontal,
height: 15,
width: 100,
fit: BoxFit.scaleDown,
),
),
};
var bottomNavItems = [

View File

@ -1,7 +1,6 @@
import 'package:flutter/material.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/view/widgets/app_bar_home_dropdown.dart';
import 'package:syncrow_app/utils/resource_manager/constants.dart';
class DefaultAppBar extends StatelessWidget implements PreferredSizeWidget {
@ -20,16 +19,10 @@ class DefaultAppBar extends StatelessWidget implements PreferredSizeWidget {
child: AppBar(
backgroundColor: Colors.transparent,
leadingWidth: 150,
leading: const AppBarHomeDropdown(),
actions: <Widget>[
IconButton(
icon: const Icon(
Icons.add,
size: 35,
),
onPressed: () {},
),
],
leading: NavCubit.appBarLeading[
NavCubit().bottomNavItems[NavCubit.pageIndex].label],
actions: NavCubit.appBarActions[
NavCubit().bottomNavItems[NavCubit.pageIndex].label],
),
);
},

View File

@ -25,7 +25,7 @@ class DefaultNavBar extends StatelessWidget {
DevicesCubit().clearCategoriesSelection(context);
}
},
currentIndex: cubit.getPageIndex,
currentIndex: NavCubit.pageIndex,
selectedItemColor: ColorsManager.primaryColor,
selectedLabelStyle: const TextStyle(
color: ColorsManager.primaryColor,

View File

@ -19,6 +19,7 @@ class Assets {
static const String iconsFan1 = 'assets/icons/fan-1.svg';
static const String iconsFan2 = 'assets/icons/fan-2.svg';
static const String iconsFan3 = 'assets/icons/fan-3.svg';
static const String iconsFilter = 'assets/icons/filter.png';
static const String iconsFrequency = 'assets/icons/frequency.svg';
static const String iconsGateway = 'assets/icons/Gateway.svg';
static const String iconsHome = 'assets/icons/home.svg';
@ -33,9 +34,11 @@ class Assets {
static const String iconsMenuFill = 'assets/icons/Menu-fill.svg';
static const String iconsMinus = 'assets/icons/minus.svg';
static const String iconsPlus = 'assets/icons/plus.svg';
static const String iconsQrScan = 'assets/icons/qr_scan.png';
static const String iconsRoutines = 'assets/icons/Routines.svg';
static const String iconsRoutinesFill = 'assets/icons/Routines-fill.svg';
static const String iconsScreen = 'assets/icons/Screen.svg';
static const String iconsSettings = 'assets/icons/settings.png';
static const String iconsSummer = 'assets/icons/Summer.svg';
static const String iconsSummerMode = 'assets/icons/summer_mode.svg';
static const String iconsSunnyMode = 'assets/icons/sunnyMode.svg';
@ -49,6 +52,8 @@ class Assets {
static const String imagesBackground = 'assets/images/Background.png';
static const String imagesBlackLogo = 'assets/images/black-logo.png';
static const String imagesBoxEmpty = 'assets/images/box-empty.jpg';
static const String imagesLogoHorizontal =
'assets/images/logo_horizontal.png';
static const String imagesTestDash = 'assets/images/test_dash.png';
static const String imagesTestDash2 = 'assets/images/test_dash2.png';
static const String imagesWhiteLogo = 'assets/images/white-logo.png';