Untitled

 avatar
unknown
plain_text
7 months ago
10 kB
3
Indexable
import 'package:Buildeffective/src/model/property_info_response.dart';
import 'package:Buildeffective/src/screens/homeguide_screen/add_property_address.dart';
import 'package:Buildeffective/src/screens/homeguide_screen/space_dashboard_screen.dart';
import 'package:Buildeffective/src/screens/homeguide_screen/widget/upload_image_place_holder.dart';
import 'package:Buildeffective/src/screens/splash/splash_screen.dart';
import 'package:Buildeffective/src/ui_component/common_cached_image.dart';
import 'package:Buildeffective/src/utils/comman_export.dart';
import 'package:flutter/material.dart';
import 'package:flutter_mobx/flutter_mobx.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:nb_utils/nb_utils.dart';

class HeaderComponent extends StatelessWidget {
  final MyProperty ownProperty;
  final bool? isTablet;
  final Function()? onDataLoad;

  const HeaderComponent({
    super.key,
    required this.ownProperty,
    this.isTablet,
    this.onDataLoad,
  });

  @override
  Widget build(BuildContext context) {
    return Stack(
      // fit: StackFit.expand,
      children: [
        Observer(builder: (context) {
          return CommonCachedImage(
            imageUrl: homeGuideViewModel.uploadedImage,
            height: SplashScreen.isMobileDevice ? context.height() * 0.63 : context.height() * 0.53,
            width: context.width(),
            isCircle: false,
            boxFit: BoxFit.cover,
            placeHolder: UploadImagePlaceHolder(
              isTablet: isTablet,
              ownProperty: ownProperty,
              onDataLoad: onDataLoad,
            ),
          ).cornerRadiusWithClipRRectOnly(bottomLeft: 24, bottomRight: 24);
        }),
        Positioned(
          bottom: SplashScreen.isMobileDevice ? 12 : 20,
          right: SplashScreen.isMobileDevice ? 12 : null,
          left: SplashScreen.isMobileDevice ? 12 : 16,
          child: Container(
            padding: SplashScreen.isMobileDevice ? EdgeInsets.only(left: SplashScreen.isMobileDevice ? 12 : 20, top: 12, right: 20, bottom: 12) : EdgeInsets.all(16),
            decoration: BoxDecoration(
              color: Color.fromRGBO(255, 255, 255, 0.9),
              borderRadius: radius(16),
            ),
            child: Row(
              mainAxisAlignment: MainAxisAlignment.start,
              crossAxisAlignment: CrossAxisAlignment.start,
              mainAxisSize: SplashScreen.isMobileDevice ? MainAxisSize.max : MainAxisSize.min,
              children: [
                CommonCachedImage(
                  imageUrl: ownProperty.attachmentDocs.validate().isNotEmpty ? ownProperty.attachmentDocs?.first.originalUrl.validate() : null,
                  height: SplashScreen.isMobileDevice ? 66 : 90,
                  width: SplashScreen.isMobileDevice ? 66 : 90,
                  isCircle: false,
                  placeHolder: Container(
                    height: SplashScreen.isMobileDevice ? 66 : 90,
                    width: SplashScreen.isMobileDevice ? 66 : 90,
                    alignment: Alignment.center,
                    decoration: BoxDecoration(color: Color.fromRGBO(242, 242, 242, 1)),
                    child: SvgPicture.asset(ResImages.ic_empty_address_icon, height: 38, width: 38),
                  ),
                ).cornerRadiusWithClipRRect(8),
                ownProperty.addressText.isNullOrEmpty() ? 12.width : 10.width,
                Observer(builder: (context) {
                  return Column(
                    crossAxisAlignment: CrossAxisAlignment.start,
                    children: [
                      Text(ownProperty.name.validate(), style: BETextStyles.titleWithDarkBlueColor),
                      5.height,
                      Text(ownProperty.propertyType.validate(), style: BETextStyles.MediumTextStyleWithDarkBlueColor),
                      ownProperty.addressText.isNullOrEmpty() ? 6.height : 5.height,
                      ownProperty.addressText.isNullOrEmpty()
                          ? GestureDetector(
                              onTap: () async {
                                await AddPropertyAddress(propertySlug: ownProperty.slug).launch(context).then((value) {
                                  onDataLoad!.call();
                                });
                              },
                              child: Row(
                                crossAxisAlignment: CrossAxisAlignment.center, // Aligns items vertically in the Row
                                mainAxisSize: MainAxisSize.min,
                                children: [
                                  SvgPicture.asset(
                                    ResImages.icLocationPinNew,
                                  ),
                                  4.width,
                                  Text(
                                    "Add Address",
                                    style: BETextStyles.Style600Italic13(color: BEColors.primaryColor),
                                  )
                                ],
                              ),
                            )
                          : Text(
                              ownProperty.addressText.validate(),
                              style: BETextStyles.InfoTextStyleWithDarkBlueColor,
                              maxLines: 1,
                              overflow: TextOverflow.ellipsis,
                            ),
                    ],
                  ).expand(flex: SplashScreen.isMobileDevice ? 1 : 0);
                }),
              ],
            ),
          ),
        )
        /*homeGuideViewModel.uploadedImage!.isNotEmpty
            ? Positioned(
                bottom: SplashScreen.isMobileDevice ? 12 : 20,
                right: SplashScreen.isMobileDevice ? 12 : null,
                left: SplashScreen.isMobileDevice ? 12 : 16,
                child: Container(
                  padding: SplashScreen.isMobileDevice ? EdgeInsets.only(left: SplashScreen.isMobileDevice ? 12 : 20, top: 12, right: 20, bottom: 12) : EdgeInsets.all(16),
                  decoration: BoxDecoration(
                    color: Color.fromRGBO(255, 255, 255, 0.9),
                    borderRadius: radius(16),
                  ),
                  child: Row(
                    mainAxisAlignment: MainAxisAlignment.start,
                    crossAxisAlignment: CrossAxisAlignment.start,
                    mainAxisSize: SplashScreen.isMobileDevice ? MainAxisSize.max : MainAxisSize.min,
                    children: [
                      CommonCachedImage(
                        imageUrl: ownProperty.attachmentDocs.validate().isNotEmpty ? ownProperty.attachmentDocs?.first.originalUrl.validate() : null,
                        height: SplashScreen.isMobileDevice ? 66 : 90,
                        width: SplashScreen.isMobileDevice ? 66 : 90,
                        isCircle: false,
                        placeHolder: Container(
                          height: SplashScreen.isMobileDevice ? 66 : 90,
                          width: SplashScreen.isMobileDevice ? 66 : 90,
                          alignment: Alignment.center,
                          decoration: BoxDecoration(color: Color.fromRGBO(242, 242, 242, 1)),
                          child: SvgPicture.asset(ResImages.ic_empty_address_icon, height: 38, width: 38),
                        ),
                      ).cornerRadiusWithClipRRect(8),
                      ownProperty.addressText.isNullOrEmpty() ? 12.width : 10.width,
                      Observer(builder: (context) {
                        return Column(
                          crossAxisAlignment: CrossAxisAlignment.start,
                          children: [
                            Text(ownProperty.name.validate(), style: BETextStyles.titleWithDarkBlueColor),
                            5.height,
                            Text(ownProperty.propertyType.validate(), style: BETextStyles.MediumTextStyleWithDarkBlueColor),
                            ownProperty.addressText.isNullOrEmpty() ? 6.height : 5.height,
                            ownProperty.addressText.isNullOrEmpty()
                                ? GestureDetector(
                                    onTap: () async {
                                      await AddPropertyAddress(propertySlug: ownProperty.slug).launch(context).then((value) {
                                        onDataLoad!.call();
                                      });
                                    },
                                    child: Row(
                                      crossAxisAlignment: CrossAxisAlignment.center, // Aligns items vertically in the Row
                                      mainAxisSize: MainAxisSize.min,
                                      children: [
                                        SvgPicture.asset(
                                          ResImages.icLocationPinNew,
                                        ),
                                        4.width,
                                        Text(
                                          "Add Address",
                                          style: BETextStyles.Style600Italic13(color: BEColors.primaryColor),
                                        )
                                      ],
                                    ),
                                  )
                                : Text(
                                    ownProperty.addressText.validate(),
                                    style: BETextStyles.InfoTextStyleWithDarkBlueColor,
                                    maxLines: 1,
                                    overflow: TextOverflow.ellipsis,
                                  ),
                          ],
                        ).expand(flex: SplashScreen.isMobileDevice ? 1 : 0);
                      }),
                    ],
                  ),
                ),
              )
            : Offstage(),*/
      ],
    );
  }
}
Editor is loading...
Leave a Comment