code_highlight

A code_highlight is a plugin for highlight code syntex from code write in string.

There are number of language and themes supported you can just import plugin to your flutter app and implement your code in flutter.

Supported Platforms: 1. Android 2. iOS 3. Web

1. Add dependencies to your project

In your project go to pubspec.yaml and look for dependencies. Under dependencies, add the latest version of code_highlight (use the right numbers from Pub).

dependencies:
  code_highlight: ^[latest_version]

How to implement

import 'package:code_highlight/code_highlight.dart';
import 'package:code_highlight/themes/androidstudio.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';

void main() {
  SystemChrome.setSystemUIOverlayStyle(const SystemUiOverlayStyle(
    systemNavigationBarColor: Colors.transparent,
    systemNavigationBarIconBrightness: Brightness.dark,
    systemNavigationBarDividerColor: Colors.transparent,
    statusBarColor: Colors.transparent,
    statusBarIconBrightness: Brightness.dark,
    statusBarBrightness: Brightness.dark,
  ));
  runApp(const MyWidget());
}

class MyWidget extends StatelessWidget {
  const MyWidget({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    var code = '''
import 'package:flutter/material.dart';

void main() {
  runApp(TechHuntApp());
}

class TechHuntApp extends StatelessWidget{
  Widget build(BuildContext context){
    return MaterialApp(
      home: Center(
        child: Text('Hello World')
      ),
    );
  }
}
''';

    return MaterialApp(
      debugShowCheckedModeBanner: false,
      theme: ThemeData.dark().copyWith(
        scaffoldBackgroundColor: Colors.transparent,
        canvasColor: Colors.transparent,
      ),
      home: Scaffold(
        backgroundColor: Colors.black,
        appBar: AppBar(
          title: const Text('Code Highlight'),
          elevation: 0,
          backgroundColor: Colors.blueAccent,
          systemOverlayStyle: SystemUiOverlayStyle.light.copyWith(
            statusBarColor: Colors.blueAccent,
            statusBarIconBrightness: Brightness.light,
          ),
        ),
        body: Column(
          crossAxisAlignment: CrossAxisAlignment.stretch,
          mainAxisSize: MainAxisSize.max,
          children: [
            Expanded(
              child: HighlightView(
                code,
                language: 'dart',
                theme: androidstudioTheme,
                padding: const EdgeInsets.all(24),
                textStyle: const TextStyle(
                  fontSize: 12,
                ),
              ),
            ),
          ],
        ),
      ),
    );
  }
}

Support

For support, email techhuntdevelopers@gmail.com

Libraries

a11y_dark
a11y_light
abnf
accesslog
actionscript
ada
agate
all
an_old_hope
androidstudio
angelscript
apache
applescript
arcade
arduino
arduino_light
armasm
arta
ascetic
asciidoc
aspectj
atelier_cave_dark
atelier_cave_light
atelier_dune_dark
atelier_dune_light
atelier_estuary_dark
atelier_estuary_light
atelier_forest_dark
atelier_forest_light
atelier_heath_dark
atelier_heath_light
atelier_lakeside_dark
atelier_lakeside_light
atelier_plateau_dark
atelier_plateau_light
atelier_savanna_dark
atelier_savanna_light
atelier_seaside_dark
atelier_seaside_light
atelier_sulphurpool_dark
atelier_sulphurpool_light
atom_one_dark
atom_one_dark_reasonable
atom_one_light
autohotkey
autoit
avrasm
awk
axapta
bash
basic
bnf
brainfuck
brown_paper
cal
capnproto
ceylon
clean
clojure
clojure_repl
cmake
code_highlight
codepen_embed
coffeescript
color_brewer
coq
cos
cpp
crmsh
crystal
cs
csp
css
d
darcula
dark
dart
default
delphi
diff
django
dns
docco
dockerfile
dos
dracula
dsconfig
dts
dust
ebnf
elixir
elm
erb
erlang
erlang_repl
excel
far
fix
flix
fortran
foundation
fsharp
gams
gauss
gcode
gherkin
github
github_gist
glsl
gml
gml
gn
go
golo
googlecode
gradient_dark
gradle
graphql
grayscale
groovy
gruvbox_dark
gruvbox_light
haml
handlebars
haskell
haxe
highlight
highlight_core
hopscotch
hsp
htmlbars
http
hy
hybrid
idea
inform7
ini
ir_black
irpf90
isbl
isbl_editor_dark
isbl_editor_light
java
javascript
jboss_cli
json
julia
julia_repl
kimbie.dark
kimbie.light
kotlin
lasso
ldif
leaf
less
lightfair
lisp
livecodeserver
livescript
llvm
lsl
lua
magula
makefile
markdown
mathematica
matlab
maxima
mel
mercury
mipsasm
mizar
mojolicious
monkey
mono_blue
monokai
monokai_sublime
moonscript
n1ql
nginx
night_owl
nimrod
nix
nord
nsis
objectivec
obsidian
ocaml
ocean
one_c
openscad
oxygene
paraiso_dark
paraiso_light
parser3
perl
pf
pgsql
php
plaintext
pojoaque
pony
powershell
processing
profile
prolog
properties
protobuf
puppet
purebasic
purebasic
python
q
qml
qtcreator_dark
qtcreator_light
r
railscasts
rainbow
reasonml
rib
roboconf
routeros
routeros
rsl
ruby
ruleslanguage
rust
sas
scala
scheme
school_book
scilab
scss
shades_of_purple
shell
smali
smalltalk
sml
solarized_dark
solarized_light
solidity
sqf
sql
stan
stata
step21
stylus
subunit
sunburst
swift
taggerscript
tap
tcl
tex
theme_map
thrift
tomorrow
tomorrow_night
tomorrow_night_blue
tomorrow_night_bright
tomorrow_night_eighties
tp
twig
typescript
vala
vbnet
vbscript
vbscript_html
verilog
vhdl
vim
vs
vs2015
vue
x86asm
xcode
xl
xml
xquery
xt256
yaml
zenburn
zephir