Flutter: FloatingActionButton shadow
Asked Answered
A

3

12

Are you able or is there a way to change the color of the shadow made by the FloatingActionButton.extended or any other floating button ?

Amadis answered 29/7, 2018 at 18:12 Comment(1)
As of now you can't. Consider creating your own FloatingButton by either forking sources or composing from lower level widgets to fit your need (such as Material)Subterranean
I
13

enter image description here

You can try this way:

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),
            ),
          ],
        ),
      ),
    ),
Icecap answered 11/12, 2020 at 20:20 Comment(0)
A
0
floatingActionButton: FloatingActionButton(
        onPressed: (){},
      backgroundColor: Color(0xf0004451),
      elevation: 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,
          )],
        ),
      ),
    ),
Avellaneda answered 4/12, 2022 at 12:42 Comment(0)
A
0
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,
              )],
            ),
          ),
        ),
  ),
Avellaneda answered 4/12, 2022 at 13:12 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.