Untitled

 avatar
unknown
plain_text
4 months ago
6.1 kB
4
Indexable
import 'package:Buildeffective/src/screens/homeguide_screen/property_attributes_screen.dart';
import 'package:Buildeffective/src/screens/homeguide_screen/space_dashboard_screen.dart';
import 'package:Buildeffective/src/screens/homeguide_screen/widget/icon_name_widget.dart';
import 'package:Buildeffective/src/screens/property_dashboard/property_dashboard_screen.dart';
import 'package:Buildeffective/src/screens/space_property_list/space_viewmodel.dart';
import 'package:Buildeffective/src/screens/splash/splash_screen.dart';
import 'package:Buildeffective/src/screens/team_member_flow/screens/team_member_screen.dart';
import 'package:Buildeffective/src/utils/comman_export.dart';
import 'package:Buildeffective/src/utils/res_images.dart';
import 'package:flutter/material.dart';
import 'package:get_it/get_it.dart';
import 'package:nb_utils/nb_utils.dart';

class SpaceOptionComponent extends StatelessWidget {
  final bool isTablet;
  final Function()? onMessageLoad;
  final String? propertySlug;
  final String? propertId;
  final String? propertyName;

  const SpaceOptionComponent({Key? key, required this.isTablet, this.onMessageLoad, this.propertySlug, this.propertId, this.propertyName}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    double width = SplashScreen.isMobileDevice ? context.width() / 3 - 14 : context.width() / 5 - 10;
    return AnimatedWrap(
      runSpacing: 4,
      spacing: 4,
      children: [
        IconNameWidget(
          title: "Spaces",
          width: width,
          iconImage: ResImages.icSpaceNew,
          onTap: () async {
            await PropertyDashboardScreen(
              0,
              propertySlug: propertySlug,
              propertyId: propertId,
              propertyName: propertyName,
            ).launch(context, pageRouteAnimation: PageRouteAnimation.Slide);
            if (GetIt.instance.isRegistered<SpaceViewModel>()) {
              GetIt.instance.unregister<SpaceViewModel>();
            }
          },
        ),
        IconNameWidget(
          title: "Products",
          width: width,
          iconImage: ResImages.icProductNew,
          onTap: () async {
            homeGuideViewModel.moreTabIndex = 0;
            await PropertyDashboardScreen(
              1,
              propertySlug: propertySlug,
              propertyId: propertId,
              propertyName: propertyName,
            ).launch(context, pageRouteAnimation: PageRouteAnimation.Slide);
          },
        ),
        IconNameWidget(
          title: "Photos",
          width: width,
          iconImage: ResImages.icPhotoNew,
          onTap: () async {
            homeGuideViewModel.moreTabIndex = 0;
            await PropertyDashboardScreen(
              2,
              propertySlug: propertySlug,
              propertyId: propertId,
              propertyName: propertyName,
            ).launch(context, pageRouteAnimation: PageRouteAnimation.Slide);
          },
        ),
        IconNameWidget(
          title: "Messages",
          width: width,
          iconImage: ResImages.icMessageNew,
          onTap: () async {
            homeGuideViewModel.moreTabIndex = 1;
            var res = await PropertyDashboardScreen(
              3,
              propertySlug: propertySlug,
              propertyId: propertId,
              propertyName: propertyName,
            ).launch(context, pageRouteAnimation: PageRouteAnimation.Slide);
            if (res == "inviteClicked") {
              Navigator.pushNamed(context, TeamMemberScreen.route).then((value) {
                onMessageLoad!.call();
              });
            }
            if (GetIt.instance.isRegistered<SpaceViewModel>()) {
              GetIt.instance.unregister<SpaceViewModel>();
            }
          },
        ),
        IconNameWidget(
          title: "Plans & Permits",
          width: width,
          iconImage: ResImages.icPlanPermitNew,
          onTap: () async {
            homeGuideViewModel.moreTabIndex = 0;

            await PropertyDashboardScreen(
              4,
              propertySlug: propertySlug,
              propertyId: propertId,
              propertyName: propertyName,
            ).launch(context, pageRouteAnimation: PageRouteAnimation.Slide);
            if (GetIt.instance.isRegistered<SpaceViewModel>()) {
              GetIt.instance.unregister<SpaceViewModel>();
            }
          },
        ),
        IconNameWidget(
          onTap: () async {
            await TeamMemberScreen().launch(context, pageRouteAnimation: PageRouteAnimation.Slide);
          },
          title: "Team Members",
          width: width,
          iconImage: ResImages.icTeamNew,
        ),
        IconNameWidget(
          onTap: () async {
            PropertyAttributesScreen(
              index: 0,
              screenName: homeGuideViewModel.property.name.validate(),
              homeGuideViewModel: homeGuideViewModel,
            ).launch(context, pageRouteAnimation: PageRouteAnimation.Slide);
          },
          title: "Notes",
          width: width,
          iconImage: ResImages.icNotesNew,
        ),
        IconNameWidget(
          onTap: () async {
            PropertyAttributesScreen(
              index: 1,
              screenName: homeGuideViewModel.property.name.validate(),
              homeGuideViewModel: homeGuideViewModel,
            ).launch(context, pageRouteAnimation: PageRouteAnimation.Slide);
          },
          title: "Tasks",
          width: width,
          iconImage: ResImages.icTaskNew,
        ),
        IconNameWidget(
          onTap: () async {
            PropertyAttributesScreen(
              index: 2,
              screenName: homeGuideViewModel.property.name.validate(),
              homeGuideViewModel: homeGuideViewModel,
            ).launch(context, pageRouteAnimation: PageRouteAnimation.Slide);
          },
          title: "Dreams",
          width: width,
          iconImage: ResImages.icDreamsNew,
        ),
      ],
    ).paddingSymmetric(horizontal: 16);
  }
}
Editor is loading...
Leave a Comment