ToneSnap_FSX_Flutter/lib/components/shader_mask.dart
fengshengxiong c7cbdb04be 个人曲库
2024-07-14 16:13:46 +08:00

26 lines
637 B
Dart

// Author: fengshengxiong
// Date: 2024/6/30
// Description: ShaderMaskWidget
import 'package:flutter/material.dart';
class ShaderMaskWidget extends StatelessWidget {
const ShaderMaskWidget({super.key, required this.child});
final Widget child;
@override
Widget build(BuildContext context) {
return ShaderMask(
shaderCallback: (Rect bounds) {
return const LinearGradient(
colors: [Colors.transparent, Colors.white, Colors.white, Colors.transparent],
stops: [0.0, 0.05, 0.95, 1],
).createShader(bounds);
},
blendMode: BlendMode.dstIn,
child: child,
);
}
}