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

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