public override Widget build(BuildContext context) { SyntaxHighlighterStyle style = Theme.of(context).brightness == Brightness.dark ? SyntaxHighlighterStyle.darkThemeStyle() : SyntaxHighlighterStyle.lightThemeStyle(); Widget body; if (this._exampleCode == null) { body = new Center( child: new CircularProgressIndicator() ); } else { body = new SingleChildScrollView( child: new Padding( padding: EdgeInsets.all(16.0f), child: new RichText( text: new TextSpan( style: new TextStyle(fontFamily: "monospace", fontSize: 10.0f), children: new List <TextSpan> { new DartSyntaxHighlighter(style).format(this._exampleCode) } ) ) ) ); } return(new Scaffold( appBar: new AppBar( leading: new IconButton( icon: new Icon( Icons.clear ), onPressed: () => { Navigator.pop(context); } ), title: new Text("Example code") ), body: body )); }
public DartSyntaxHighlighter(SyntaxHighlighterStyle _style = null) { this._spans = new List <_HighlightSpan> { }; this._style = _style ?? SyntaxHighlighterStyle.darkThemeStyle(); }