fluttericons

How to add increase /configure weight/boldness (FontWeight) of an Icon in Flutter


I have an Icon (Back Icon to be Specific) in My Flutter App. It Looks Lighter. I Want to Make It Bold/Increase weight for Some Reason.

Container(
    child: Icon(
        Icons.arrow_back,
        color: Color(0xffffffff),
    ),
    padding: EdgeInsets.all(10.0),
    margin: EdgeInsets.fromLTRB(0, 10.0, 0, 0.0),
    decoration: BoxDecoration(
        color: Color(0xff03b673),
        borderRadius: BorderRadius.all(Radius.circular(100.0)),
    ),
)

Can't Find Any Thread/Documentation Regarding it.


Solution

  • icon size

    Container(
    child: Icon(
        Icons.arrow_back,
        color: Color(0xffffffff),
        size: 24.0
     ),
     padding: EdgeInsets.all(10.0),
     margin: EdgeInsets.fromLTRB(0, 10.0, 0, 0.0),
     decoration: BoxDecoration(
        color: Color(0xff03b673),
        borderRadius: BorderRadius.all(Radius.circular(100.0)),
     ),
    )
    

    At the moment,I think there is no fontWeight property on icons. you may import custom icon from fluttericon.com and when you import it under fonts you can set the font weight like this in pubspec.yaml:

    flutter:
     fonts:
     - family: MyIcon
      fonts:
        - asset: lib/fonts/iconfont.ttf
          weight: 400
    

    For complete steps follow this nice article: https://developpaper.com/flutter-taste-1-3-step-use-custom-icon/