0
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_svg/flutter_svg.dart';

class TestScreen extends ConsumerWidget {
  const TestScreen({super.key});

  @override
  Widget build(BuildContext context, WidgetRef ref) {
    return Scaffold(
      body: Center(
        child: SvgPicture.asset(
          'assets/business_card/Frame.svg',
          colorFilter: const ColorFilter.mode(Colors.blue, BlendMode.color),
        ),
      ),
    );
  }
}

when I use this I can change the SVG color from red gradient to blue gradient but I'm getting background color as well. how to remove this background color

This is after i changed the color to blue with BlendMode.coloris the original SVG

I tried BlendMode.srcIn options so I can change the color with a transparent background, but it will be a solid color, not a gradient, so I want to use BlendMode.Color but when I use BlendMode.color I'm getting a background color as well

5
  • At the end of the day this could be a bit of a guessing game as to what you expect, so I'll just link the relevant docs and let you decide. Maybe just src? Commented Feb 22, 2023 at 8:07
  • I want to change the color and keep the gradient so that when I use BlendMode.Color it change with a background color transparent into a solid color i want to keep it transparent Commented Feb 22, 2023 at 8:15
  • this is how it's look when i change color drive.google.com/file/d/1KEkehhjPf1axSeYS_wiOEexCHJKxKrQ4/… Commented Feb 22, 2023 at 8:16
  • Right so I think you want dstIn as a BlendMode Commented Feb 22, 2023 at 13:54
  • Thank you for your replay but not dstIn no change anything it will remain as original here is an image link to explain more clearly what I'm expecting drive.google.com/file/d/1lcjoQOeNrXL78QVX2bdHm85hf4dw3WXf/… Commented Feb 22, 2023 at 14:20

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.