22// Use of this source code is governed by a BSD-style license that can be
33// found in the LICENSE file.
44
5+ import 'package:flutter/foundation.dart' ;
56import 'package:flutter/rendering.dart' ;
67import 'package:flutter/semantics.dart' ;
78import 'package:flutter/services.dart' ;
8- import 'package:flutter/widgets.dart' ;
99
10- import 'theme.dart' ;
10+ import 'framework.dart' ;
11+ import 'gesture_detector.dart' ;
1112
1213/// Provides platform-specific acoustic and/or haptic feedback for certain
1314/// actions.
@@ -92,7 +93,7 @@ abstract final class Feedback {
9293 /// [GestureTapCallback].
9394 static Future <void > forTap (BuildContext context) async {
9495 context.findRenderObject ()! .sendSemanticsEvent (const TapSemanticEvent ());
95- switch (_platform (context) ) {
96+ switch (defaultTargetPlatform ) {
9697 case TargetPlatform .android:
9798 case TargetPlatform .fuchsia:
9899 return SystemSound .play (SystemSoundType .click);
@@ -119,7 +120,7 @@ abstract final class Feedback {
119120 return null ;
120121 }
121122 return () {
122- Feedback . forTap (context);
123+ forTap (context);
123124 callback ();
124125 };
125126 }
@@ -135,7 +136,7 @@ abstract final class Feedback {
135136 /// executing a [GestureLongPressCallback].
136137 static Future <void > forLongPress (BuildContext context) {
137138 context.findRenderObject ()! .sendSemanticsEvent (const LongPressSemanticsEvent ());
138- switch (_platform (context) ) {
139+ switch (defaultTargetPlatform ) {
139140 case TargetPlatform .android:
140141 case TargetPlatform .fuchsia:
141142 return HapticFeedback .vibrate ();
@@ -167,6 +168,4 @@ abstract final class Feedback {
167168 callback ();
168169 };
169170 }
170-
171- static TargetPlatform _platform (BuildContext context) => Theme .of (context).platform;
172171}
0 commit comments