Untitled

 avatar
user_8529798
plain_text
13 days ago
2.6 kB
2
Indexable
import 'package:Buildeffective/src/ui_component/ag_tap_effect_widget.dart';
import 'package:Buildeffective/src/utils/comman_export.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:nb_utils/nb_utils.dart';

class ExpansionWidgetWithFireplace extends StatelessWidget {
  final bool isSelected;
  final Function()? onTap;
  final String title;
  final String? count;
  final bool? hideArrowButton;
  final bool? hideArrowButtonSpace;
  final double leftPadding;
  final double verticalPadding;
  final TextStyle? titleTextStyle;
  final Widget child;

  const ExpansionWidgetWithFireplace({
    Key? key,
    this.isSelected = false,
    required this.onTap,
    required this.title,
    this.count,
    this.hideArrowButton,
    this.titleTextStyle,
    this.hideArrowButtonSpace,
    this.leftPadding = 0,
    this.verticalPadding = 12.0,
    required this.child,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return AgTapEffect(
      enableRipple: onTap != null,
      child: InkWell(
        onTap: onTap,
        child: Ink(
          color: isSelected ? BEColors.primaryColorLight : Colors.white,
          padding: EdgeInsets.only(left: leftPadding),
          child: Padding(
            padding: EdgeInsets.only(right: 16, left: leftPadding, bottom: verticalPadding, top: verticalPadding),
            child: Row(
              crossAxisAlignment: CrossAxisAlignment.start,
              children: [
                32.width,
                Visibility(
                  visible: !hideArrowButton.validate(),
                  maintainState: hideArrowButtonSpace.validate(value: true),
                  maintainAnimation: hideArrowButtonSpace.validate(value: true),
                  maintainSize: hideArrowButtonSpace.validate(value: true),
                  child: AnimatedRotation(
                    duration: Duration(milliseconds: 450),
                    curve: Curves.easeInOut, // Optional: Add an easing curve for smoother animation
                    turns: isSelected ? 0.25 : 0, // 0.25 turns equals 90 degrees rotate the arrow if moving down
                    child: SvgPicture.asset(
                      ResImages.ic_product_arrow_right,
                      color: BEColors.darkBlue,
                      height: 12,
                      width: 12,
                    ),
                  ),
                ).paddingTop(10),
                if (hideArrowButtonSpace.validate(value: true)) 10.width,
                child.expand(),
              ],
            ),
          ),
        ),
      ),
    );
  }
}
Leave a Comment