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(),
);
}
}
网友评论