Enable CupertinoContextMenu on Web (#52977)
This commit is contained in:
parent
9f4e5ad9c3
commit
197ac5256e
@ -5,6 +5,7 @@
|
|||||||
import 'dart:math' as math;
|
import 'dart:math' as math;
|
||||||
import 'dart:ui' as ui;
|
import 'dart:ui' as ui;
|
||||||
import 'package:flutter/gestures.dart' show kMinFlingVelocity, kLongPressTimeout;
|
import 'package:flutter/gestures.dart' show kMinFlingVelocity, kLongPressTimeout;
|
||||||
|
import 'package:flutter/foundation.dart' show kIsWeb;
|
||||||
import 'package:flutter/rendering.dart';
|
import 'package:flutter/rendering.dart';
|
||||||
import 'package:flutter/scheduler.dart';
|
import 'package:flutter/scheduler.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
@ -511,7 +512,12 @@ class _DecoyChildState extends State<_DecoyChild> with TickerProviderStateMixin
|
|||||||
: _mask.value;
|
: _mask.value;
|
||||||
return Positioned.fromRect(
|
return Positioned.fromRect(
|
||||||
rect: _rect.value,
|
rect: _rect.value,
|
||||||
child: ShaderMask(
|
// TODO(justinmc): When ShaderMask is supported on web, remove this
|
||||||
|
// conditional and use ShaderMask everywhere.
|
||||||
|
// https://github.com/flutter/flutter/issues/52967.
|
||||||
|
child: kIsWeb
|
||||||
|
? Container(key: _childGlobalKey, child: widget.child)
|
||||||
|
: ShaderMask(
|
||||||
key: _childGlobalKey,
|
key: _childGlobalKey,
|
||||||
shaderCallback: (Rect bounds) {
|
shaderCallback: (Rect bounds) {
|
||||||
return LinearGradient(
|
return LinearGradient(
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
import 'package:flutter_test/flutter_test.dart';
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
|
import 'package:flutter/foundation.dart' show kIsWeb;
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
final TestWidgetsFlutterBinding binding =
|
final TestWidgetsFlutterBinding binding =
|
||||||
@ -103,6 +104,11 @@ void main() {
|
|||||||
Rect decoyChildRect = tester.getRect(_findDecoyChild(child));
|
Rect decoyChildRect = tester.getRect(_findDecoyChild(child));
|
||||||
expect(childRect, equals(decoyChildRect));
|
expect(childRect, equals(decoyChildRect));
|
||||||
|
|
||||||
|
// TODO(justinmc): When ShaderMask is supported on web, remove this
|
||||||
|
// conditional and just check for ShaderMask.
|
||||||
|
// https://github.com/flutter/flutter/issues/52967.
|
||||||
|
expect(find.byType(ShaderMask), kIsWeb ? findsNothing : findsOneWidget);
|
||||||
|
|
||||||
// After a small delay, the _DecoyChild has begun to animate.
|
// After a small delay, the _DecoyChild has begun to animate.
|
||||||
await tester.pump(const Duration(milliseconds: 100));
|
await tester.pump(const Duration(milliseconds: 100));
|
||||||
decoyChildRect = tester.getRect(_findDecoyChild(child));
|
decoyChildRect = tester.getRect(_findDecoyChild(child));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user