flutter 抖动:浮动ActionButton阴影

ef1yzkbh  于 2022-12-05  发布在  Flutter
关注(0)|答案(3)|浏览(192)

您是否能够或有办法更改FloatingActionButton.extended或任何其他浮动按钮所产生的阴影颜色?

lvmkulzt

lvmkulzt1#

您可以尝试以下方法:

floatingActionButton: FloatingActionButton(
      onPressed: () {},
      backgroundColor: Colors.red,
      elevation: 0,
      child: Container(
        decoration: BoxDecoration(
          color: Colors.transparent,
          borderRadius: BorderRadius.all(
            Radius.circular(100),
          ),
          boxShadow: [
            BoxShadow(
              color: Colors.purple.withOpacity(0.3),
              spreadRadius: 7,
              blurRadius: 7,
              offset: Offset(3, 5),
            ),
          ],
        ),
      ),
    ),
toe95027

toe950272#

浮动操作按钮:浮动操作按钮(按下时:(){},背景颜色:颜色(0xf 0004451),标高:10,

child: Container(
    padding: const EdgeInsets.all(14.0),
    decoration: BoxDecoration(
      color: Colors.transparent,
      borderRadius: BorderRadius.all(
        Radius.circular(60),
      ),
      boxShadow: [
        BoxShadow(
          color: Color(0xffE1E8EB).withOpacity(0.35),
          spreadRadius: 8,
          blurRadius: 8,
          offset: const Offset(1, 1),
        ),
      ],
    ),
    child: const Icon(Icons.add,
    color: Color(0xffE1E8EB),
      size: 18,
      shadows: [Shadow(
        color: Color(0xffE1E8EB),
        offset: Offset(0.2, 0.5),
        blurRadius: 5.0,
      )],
    ),
  ),
),
epfja78i

epfja78i3#

floatingActionButtonLocation: FloatingActionButtonLocation.centerFloat,
    floatingActionButton: Container(
      height: 70,
      width: 70,
     margin: const EdgeInsets.only(bottom: 10.0),
      decoration: BoxDecoration(
        color: Colors.transparent,
        borderRadius: const BorderRadius.all(
          Radius.circular(100),
        ),
        boxShadow: [
          BoxShadow(
            color: MyColors.myWhite.withOpacity(0.3),
            spreadRadius: 6,
            blurRadius: 6,
            offset: const Offset(0.5, 0.5),
          ),
        ],
      ),
      child: FittedBox(
        child: FloatingActionButton(
            onPressed: (){},
          backgroundColor: MyColors.myGreen,
          elevation: 10,
            child: const Icon(Icons.add,
            color: MyColors.myWhite,
              size: 18,
              shadows: [Shadow(
                color: MyColors.myWhite,
                offset: Offset(0.2, 0.5),
                blurRadius: 5.0,
              )],
            ),
          ),
        ),
  ),

相关问题