All Projects → viztushar → syntax_highlighter

viztushar / syntax_highlighter

Licence: Apache-2.0 license
Syntax Highlighter for Dart/Flutter Code

Programming Languages

dart
5743 projects
objective c
16641 projects - #2 most used programming language
shell
77523 projects
java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to syntax highlighter

Motion-Tab-Bar
A beautiful animated flutter widget package library. The tab bar will attempt to use your current theme out of the box, however you may want to theme it.
Stars: ✭ 237 (+746.43%)
Mutual labels:  flutter-apps, flutter-demo, flutter-package
swipedetector
A Flutter package to detect up, down, left, right swipes.
Stars: ✭ 34 (+21.43%)
Mutual labels:  flutter-apps, flutter-demo, flutter-package
flutter-UI
将Flutter各种Widget各种API📘都实现一次。喜欢请Star。
Stars: ✭ 67 (+139.29%)
Mutual labels:  flutter-apps, flutter-demo, flutter-package
shoppers
Flutter E-Commerce App using Firebase, Razorpay and Stripe
Stars: ✭ 94 (+235.71%)
Mutual labels:  flutter-apps, flutter-demo
glass kit
💎 A package containing widgets to implement glass morphism in flutter apps
Stars: ✭ 50 (+78.57%)
Mutual labels:  flutter-apps, flutter-package
Highlight.js
JavaScript syntax highlighter with language auto-detection and zero dependencies.
Stars: ✭ 19,312 (+68871.43%)
Mutual labels:  syntax-highlighting, syntax-highlighter
see-cli
A colorful 🌈 cat - syntax highlight print CLI
Stars: ✭ 24 (-14.29%)
Mutual labels:  syntax-highlighting, syntax
Sublime Markdown Extended
Top 100 Sublime Text plugin! Markdown syntax highlighter for Sublime Text, with extended support for GFM fenced code blocks, with language-specific syntax highlighting. YAML Front Matter. Works with ST2/ST3. Goes great with Assemble.
Stars: ✭ 645 (+2203.57%)
Mutual labels:  syntax-highlighting, syntax
Nord
An arctic, north-bluish color palette.
Stars: ✭ 4,816 (+17100%)
Mutual labels:  syntax-highlighting, syntax
nord-notepadplusplus
An arctic, north-bluish clean and elegant Notepad++ theme.
Stars: ✭ 112 (+300%)
Mutual labels:  syntax-highlighting, syntax
Syntax Highlighter
Syntax Highlighter extension for Visual Studio Code (VSCode). Based on Tree-sitter.
Stars: ✭ 88 (+214.29%)
Mutual labels:  syntax-highlighting, syntax
Lowlight
Virtual syntax highlighting for virtual DOMs and non-HTML things
Stars: ✭ 310 (+1007.14%)
Mutual labels:  syntax-highlighting, syntax
Nord Jetbrains
An arctic, north-bluish clean and elegant JetBrains IDE UI and editor color theme.
Stars: ✭ 293 (+946.43%)
Mutual labels:  syntax-highlighting, syntax
Knockdown-Flutter
Enough exercises to knockdown the fear of Flutter in you 👊
Stars: ✭ 33 (+17.86%)
Mutual labels:  flutter-apps, flutter-demo
Refractor
Lightweight, robust, elegant virtual syntax highlighting using Prism
Stars: ✭ 291 (+939.29%)
Mutual labels:  syntax-highlighting, syntax
Code Surfer
Rad code slides <🏄/>
Stars: ✭ 5,477 (+19460.71%)
Mutual labels:  syntax-highlighting, syntax
Catage
Node package and CLI tool to convert code into an image with syntax highlighting
Stars: ✭ 44 (+57.14%)
Mutual labels:  syntax-highlighting, syntax
Nord Sublime Text
An arctic, north-bluish clean and elegant Sublime Text theme.
Stars: ✭ 109 (+289.29%)
Mutual labels:  syntax-highlighting, syntax
data examples
An example app showing different ways to pass to and share data with widgets and pages.
Stars: ✭ 56 (+100%)
Mutual labels:  flutter-apps, flutter-demo
fastedit
安卓端高性能输入框。
Stars: ✭ 38 (+35.71%)
Mutual labels:  syntax-highlighting, syntax

syntax_highlighter

syntax highlighter for show your code in the app

How to Use It

Step 2

add your code in your file

String _exampleCode =
      "class MyHomePage extends StatefulWidget { MyHomePage({Key key, this.title}) : super(key: key); final String title; @override _MyHomePageState createState() => _MyHomePageState();}";

Step 2

add SyntaxHighlighterStyle in your build method

final SyntaxHighlighterStyle style =
        Theme.of(context).brightness == Brightness.dark
            ? SyntaxHighlighterStyle.darkThemeStyle()
            : SyntaxHighlighterStyle.lightThemeStyle();

Step 3

add this code

            RichText(
              text: TextSpan(
                style: const TextStyle(fontFamily: 'monospace', fontSize: 10.0),
                children: <TextSpan>[
                  DartSyntaxHighlighter(style).format(_exampleCode),
                ],
              ),

Full Example

check Full Example code in example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:syntax_highlighter/syntax_highlighter.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Syntax Highlighter Example',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: MyHomePage(title: 'Syntax Highlighter Example'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  MyHomePage({Key key, this.title}) : super(key: key);
  final String title;

  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  String _exampleCode =
      "class MyHomePage extends StatefulWidget { MyHomePage({Key key, this.title}) : super(key: key); final String title; @override _MyHomePageState createState() => _MyHomePageState();}";

  @override
  Widget build(BuildContext context) {
    final SyntaxHighlighterStyle style =
        Theme.of(context).brightness == Brightness.dark
            ? SyntaxHighlighterStyle.darkThemeStyle()
            : SyntaxHighlighterStyle.lightThemeStyle();
    return Scaffold(
        appBar: AppBar(
          title: Text(widget.title),
        ),
        body: SingleChildScrollView(
          child: Padding(
            padding: const EdgeInsets.all(16.0),
            child: RichText(
              text: TextSpan(
                style: const TextStyle(fontFamily: 'monospace', fontSize: 10.0),
                children: <TextSpan>[
                  DartSyntaxHighlighter(style).format(_exampleCode),
                ],
              ),
            ),
          ),
        ));
  }
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].