stringWidth method

double stringWidth(
  1. String str
)

Implementation

double stringWidth( String str ){
	ui.ParagraphBuilder builder = ui.ParagraphBuilder(
			ui.ParagraphStyle( textDirection: ui.TextDirection.ltr )
	);
	builder.pushStyle( ui.TextStyle(
			fontSize: _canvasEnv._fontSize,
			fontFamily: _canvasEnv._font
	) );
	builder.addText( str );
	ui.Paragraph paragraph = builder.build();
	paragraph.layout( const ui.ParagraphConstraints( width: 0 ) );
	return paragraph.maxIntrinsicWidth;
}