Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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'),
    ),
  ),
like image 286
Phanindra Avatar asked Sep 14 '25 04:09

Phanindra


1 Answers

The key hint is to use fit attribute like this:

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

like image 127
Mohsen Emami Avatar answered Sep 15 '25 16:09

Mohsen Emami