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.
You can increase the size of Icon to a required value by assigning the size property with specific double value.
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/
Question is old, but I hope it will help someone.
Before:
Icon(
CupertinoIcons.exclamationmark_circle,
color: Colors.red,
size: 16.0,
)
After (with FontWeight
):
Text(
String.fromCharCode(CupertinoIcons.exclamationmark_circle.codePoint),
style: TextStyle(
inherit: false,
color: Colors.red,
fontSize: 16.0,
fontWeight: FontWeight.w700,
fontFamily: CupertinoIcons.exclamationmark_circle.fontFamily,
package: CupertinoIcons.exclamationmark_circle.fontPackage,
),
)
Of course, your icons should support different weights. Icon from my example supports only 2 weights:
thin <= FontWeight.w500
thick >= FontWeight.w600
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With