Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flutter Ripple effect color

How can I change ripple effect color in Flutter?

like image 669
coroutineDispatcher Avatar asked Dec 16 '18 20:12

coroutineDispatcher


2 Answers

Wrap your widget in Theme and provide the data as

data: ThemeData(splashColor: Colors.red)
like image 173
CopsOnRoad Avatar answered Oct 16 '22 03:10

CopsOnRoad


An example for the @CopsOnRoad's answer. (Like-Button)

Theme(
   data: ThemeData(splashColor: Colors.red[200]),
   child: Material(
       elevation: 0,
       shape: CircleBorder(),
       clipBehavior: Clip.hardEdge,
       color: Colors.transparent,
       child: InkWell(
       child: Padding(
           padding: const EdgeInsets.all(10),
                child: Icon(
                   Icons.favorite,
                   color: _isLiked ? Colors.red : Colors.black12,
                   size: 20,
                      ),
                ),
                onTap: () {
                    if(_isLiked){
                        setState(() {
                           _isLiked = false;
                           //You backend state manage code
                        });
                    }else{
                        setState(() {
                           _isLiked = true;
                           //You backend state manage code
                        });
                    }
                },
          ),
    ),
)

enter image description here

like image 29
SUDESH KUMARA Avatar answered Oct 16 '22 04:10

SUDESH KUMARA