Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added highlight_style For easy access to themes #53

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions flutter_highlight/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# [0.7.1]

### Features

- Added `enum HighlightStyle` for convenient access to themes.

# [0.7.0](https://github.com/git-touch/highlight/compare/v0.6.0...v.7.0) (2021-03-07)

### Features
Expand Down
2 changes: 1 addition & 1 deletion flutter_highlight/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class MyWidget extends StatelessWidget {

// Specify highlight theme
// All available themes are listed in `themes` folder
theme: githubTheme,
theme: HighlightStyle.github.theme,

// Specify padding
padding: EdgeInsets.all(12),
Expand Down
2 changes: 2 additions & 0 deletions flutter_highlight/lib/flutter_highlight.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:highlight/highlight.dart' show highlight, Node;

export 'package:flutter_highlight/highlight_style.dart';

/// Highlight Flutter Widget
class HighlightView extends StatelessWidget {
/// The original code to be highlighted
Expand Down
100 changes: 100 additions & 0 deletions flutter_highlight/lib/highlight_style.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
import 'package:flutter/painting.dart';

import 'theme_map.dart';

enum HighlightStyle {
a11yDark,
a11yLight,
agate,
anOldHope,
androidStudio,
arduinoLight,
arta,
ascetic,
atelierCaveDark,
atelierCaveLight,
atelierDuneDark,
atelierDuneLight,
atelierEstuaryDark,
atelierEstuaryLight,
atelierForestDark,
atelierForestLight,
atelierHeathDark,
atelierHeathLight,
atelierLakesideDark,
atelierLakesideLight,
atelierPlateauDark,
atelierPlateauLight,
atelierSavannaDark,
atelierSavannaLight,
atelierSeasideDark,
atelierSeasideLight,
atelierSulphurpoolDark,
atelierSulphurpoolLight,
atomOneDarkReasonable,
atomOneDark,
atomOneLight,
brownPaper,
codepenEmbed,
colorBrewer,
darcula,
dark,
defaultTheme,
docco,
dracula,
far,
foundation,
githubGist,
github,
gml,
googlecode,
gradientDark,
grayscale,
gruvboxDark,
gruvboxLight,
hopscotch,
hybrid,
idea,
irBlack,
isblEditorDark,
isblEditorLight,
kimbieDark,
kimbieLight,
lightfair,
magula,
monoBlue,
monokaiSublime,
monokai,
nightOwl,
nord,
obsidian,
ocean,
paraisoDark,
paraisoLight,
pojoaque,
purebasic,
qtcreatorDark,
qtcreatorLight,
railscasts,
rainbow,
routeros,
schoolBook,
shadesOfPurple,
solarizedDark,
solarizedLight,
sunburst,
tomorrowNightBlue,
tomorrowNightBright,
tomorrowNightEighties,
tomorrowNight,
tomorrow,
vs,
vs2015,
xcode,
xt256,
zenburn,
}

extension HighlightStyleEx on HighlightStyle {
Map<String, TextStyle> get theme => themeMap.values.elementAt(index);
}