build method

  1. @override
Widget build(
  1. BuildContext context
)
override

Override this method to build widgets that depend on the state of the listenable (e.g., the current value of the animation).

Implementation

@override
Widget build(BuildContext context) => Column(
      mainAxisAlignment: MainAxisAlignment.center,
      children: <Widget>[
        SizedBox(
          width: MediaQuery.of(context).size.width * 0.21,
          child: Padding(
            padding: const EdgeInsets.only(right: 10, bottom: 5, top: 5),
            child: DecoratedBox(
              decoration: BoxDecoration(
                border: Border(
                  right: BorderSide(
                    width: 10,
                    color: color,
                  ),
                ),
              ),
              position: DecorationPosition.foreground,
              child: AnimatedBuilder(
                animation: context.read<TypeUpdateNotifier>(),
                builder: (_, __) => CupertinoButton(
                  padding: EdgeInsets.all(
                    context.read<TypeUpdateNotifier>().state == 2 ? 16 : 11,
                  ),
                  borderRadius: BorderRadius.zero,
                  color: visibility.value
                      ? color
                      : CupertinoColors.extraLightBackgroundGray,
                  child: Row(
                    mainAxisAlignment: MainAxisAlignment.center,
                    children: <Widget>[
                      if (context.read<TypeUpdateNotifier>().state == 2)
                        Text(
                          title,
                          style: TextStyle(
                            color: visibility.value
                                ? CupertinoColors.extraLightBackgroundGray
                                : color,
                            fontWeight: FontWeight.bold,
                          ),
                        )
                      else
                        SvgPicture.asset(
                          iconLocation,
                          height: 30,
                          width: 30,
                          fit: BoxFit.cover,
                          colorFilter: ColorFilter.mode(
                            visibility.value ? CupertinoColors.white : color,
                            BlendMode.modulate,
                          ),
                        ),
                    ],
                  ),
                  onPressed: () => visibility.value = !visibility.value,
                ),
              ),
            ),
          ),
        ),
        Visibility(
          visible: visibility.value,
          child: ListView.separated(
            itemCount: items.length,
            physics: const NeverScrollableScrollPhysics(),
            shrinkWrap: true,
            itemBuilder: (BuildContext context, int index) => items[index],
            separatorBuilder: (BuildContext context, int index) =>
                const SizedBox(
              height: 5,
            ),
          ),
        ),
      ],
    );