I have tired this but it doesn't work like expected also tired other modes but doesn't match the effect i need.
Stack(
children: [
Container(
color: Colors.white,
height: 50,
width: 50,
),
SvgPicture.asset(
'assets/logo.svg',
ColorFilter.mode(Colors.white, BlendMode.difference),
)
],
)
Add this package: widget_mask. This package contains a class "SaveLayer" we can use like this ->
##You can handle the position of svg as needed.
import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
import 'package:widget_mask/widget_mask.dart';
class BlendTest extends StatelessWidget {
const BlendTest({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.black,
body: SafeArea(
child: Center(
child: SizedBox(
height: 150,
width: 150,
child: Stack(
children: [
Positioned(
top: 0,
left: 0,
child: Container(
height: 100,
width: 100,
color: Colors.white,
),
),
Positioned(
right: 0,
bottom: 0,
child: SaveLayer(
paint: Paint()..blendMode = BlendMode.difference,
child: SizedBox(
height: 100,
width: 100,
child: SvgPicture.asset(
"assets/github.svg",
// colorFilter: const ColorFilter.mode(Colors.white, BlendMode.srcIn),
)
)),
),
],
),
),
)),
);
}
}