Want to disable default Widget splash effect in Flutter? You can replace the Theme’s splashFactory with one that doesn’t paint anything:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | class NoSplashFactory extends InteractiveInkFeatureFactory { const NoSplashFactory(); @override InteractiveInkFeature create({ @required MaterialInkController controller, @required RenderBox referenceBox, @required Offset position, @required Color color, bool containedInkWell: false, RectCallback rectCallback, BorderRadius borderRadius, double radius, VoidCallback onRemoved, }) { return new NoSplash( controller: controller, referenceBox: referenceBox, ); } } class NoSplash extends InteractiveInkFeature { NoSplash({ @required MaterialInkController controller, @required RenderBox referenceBox, }) : assert(controller != null), assert(referenceBox != null), super( controller: controller, referenceBox: referenceBox, ); @override void paintFeature(Canvas canvas, Matrix4 transform) {} } |
And wrap your widget with it:
1 2 3 4 | child: new Theme( data: new ThemeData(splashFactory: const NoSplashFactory()), child: new TextField(...), ), |
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.