wonders/lib/ui/wonder_illustrations/common/paint_textures.dart

30 lines
984 B
Dart
Raw Normal View History

2022-08-29 20:38:28 -06:00
import 'package:wonders/common_libs.dart';
class IllustrationTexture extends StatelessWidget {
const IllustrationTexture(this.path,
{super.key, this.scale = 1, this.color, this.flipX = false, this.flipY = false, this.opacity});
2022-08-29 20:38:28 -06:00
final Color? color;
final double scale;
final bool flipX;
final bool flipY;
final String path;
final Animation<double>? opacity;
@override
2022-12-08 16:24:43 -07:00
Widget build(BuildContext context) => AnimatedBuilder(
animation: opacity ?? AlwaysStoppedAnimation(1),
2022-08-29 20:38:28 -06:00
builder: (context, child) => ClipRect(
child: Transform.scale(
scaleX: scale * (flipX ? -1 : 1),
scaleY: scale * (flipY ? -1 : 1),
2022-12-08 16:24:43 -07:00
child: Image.asset(path,
repeat: ImageRepeat.repeat,
fit: BoxFit.contain,
alignment: Alignment.topCenter,
color: color,
opacity: opacity,
cacheWidth: 2048)),
2022-08-29 20:38:28 -06:00
),
);
}