Flutter:将 InkWell 制作成圆形

chi*_*chi 6 flutter

          Container(
            decoration: BoxDecoration(shape: BoxShape.circle),
            child: Material(
              color: Colors.orange,
              child: InkWell(
                splashColor: Colors.black,
                onTap: () {},
                child: Ink(
                  decoration: BoxDecoration(shape: BoxShape.circle),
                  height: Get.height * 0.0425,
                  width: Get.height * 0.0425,
                  child: Icon(Icons.holiday_village),
                ),
              ),
            ),
          ),
Run Code Online (Sandbox Code Playgroud)

我想把这个InkWell东西做成圆形。似乎没有什么可以使它循环。如果我取出Material(),则它不会显示背景颜色,也splash color不会出现。如何重塑此 Contaner - InkWell 圆形,以确保按钮是带有splashColor 的圆形?

Md.*_*ikh 18

customBorder: CircleBorder(),持续使用InkWellshape: const CircleBorder(),Material

Container(
          decoration: BoxDecoration(
            shape: BoxShape.circle,
          ),
          child: Material(
            color: Colors.orange,
            shape: const CircleBorder(),
            child: InkWell(
              splashColor: Colors.black,
              onTap: () {},
              customBorder: const CircleBorder(),
              child: Ink(
                decoration: const BoxDecoration(shape: BoxShape.circle),
                height: 425,
                width: 425,
                child: const Icon(Icons.holiday_village),
              ),
            ),
          ),
        ),
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

  • customBorder: const CircleBorder() 对我来说就足够了,ty :) (2认同)