美文网首页
flutter去除底部导航栏水波纹

flutter去除底部导航栏水波纹

作者: 读书人heart | 来源:发表于2020-12-22 08:41 被阅读0次

    1、主要代码

    class NoSplashFactory extends InteractiveInkFeatureFactory {
      InteractiveInkFeature create({MaterialInkController controller, RenderBox referenceBox, Offset position, Color color, TextDirection textDirection, bool containedInkWell = false, rectCallback, BorderRadius borderRadius, ShapeBorder customBorder, double radius, onRemoved}) {
        return _NoInteractiveInkFeature(controller: controller, referenceBox: referenceBox);
      }
    }
    
    class _NoInteractiveInkFeature extends InteractiveInkFeature {
      _NoInteractiveInkFeature({
        MaterialInkController controller,
        RenderBox referenceBox,
      }) : super(controller: controller, referenceBox: referenceBox);
    
      void paintFeature(Canvas canvas, Matrix4 transform) {}
    }
    

    使用方法

    class MyApp extends StatelessWidget {
      @override
      Widget build(BuildContext context) {
        return MaterialApp(
          debugShowCheckedModeBanner: false,
          theme: ThemeData(platform: TargetPlatform.iOS,
            splashFactory: NoSplashFactory(),),
          home: MainPage(),
        );
      }
    }
    

    相关文章

      网友评论

          本文标题:flutter去除底部导航栏水波纹

          本文链接:https://www.haomeiwen.com/subject/dwpjnktx.html