Inkwell not showing ripple when used with Container decoration

后端 未结 5 1754
情歌与酒
情歌与酒 2021-01-31 18:35

I want to add a ripple on an item, it is working fine until I add a gradient on the item using BoxDecoration.

Widget build(BuildContext context) {
          


        
5条回答
  •  盖世英雄少女心
    2021-01-31 18:47

    Simple splash effect widget I created that works perfect.

    import 'package:flutter/cupertino.dart';
    import 'package:flutter/material.dart';
    
    class SplashEffect extends StatelessWidget {
      final Widget child;
      final Function onTap;
    
      const SplashEffect({Key key, this.child, this.onTap}) : super(key: key);
    
      @override
      Widget build(BuildContext context) {
        return Material(
          type: MaterialType.transparency,
          child: InkWell(
            borderRadius: BorderRadius.all(Radius.circular(16)),
            child: child,
            onTap: onTap,
          ),
        );
      }
    }
    

提交回复
热议问题