26 lines
637 B
Dart
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,
|
|
);
|
|
}
|
|
}
|