Search code examples
androidfluttersvgflutter-dependencies

how to change size of svg image in flutter?


I used flutter_svg: ^0.18.0 to use svg images inside my project. But I cannot find a proper way to change the size of it.

Here's my code:

body: SafeArea(
    child: Center(
      child: SvgPicture.asset('assets/images/morelights.svg'),
    ),
  ),

Solution

  • The key hint is to use fit attribute like this:

    SvgPicture.asset(
          'assets/svg/notification.svg',
          height: 5, width: 5,
          fit: BoxFit.scaleDown
            )