bottomButton method

Widget bottomButton(
  1. BuildContext context,
  2. int index,
  3. dynamic animation
)

Implementation

Widget bottomButton(BuildContext context, int index, animation) {
  double width = widget.datePickerIconPosition != null
      ? widget.calendarSize
      : widget.iconSize;
  return SizeTransition(
    sizeFactor: animation,
    axis: Axis.horizontal,
    axisAlignment: -1,
    child: ScaleTransition(
      alignment: Alignment.centerLeft,
      scale: Tween<double>(begin: 0, end: 1).animate(animation),
      child: Row(
        children: [
          Center(
            child: Container(
              decoration: BoxDecoration(
                color: setDarkColor(),
                borderRadius: BorderRadius.circular(width * 0.06),
                border:
                    Border.all(color: widget.selectedCircleColor, width: 3),
              ),
              child: ClipRRect(
                borderRadius: BorderRadius.circular(width * 0.06),
                child: Material(
                  color: Colors.transparent,
                  child: GestureDetector(
                    // highlightColor: Color(0XFFF4F4F4).withOpacity(1.0),
                    // splashColor: Colors.grey.withOpacity(0.7),
                    onTap: () {
                      setState(() {
                        yearValue = findValue(
                            list: widget.years,
                            value: bottomSelectedItems![index].year);
                        monthValue = findValue(
                            list: widget.monthLabelList,
                            value: bottomSelectedItems![index].month);
                        setCalendar();
                        setPreSelected();
                        yearDropdown.currentState!
                            .setDefaultValue(defaultValue: yearValue);
                        monthDropdown.currentState!
                            .setDefaultValue(defaultValue: monthValue);
                      });
                    },
                    child: Stack(
                      children: [
                        Container(
                          padding: EdgeInsets.fromLTRB(
                            width * 0.02,
                            width * 0.015,
                            width * 0.02,
                            width * 0.015,
                          ),
                          child: Row(
                            children: [
                              Container(
                                child: AnimatedSize(
                                  duration: Duration(milliseconds: 1000),
                                  child: Text(
                                    setFormat(
                                      yyyy: index >=
                                              bottomSelectedItems!.length
                                          ? 0000
                                          : bottomSelectedItems![index].year,
                                      mm: index >= bottomSelectedItems!.length
                                          ? 0
                                          : bottomSelectedItems![index].month,
                                      dd: index >= bottomSelectedItems!.length
                                          ? 0
                                          : bottomSelectedItems![index].day,
                                    ),
                                    style: TextStyle(
                                        fontSize: width * 0.033,
                                        color: widget.isDark
                                            ? Colors.white
                                            : Color(0XFF666666),
                                        fontWeight: FontWeight.bold),
                                  ),
                                ),
                              ),
                              SizedBox(
                                width: width * 0.015,
                              ),
                              Container(
                                padding: EdgeInsets.all(width * 0.005),
                                width: width * 0.03,
                                height: width * 0.03,
                              )
                            ],
                          ),
                        ),
                        Positioned(
                          right: 0,
                          child: GestureDetector(
                            onTap: () {
                              setState(() {
                                if (calendarInfo.year ==
                                        selectedItems![index].year &&
                                    calendarInfo.month ==
                                        selectedItems![index].month) {
                                  DateInfo selectedDates6 = calendarInfo.dates
                                      .singleWhere((element) =>
                                          element.date ==
                                          selectedItems![index].day);
                                  selectedDates6.isSelected = SelectType.none;
                                  selectedDates6.singleSelectedAniCtrl!
                                      .reverse();
                                }
                                selectedItems!.remove(selectedItems![index]);
                                removeBottomSelectedItemsXBtn(index);
                              });
                              // widget.onSelected(
                              //     selectedItems);
                            },
                            child: Container(
                              color: Colors.transparent,
                              padding: EdgeInsets.all(width * 0.025),
                              width: width * 0.075,
                              height: width * 0.075,
                              child: CustomPaint(
                                size: Size(width * 0.01,
                                    (width * 0.01 * 1).toDouble()),
                                painter: XButtonPaint(),
                              ),
                            ),
                          ),
                        )
                      ],
                    ),
                  ),
                ),
              ),
            ),
          ),
          if ((selectedItems!.length - 1) != index)
            SizedBox(
              width: width * 0.015,
            )
        ],
      ),
    ),
  );
}