Compare commits
11 Commits
Author | SHA1 | Date | |
---|---|---|---|
81a616157e | |||
52312662fb | |||
ca18d6ade4 | |||
af7cc8dab0 | |||
382e3c4a4c | |||
1e37c6ddae | |||
442ef06147 | |||
606a0d708a | |||
558828f3e0 | |||
09dc7d2a0d | |||
6876d2e7c0 |
13
.roadsignrc
Normal file
13
.roadsignrc
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
{
|
||||||
|
"sync": {
|
||||||
|
"region": "solian",
|
||||||
|
"configPath": "roadsign.toml"
|
||||||
|
},
|
||||||
|
"deployments": [
|
||||||
|
{
|
||||||
|
"region": "solian",
|
||||||
|
"site": "solian-web",
|
||||||
|
"path": "build/web"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
358
assets/highlighting/cpp.json
Normal file
358
assets/highlighting/cpp.json
Normal file
@ -0,0 +1,358 @@
|
|||||||
|
{
|
||||||
|
"name": "C++",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"fileTypes": ["cpp", "hpp", "cc", "h"],
|
||||||
|
"scopeName": "source.cpp",
|
||||||
|
|
||||||
|
"foldingStartMarker": "\\{\\s*$",
|
||||||
|
"foldingStopMarker": "^\\s*\\}",
|
||||||
|
|
||||||
|
"patterns": [
|
||||||
|
{
|
||||||
|
"name": "meta.preprocessor.script.cpp",
|
||||||
|
"match": "^\\s*#\\s*(include|define|if|ifdef|ifndef|else|endif|pragma)\\b"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "meta.declaration.cpp",
|
||||||
|
"begin": "^\\w*\\b(namespace|class|struct|enum|typedef|template)\\b",
|
||||||
|
"beginCaptures": {
|
||||||
|
"0": {
|
||||||
|
"name": "keyword.other.declaration.cpp"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"end": "(\\{|;)",
|
||||||
|
"endCaptures": {
|
||||||
|
"0": {
|
||||||
|
"name": "punctuation.terminator.cpp"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"patterns": [
|
||||||
|
{
|
||||||
|
"include": "#strings"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"include": "#comments"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "keyword.other.cpp",
|
||||||
|
"match": "\\b(public|private|protected|virtual|override|final)\\b"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"include": "#comments"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"include": "#punctuation"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"include": "#annotations"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"include": "#keywords"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"include": "#constants-and-special-vars"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"include": "#operators"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"include": "#strings"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
|
||||||
|
"repository": {
|
||||||
|
"comments": {
|
||||||
|
"patterns": [
|
||||||
|
{
|
||||||
|
"name": "comment.block.empty.cpp",
|
||||||
|
"match": "/\\*\\*/",
|
||||||
|
"captures": {
|
||||||
|
"0": {
|
||||||
|
"name": "punctuation.definition.comment.cpp"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"include": "#comments-doc-oldschool"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"include": "#comments-doc"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"include": "#comments-inline"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"comments-doc-oldschool": {
|
||||||
|
"patterns": [
|
||||||
|
{
|
||||||
|
"name": "comment.block.documentation.cpp",
|
||||||
|
"begin": "/\\*\\*",
|
||||||
|
"end": "\\*/",
|
||||||
|
"patterns": [
|
||||||
|
{
|
||||||
|
"include": "#comments-doc-oldschool"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"include": "#comments-block"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"comments-doc": {
|
||||||
|
"patterns": [
|
||||||
|
{
|
||||||
|
"name": "comment.block.documentation.cpp",
|
||||||
|
"begin": "///",
|
||||||
|
"while": "^\\s*///",
|
||||||
|
"patterns": [
|
||||||
|
{
|
||||||
|
"include": "#comments-inline"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"comments-inline": {
|
||||||
|
"patterns": [
|
||||||
|
{
|
||||||
|
"include": "#comments-block"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"match": "(//.*)$",
|
||||||
|
"captures": {
|
||||||
|
"1": {
|
||||||
|
"name": "comment.line.double-slash.cpp"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"comments-block": {
|
||||||
|
"patterns": [
|
||||||
|
{
|
||||||
|
"name": "comment.block.cpp",
|
||||||
|
"begin": "/\\*",
|
||||||
|
"end": "\\*/",
|
||||||
|
"patterns": [
|
||||||
|
{
|
||||||
|
"include": "#comments-block"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"annotations": {
|
||||||
|
"patterns": [
|
||||||
|
{
|
||||||
|
"name": "storage.type.annotation.cpp",
|
||||||
|
"match": "__attribute__\\(\\w+\\)"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"constants-and-special-vars": {
|
||||||
|
"patterns": [
|
||||||
|
{
|
||||||
|
"name": "constant.language.cpp",
|
||||||
|
"match": "\\b(true|false|nullptr)\\b"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "variable.language.cpp",
|
||||||
|
"match": "\\b(this|super)\\b"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "constant.numeric.cpp",
|
||||||
|
"match": "\\b((0(x|X)[0-9a-fA-F]+)|(([0-9]+\\.?[0-9]*)|(\\.[0-9]+))((e|E)(\\+|-)?[0-9]+)?)\\b"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"include": "#class-identifier"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"include": "#function-identifier"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"class-identifier": {
|
||||||
|
"patterns": [
|
||||||
|
{
|
||||||
|
"match": "\\b(bool|int|char|double|float|long|short|signed|unsigned|void)\\b",
|
||||||
|
"name": "storage.type.primitive.cpp"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"begin": "(\\b[A-Z]\\w*\\b)",
|
||||||
|
"end": "(?!<)",
|
||||||
|
"beginCaptures": {
|
||||||
|
"1": {
|
||||||
|
"name": "support.class.cpp"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"patterns": [
|
||||||
|
{
|
||||||
|
"include": "#type-args"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"function-identifier": {
|
||||||
|
"patterns": [
|
||||||
|
{
|
||||||
|
"match": "\\b([a-z_][a-zA-Z0-9_]*)\\s*\\(",
|
||||||
|
"captures": {
|
||||||
|
"1": {
|
||||||
|
"name": "entity.name.function.cpp"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"type-args": {
|
||||||
|
"begin": "(<)",
|
||||||
|
"end": "(>)",
|
||||||
|
"beginCaptures": {
|
||||||
|
"1": {
|
||||||
|
"name": "other.source.cpp"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"endCaptures": {
|
||||||
|
"1": {
|
||||||
|
"name": "other.source.cpp"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"patterns": [
|
||||||
|
{
|
||||||
|
"include": "#class-identifier"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"match": ","
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "keyword.declaration.cpp",
|
||||||
|
"match": "extends"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"include": "#comments"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"keywords": {
|
||||||
|
"patterns": [
|
||||||
|
{
|
||||||
|
"name": "keyword.control.cpp",
|
||||||
|
"match": "\\b(if|else|for|while|do|switch|case|break|continue|goto|return)\\b"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "keyword.operator.cpp",
|
||||||
|
"match": "\\b(sizeof|typeid|decltype|new|delete)\\b"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "keyword.control.try.cpp",
|
||||||
|
"match": "\\b(try|catch|throw)\\b"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "keyword.control.cpp",
|
||||||
|
"match": "\\b(static|inline|virtual|override|const|volatile|explicit|friend|constexpr)\\b"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"operators": {
|
||||||
|
"patterns": [
|
||||||
|
{
|
||||||
|
"name": "keyword.operator.comparison.cpp",
|
||||||
|
"match": "(==|!=|<=?|>=?)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "keyword.operator.arithmetic.cpp",
|
||||||
|
"match": "(\\+|\\-|\\*|\\/|%)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "keyword.operator.assignment.cpp",
|
||||||
|
"match": "(=|\\+=|-=|\\*=|/=|%=)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "keyword.operator.logical.cpp",
|
||||||
|
"match": "(\\&\\&|\\|\\||!)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "keyword.operator.bitwise.cpp",
|
||||||
|
"match": "(<<|>>|\\&|\\||\\^|~)"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"string-interp": {
|
||||||
|
"patterns": [
|
||||||
|
{
|
||||||
|
"match": "\\$([a-zA-Z0-9_]+)",
|
||||||
|
"captures": {
|
||||||
|
"1": {
|
||||||
|
"name": "variable.parameter.cpp"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "string.interpolated.expression.cpp",
|
||||||
|
"begin": "\\$\\{",
|
||||||
|
"end": "\\}",
|
||||||
|
"patterns": [
|
||||||
|
{
|
||||||
|
"include": "#constants-and-special-vars",
|
||||||
|
"name": "variable.parameter.cpp"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"include": "#strings"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "variable.parameter.cpp",
|
||||||
|
"match": "[a-zA-Z0-9_]+"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "constant.character.escape.cpp",
|
||||||
|
"match": "\\\\."
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"strings": {
|
||||||
|
"patterns": [
|
||||||
|
{
|
||||||
|
"name": "string.quoted.double.cpp",
|
||||||
|
"begin": "\"",
|
||||||
|
"end": "\"",
|
||||||
|
"patterns": [
|
||||||
|
{
|
||||||
|
"name": "constant.character.escape.cpp",
|
||||||
|
"match": "\\\\."
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "string.quoted.single.cpp",
|
||||||
|
"begin": "'",
|
||||||
|
"end": "'",
|
||||||
|
"patterns": [
|
||||||
|
{
|
||||||
|
"name": "constant.character.escape.cpp",
|
||||||
|
"match": "\\\\."
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"punctuation": {
|
||||||
|
"patterns": [
|
||||||
|
{
|
||||||
|
"name": "punctuation.comma.cpp",
|
||||||
|
"match": ","
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "punctuation.terminator.cpp",
|
||||||
|
"match": ";"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
531
assets/highlighting/dart.json
Normal file
531
assets/highlighting/dart.json
Normal file
@ -0,0 +1,531 @@
|
|||||||
|
{
|
||||||
|
"name": "Dart",
|
||||||
|
"version": "1.2.3",
|
||||||
|
"fileTypes": ["dart"],
|
||||||
|
"scopeName": "source.dart",
|
||||||
|
|
||||||
|
"foldingStartMarker": "\\{\\s*$",
|
||||||
|
"foldingStopMarker": "^\\s*\\}",
|
||||||
|
|
||||||
|
"patterns": [
|
||||||
|
{
|
||||||
|
"name": "meta.preprocessor.script.dart",
|
||||||
|
"match": "^(#!.*)$"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "meta.declaration.dart",
|
||||||
|
"begin": "^\\w*\\b(library|import|part of|part|export)\\b",
|
||||||
|
"beginCaptures": {
|
||||||
|
"0": {
|
||||||
|
"name": "keyword.other.import.dart"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"end": ";",
|
||||||
|
"endCaptures": {
|
||||||
|
"0": {
|
||||||
|
"name": "punctuation.terminator.dart"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"patterns": [
|
||||||
|
{
|
||||||
|
"include": "#strings"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"include": "#comments"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "keyword.other.import.dart",
|
||||||
|
"match": "\\b(as|show|hide)\\b"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "keyword.control.dart",
|
||||||
|
"match": "\\b(if)\\b"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"include": "#comments"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"include": "#punctuation"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"include": "#annotations"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"include": "#keywords"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"include": "#constants-and-special-vars"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"include": "#operators"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"include": "#strings"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
|
||||||
|
"repository": {
|
||||||
|
"dartdoc": {
|
||||||
|
"patterns": [
|
||||||
|
{
|
||||||
|
"match": "(\\[.*?\\])",
|
||||||
|
"captures": {
|
||||||
|
"0": {
|
||||||
|
"name": "variable.name.source.dart"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"match": "^ {4,}(?![ \\*]).*",
|
||||||
|
"captures": {
|
||||||
|
"0": {
|
||||||
|
"name": "variable.name.source.dart"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"contentName": "variable.other.source.dart",
|
||||||
|
"begin": "```.*?$",
|
||||||
|
"end": "```"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"match": "(`.*?`)",
|
||||||
|
"captures": {
|
||||||
|
"0": {
|
||||||
|
"name": "variable.other.source.dart"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"match": "(`.*?`)",
|
||||||
|
"captures": {
|
||||||
|
"0": {
|
||||||
|
"name": "variable.other.source.dart"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"match": "(\\* (( ).*))$",
|
||||||
|
"captures": {
|
||||||
|
"2": {
|
||||||
|
"name": "variable.other.source.dart"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"comments": {
|
||||||
|
"patterns": [
|
||||||
|
{
|
||||||
|
"name": "comment.block.empty.dart",
|
||||||
|
"match": "/\\*\\*/",
|
||||||
|
"captures": {
|
||||||
|
"0": {
|
||||||
|
"name": "punctuation.definition.comment.dart"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"include": "#comments-doc-oldschool"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"include": "#comments-doc"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"include": "#comments-inline"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"comments-doc-oldschool": {
|
||||||
|
"patterns": [
|
||||||
|
{
|
||||||
|
"name": "comment.block.documentation.dart",
|
||||||
|
"begin": "/\\*\\*",
|
||||||
|
"end": "\\*/",
|
||||||
|
"patterns": [
|
||||||
|
{
|
||||||
|
"include": "#comments-doc-oldschool"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"include": "#comments-block"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"include": "#dartdoc"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"comments-doc": {
|
||||||
|
"patterns": [
|
||||||
|
{
|
||||||
|
"name": "comment.block.documentation.dart",
|
||||||
|
"begin": "///",
|
||||||
|
"while": "^\\s*///",
|
||||||
|
"patterns": [
|
||||||
|
{
|
||||||
|
"include": "#dartdoc"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"comments-inline": {
|
||||||
|
"patterns": [
|
||||||
|
{
|
||||||
|
"include": "#comments-block"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"match": "((//).*)$",
|
||||||
|
"captures": {
|
||||||
|
"1": {
|
||||||
|
"name": "comment.line.double-slash.dart"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"comments-block": {
|
||||||
|
"patterns": [
|
||||||
|
{
|
||||||
|
"name": "comment.block.dart",
|
||||||
|
"begin": "/\\*",
|
||||||
|
"end": "\\*/",
|
||||||
|
"patterns": [
|
||||||
|
{
|
||||||
|
"include": "#comments-block"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"annotations": {
|
||||||
|
"patterns": [
|
||||||
|
{
|
||||||
|
"name": "storage.type.annotation.dart",
|
||||||
|
"match": "@[a-zA-Z]+"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"constants-and-special-vars": {
|
||||||
|
"patterns": [
|
||||||
|
{
|
||||||
|
"name": "constant.language.dart",
|
||||||
|
"match": "(?<!\\$)\\b(true|false|null)\\b(?!\\$)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "variable.language.dart",
|
||||||
|
"match": "(?<!\\$)\\b(this|super)\\b(?!\\$)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "constant.numeric.dart",
|
||||||
|
"match": "(?<!\\$)\\b((0(x|X)[0-9a-fA-F]*)|(([0-9]+\\.?[0-9]*)|(\\.[0-9]+))((e|E)(\\+|-)?[0-9]+)?)\\b(?!\\$)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"include": "#class-identifier"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"include": "#function-identifier"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"class-identifier": {
|
||||||
|
"patterns": [
|
||||||
|
{
|
||||||
|
"match": "(?<!\\$)\\b(bool|num|int|double|dynamic)\\b(?!\\$)",
|
||||||
|
"name": "support.class.dart"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"match": "(?<!\\$)\\bvoid\\b(?!\\$)",
|
||||||
|
"name": "storage.type.primitive.dart"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"begin": "(?<![a-zA-Z0-9_$])([_$]*[A-Z][a-zA-Z0-9_$]*)\\b",
|
||||||
|
"end": "(?!<)",
|
||||||
|
"beginCaptures": {
|
||||||
|
"1": {
|
||||||
|
"name": "support.class.dart"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"patterns": [
|
||||||
|
{
|
||||||
|
"include": "#type-args"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"function-identifier": {
|
||||||
|
"patterns": [
|
||||||
|
{
|
||||||
|
"match": "([_$]*[a-z][a-zA-Z0-9_$]*)(<(?:[a-zA-Z0-9_$<>?]|,\\s*|\\s+extends\\s+)+>)?[!?]?\\(",
|
||||||
|
"captures": {
|
||||||
|
"1": {
|
||||||
|
"name": "entity.name.function.dart"
|
||||||
|
},
|
||||||
|
"2": {
|
||||||
|
"patterns": [
|
||||||
|
{
|
||||||
|
"include": "#type-args"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"type-args": {
|
||||||
|
"begin": "(<)",
|
||||||
|
"end": "(>)",
|
||||||
|
"beginCaptures": {
|
||||||
|
"1": {
|
||||||
|
"name": "other.source.dart"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"endCaptures": {
|
||||||
|
"1": {
|
||||||
|
"name": "other.source.dart"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"patterns": [
|
||||||
|
{
|
||||||
|
"include": "#class-identifier"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"match": ","
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "keyword.declaration.dart",
|
||||||
|
"match": "extends"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"include": "#comments"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"keywords": {
|
||||||
|
"patterns": [
|
||||||
|
{
|
||||||
|
"name": "keyword.cast.dart",
|
||||||
|
"match": "(?<!\\$)\\bas\\b(?!\\$)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "keyword.control.catch-exception.dart",
|
||||||
|
"match": "(?<!\\$)\\b(try|on|catch|finally|throw|rethrow)\\b(?!\\$)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "keyword.control.dart",
|
||||||
|
"match": "(?<!\\$)\\b(break|case|continue|default|do|else|for|if|in|return|switch|while|when)\\b(?!\\$)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "keyword.control.dart",
|
||||||
|
"match": "(?<!\\$)\\b(sync(\\*)?|async(\\*)?|await|yield(\\*)?)\\b(?!\\$)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "keyword.control.dart",
|
||||||
|
"match": "(?<!\\$)\\bassert\\b(?!\\$)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "keyword.control.new.dart",
|
||||||
|
"match": "(?<!\\$)\\b(new)\\b(?!\\$)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "keyword.declaration.dart",
|
||||||
|
"match": "(?<!\\$)\\b(abstract|sealed|base|interface|class|enum|extends|extension type|extension|external|factory|implements|get(?!\\()|mixin|native|operator|set(?!\\()|typedef|with|covariant)\\b(?!\\$)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "storage.modifier.dart",
|
||||||
|
"match": "(?<!\\$)\\b(static|final|const|required|late)\\b(?!\\$)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "storage.type.primitive.dart",
|
||||||
|
"match": "(?<!\\$)\\b(?:void|var)\\b(?!\\$)"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"operators": {
|
||||||
|
"patterns": [
|
||||||
|
{
|
||||||
|
"name": "keyword.operator.dart",
|
||||||
|
"match": "(?<!\\$)\\b(is\\!?)\\b(?!\\$)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "keyword.operator.ternary.dart",
|
||||||
|
"match": "\\?|:"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "keyword.operator.bitwise.dart",
|
||||||
|
"match": "(<<|>>>?|~|\\^|\\||&)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "keyword.operator.assignment.bitwise.dart",
|
||||||
|
"match": "((&|\\^|\\||<<|>>>?)=)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "keyword.operator.closure.dart",
|
||||||
|
"match": "(=>)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "keyword.operator.comparison.dart",
|
||||||
|
"match": "(==|!=|<=?|>=?)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "keyword.operator.assignment.arithmetic.dart",
|
||||||
|
"match": "(([+*/%-]|\\~)=)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "keyword.operator.assignment.dart",
|
||||||
|
"match": "(=)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "keyword.operator.increment-decrement.dart",
|
||||||
|
"match": "(\\-\\-|\\+\\+)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "keyword.operator.arithmetic.dart",
|
||||||
|
"match": "(\\-|\\+|\\*|\\/|\\~\\/|%)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "keyword.operator.logical.dart",
|
||||||
|
"match": "(!|&&|\\|\\|)"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"string-interp": {
|
||||||
|
"patterns": [
|
||||||
|
{
|
||||||
|
"match": "\\$([a-zA-Z0-9_]+)",
|
||||||
|
"captures": {
|
||||||
|
"1": {
|
||||||
|
"name": "variable.parameter.dart"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "string.interpolated.expression.dart",
|
||||||
|
"begin": "\\$\\{",
|
||||||
|
"end": "\\}",
|
||||||
|
"patterns": [
|
||||||
|
{
|
||||||
|
"include": "#constants-and-special-vars",
|
||||||
|
"name": "variable.parameter.dart"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"include": "#strings"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "variable.parameter.dart",
|
||||||
|
"match": "[a-zA-Z0-9_]+"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "constant.character.escape.dart",
|
||||||
|
"match": "\\\\."
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"strings": {
|
||||||
|
"patterns": [
|
||||||
|
{
|
||||||
|
"name": "string.interpolated.triple.double.dart",
|
||||||
|
"begin": "(?<!r)\"\"\"",
|
||||||
|
"end": "\"\"\"(?!\")",
|
||||||
|
"patterns": [
|
||||||
|
{
|
||||||
|
"include": "#string-interp"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "string.interpolated.triple.single.dart",
|
||||||
|
"begin": "(?<!r)'''",
|
||||||
|
"end": "'''(?!')",
|
||||||
|
"patterns": [
|
||||||
|
{
|
||||||
|
"include": "#string-interp"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "string.quoted.triple.double.dart",
|
||||||
|
"begin": "r\"\"\"",
|
||||||
|
"end": "\"\"\"(?!\")"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "string.quoted.triple.single.dart",
|
||||||
|
"begin": "r'''",
|
||||||
|
"end": "'''(?!')"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "string.interpolated.double.dart",
|
||||||
|
"begin": "(?<!\\|r)\"",
|
||||||
|
"end": "\"",
|
||||||
|
"patterns": [
|
||||||
|
{
|
||||||
|
"name": "invalid.string.newline",
|
||||||
|
"match": "\\n"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"include": "#string-interp"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "string.quoted.double.dart",
|
||||||
|
"begin": "r\"",
|
||||||
|
"end": "\"",
|
||||||
|
"patterns": [
|
||||||
|
{
|
||||||
|
"name": "invalid.string.newline",
|
||||||
|
"match": "\\n"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "string.interpolated.single.dart",
|
||||||
|
"begin": "(?<!\\|r)'",
|
||||||
|
"end": "'",
|
||||||
|
"patterns": [
|
||||||
|
{
|
||||||
|
"name": "invalid.string.newline",
|
||||||
|
"match": "\\n"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"include": "#string-interp"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "string.quoted.single.dart",
|
||||||
|
"begin": "r'",
|
||||||
|
"end": "'",
|
||||||
|
"patterns": [
|
||||||
|
{
|
||||||
|
"name": "invalid.string.newline",
|
||||||
|
"match": "\\n"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"punctuation": {
|
||||||
|
"patterns": [
|
||||||
|
{
|
||||||
|
"name": "punctuation.comma.dart",
|
||||||
|
"match": ","
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "punctuation.terminator.dart",
|
||||||
|
"match": ";"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "punctuation.dot.dart",
|
||||||
|
"match": "\\."
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
212
assets/highlighting/json.json
Normal file
212
assets/highlighting/json.json
Normal file
@ -0,0 +1,212 @@
|
|||||||
|
{
|
||||||
|
"fileTypes": ["json"],
|
||||||
|
"foldingStartMarker": "^\\s*[{\\[](?!.*[}\\]],?\\s*$)|[{\\[]\\s*$",
|
||||||
|
"foldingStopMarker": "^\\s*[}\\]]",
|
||||||
|
"keyEquivalent": "^~J",
|
||||||
|
"name": "JSON (Javascript Next)",
|
||||||
|
"patterns": [
|
||||||
|
{
|
||||||
|
"include": "#value"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"repository": {
|
||||||
|
"array": {
|
||||||
|
"begin": "\\[",
|
||||||
|
"beginCaptures": {
|
||||||
|
"0": {
|
||||||
|
"name": "punctuation.definition.array.begin.json"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"end": "\\]",
|
||||||
|
"endCaptures": {
|
||||||
|
"0": {
|
||||||
|
"name": "punctuation.definition.array.end.json"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"name": "meta.structure.array.json",
|
||||||
|
"patterns": [
|
||||||
|
{
|
||||||
|
"include": "#value"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"match": ",",
|
||||||
|
"name": "punctuation.separator.array.json"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"match": "[^\\s\\]]",
|
||||||
|
"name": "invalid.illegal.expected-array-separator.json"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"comments": {
|
||||||
|
"patterns": [
|
||||||
|
{
|
||||||
|
"begin": "/\\*\\*",
|
||||||
|
"captures": {
|
||||||
|
"0": {
|
||||||
|
"name": "punctuation.definition.comment.json"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"end": "\\*/",
|
||||||
|
"name": "comment.block.documentation.json"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"begin": "/\\*",
|
||||||
|
"captures": {
|
||||||
|
"0": {
|
||||||
|
"name": "punctuation.definition.comment.json"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"end": "\\*/",
|
||||||
|
"name": "comment.block.json"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"captures": {
|
||||||
|
"1": {
|
||||||
|
"name": "punctuation.definition.comment.json"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"match": "(//).*$\\n?",
|
||||||
|
"name": "comment.line.double-slash.js"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"constant": {
|
||||||
|
"match": "\\b(?:true|false|null)\\b",
|
||||||
|
"name": "constant.language.json"
|
||||||
|
},
|
||||||
|
"number": {
|
||||||
|
"match": "-?(?:0|[1-9]\\d*)\n(?:\n(?:\n\\.\\d+)?\n(?:\n[eE][+-]?\\d+)?)?",
|
||||||
|
"name": "constant.numeric.json"
|
||||||
|
},
|
||||||
|
"object": {
|
||||||
|
"begin": "\\{",
|
||||||
|
"beginCaptures": {
|
||||||
|
"0": {
|
||||||
|
"name": "punctuation.definition.dictionary.begin.json"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"end": "\\}",
|
||||||
|
"endCaptures": {
|
||||||
|
"0": {
|
||||||
|
"name": "punctuation.definition.dictionary.end.json"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"name": "meta.structure.dictionary.json",
|
||||||
|
"patterns": [
|
||||||
|
{
|
||||||
|
"comment": "the JSON object key",
|
||||||
|
"include": "#objectkey"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"include": "#comments"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"begin": ":",
|
||||||
|
"beginCaptures": {
|
||||||
|
"0": {
|
||||||
|
"name": "punctuation.separator.dictionary.key-value.json"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"end": "(,)|(?=\\})",
|
||||||
|
"endCaptures": {
|
||||||
|
"1": {
|
||||||
|
"name": "punctuation.separator.dictionary.pair.json"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"name": "meta.structure.dictionary.value.json",
|
||||||
|
"patterns": [
|
||||||
|
{
|
||||||
|
"comment": "the JSON object value",
|
||||||
|
"include": "#value"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"match": "[^\\s,]",
|
||||||
|
"name": "invalid.illegal.expected-dictionary-separator.json"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"match": "[^\\s\\}]",
|
||||||
|
"name": "invalid.illegal.expected-dictionary-separator.json"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"string": {
|
||||||
|
"begin": "\"",
|
||||||
|
"beginCaptures": {
|
||||||
|
"0": {
|
||||||
|
"name": "punctuation.definition.string.begin.json"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"end": "\"",
|
||||||
|
"endCaptures": {
|
||||||
|
"0": {
|
||||||
|
"name": "punctuation.definition.string.end.json"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"name": "string.quoted.double.json",
|
||||||
|
"patterns": [
|
||||||
|
{
|
||||||
|
"include": "#stringcontent"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"objectkey": {
|
||||||
|
"begin": "\"",
|
||||||
|
"beginCaptures": {
|
||||||
|
"0": {
|
||||||
|
"name": "punctuation.support.type.property-name.begin.json"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"end": "\"",
|
||||||
|
"endCaptures": {
|
||||||
|
"0": {
|
||||||
|
"name": "punctuation.support.type.property-name.end.json"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"name": "support.type.property-name.json",
|
||||||
|
"patterns": [
|
||||||
|
{
|
||||||
|
"include": "#stringcontent"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"stringcontent": {
|
||||||
|
"patterns": [
|
||||||
|
{
|
||||||
|
"match": "\\\\(?:[\"\\\\/bfnrt]|u[0-9a-fA-F]{4})",
|
||||||
|
"name": "constant.character.escape.json"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"match": "\\\\.",
|
||||||
|
"name": "invalid.illegal.unrecognized-string-escape.json"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"value": {
|
||||||
|
"patterns": [
|
||||||
|
{
|
||||||
|
"include": "#constant"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"include": "#number"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"include": "#string"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"include": "#array"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"include": "#object"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"include": "#comments"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"scopeName": "source.json",
|
||||||
|
"uuid": "8f97457b-516e-48ce-83c7-08ae12fb327a"
|
||||||
|
}
|
98
assets/highlighting/python.json
Normal file
98
assets/highlighting/python.json
Normal file
@ -0,0 +1,98 @@
|
|||||||
|
{
|
||||||
|
"name": "Python",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"fileTypes": ["py"],
|
||||||
|
"scopeName": "source.python",
|
||||||
|
"foldingStartMarker": "\\b(?:def|class)\\s*[^:]*:\\s*$",
|
||||||
|
"foldingStopMarker": "^\\s*\\}",
|
||||||
|
"patterns": [
|
||||||
|
{ "include": "#comments" },
|
||||||
|
{ "include": "#keywords" },
|
||||||
|
{ "include": "#constants-and-special-vars" },
|
||||||
|
{ "include": "#operators" },
|
||||||
|
{ "include": "#strings" }
|
||||||
|
],
|
||||||
|
"repository": {
|
||||||
|
"comments": {
|
||||||
|
"patterns": [
|
||||||
|
{ "name": "comment.line.hash.python", "match": "#.*$" },
|
||||||
|
{ "name": "comment.block.python", "begin": "'''", "end": "'''" },
|
||||||
|
{ "name": "comment.block.python", "begin": "\"\"\"", "end": "\"\"\"" }
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"keywords": {
|
||||||
|
"patterns": [
|
||||||
|
{
|
||||||
|
"name": "keyword.control.python",
|
||||||
|
"match": "\\b(?:if|else|while|for|in|break|continue|return)\\b"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "keyword.operator.logical.python",
|
||||||
|
"match": "\\b(?:and|or|not)\\b"
|
||||||
|
},
|
||||||
|
{ "name": "keyword.operator.assignment.python", "match": "=" },
|
||||||
|
{ "name": "storage.modifier.python", "match": "\\b(?:def|class)\\b" }
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"constants-and-special-vars": {
|
||||||
|
"patterns": [
|
||||||
|
{
|
||||||
|
"name": "constant.language.python",
|
||||||
|
"match": "\\b(?:True|False|None)\\b"
|
||||||
|
},
|
||||||
|
{ "name": "variable.language.python", "match": "\\b(?:self)\\b" },
|
||||||
|
{
|
||||||
|
"name": "constant.numeric.python",
|
||||||
|
"match": "\\b(?:\\d+\\.?\\d*|\\.\\d+)\\b"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"operators": {
|
||||||
|
"patterns": [
|
||||||
|
{
|
||||||
|
"name": "keyword.operator.arithmetic.python",
|
||||||
|
"match": "\\b(?:\\+|-|\\*|/|%|//)\\b"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "keyword.operator.comparison.python",
|
||||||
|
"match": "\\b(?:==|!=|<|<=|>|>=)\\b"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "keyword.operator.logical.python",
|
||||||
|
"match": "\\b(?:and|or|not)\\b"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"strings": {
|
||||||
|
"patterns": [
|
||||||
|
{
|
||||||
|
"name": "string.quoted.triple.double.python",
|
||||||
|
"begin": "\"\"\"",
|
||||||
|
"end": "\"\"\""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "string.quoted.triple.single.python",
|
||||||
|
"begin": "'''",
|
||||||
|
"end": "'''"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "string.quoted.double.python",
|
||||||
|
"begin": "\"",
|
||||||
|
"end": "\"",
|
||||||
|
"patterns": [{ "include": "#string-escape" }]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "string.quoted.single.python",
|
||||||
|
"begin": "'",
|
||||||
|
"end": "'",
|
||||||
|
"patterns": [{ "include": "#string-escape" }]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"string-escape": {
|
||||||
|
"patterns": [
|
||||||
|
{ "name": "constant.character.escape.python", "match": "\\\\[\"']" }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
145
assets/highlighting/sql.json
Normal file
145
assets/highlighting/sql.json
Normal file
@ -0,0 +1,145 @@
|
|||||||
|
{
|
||||||
|
"fileTypes": ["sql", "ddl", "dml"],
|
||||||
|
"foldingStartMarker": "(?i)^\\s*(begin|if|loop)\\b",
|
||||||
|
"foldingStopMarker": "(?i)^\\s*(end)\\b",
|
||||||
|
"keyEquivalent": "^~S",
|
||||||
|
"name": "PL/pgSQL (Postgres)",
|
||||||
|
"patterns": [
|
||||||
|
{
|
||||||
|
"begin": "/\\*",
|
||||||
|
"end": "\\*/",
|
||||||
|
"name": "comment.block.postgres"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"match": "--.*$",
|
||||||
|
"name": "comment.line.double-dash.postgres"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"captures": {
|
||||||
|
"1": {
|
||||||
|
"name": "keyword.other.postgres"
|
||||||
|
},
|
||||||
|
"2": {
|
||||||
|
"name": "keyword.other.postgres"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"match": "(?i)^\\s*(create)(\\s+or\\s+replace)?\\s+",
|
||||||
|
"name": "meta.create.postgres"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"captures": {
|
||||||
|
"1": {
|
||||||
|
"name": "keyword.other.postgres"
|
||||||
|
},
|
||||||
|
"2": {
|
||||||
|
"name": "keyword.other.postgres"
|
||||||
|
},
|
||||||
|
"3": {
|
||||||
|
"name": "entity.name.type.postgres"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"match": "(?i)\\b(package)(\\s+body)?\\s+(\\S+)",
|
||||||
|
"name": "meta.package.postgres"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"captures": {
|
||||||
|
"1": {
|
||||||
|
"name": "keyword.other.postgres"
|
||||||
|
},
|
||||||
|
"2": {
|
||||||
|
"name": "entity.name.type.postgres"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"match": "(?i)\\b(type)\\s+\"([^\"]+)\"",
|
||||||
|
"name": "meta.type.postgres"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"captures": {
|
||||||
|
"1": {
|
||||||
|
"name": "keyword.other.postgres"
|
||||||
|
},
|
||||||
|
"2": {
|
||||||
|
"name": "entity.name.function.postgres"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"match": "(?i)\\s*(function|procedure)\\s+([-a-z0-9_.]+)",
|
||||||
|
"name": "meta.procedure.postgres"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"match": "[!<>:]?=|<>|<|>|\\+|(?<!\\.)\\*|-|(?<!^)/|@@|\\|\\|",
|
||||||
|
"name": "keyword.operator.postgres"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"match": "(?i)\\b(true|false|null|found)\\b",
|
||||||
|
"name": "constant.language.postgres"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"match": "\\b\\d+(\\.\\d+)?\\b",
|
||||||
|
"name": "constant.numeric.postgres"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"match": "(?i)\\b(if|elsif|else|end\\s+if|loop|end\\s+loop|for|foreach|array|case|end\\s+case|continue|return|goto|alias)\\b",
|
||||||
|
"name": "keyword.control.postgres"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"match": "(?i)\\b(or|and|not|like)\\b",
|
||||||
|
"name": "keyword.operator.postgres"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"match": "(?i)\\b(sysdate|%(isopen|found|notfound|rowcount)|commit|rollback|sqlerrm|substr|cast|decode|length|lower|upper|coalesce)\\b",
|
||||||
|
"name": "support.function.postgres"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"match": "(?i)\\b(avg|count|sum|max|min|nvl|trim|to_date|to_char|lpad|ltrim|rpad|rtrim|trunc|to_number|regexp_split_to_array|regexp_replace)\\b",
|
||||||
|
"name": "support.function.builtin.postgres"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"match": "(?i)\\b(sql|sqlcode)\\b",
|
||||||
|
"name": "variable.language.postgres"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"match": "(?i)\\b(p(i|o|io)_[-a-z0-9_]+)\\b",
|
||||||
|
"name": "variable.parameter.postgres"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"match": "(?i)\\b(l_[-a-z0-9_]+)\\b",
|
||||||
|
"name": "variable.other.postgres"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"match": "(?i)\\b(immutable|volatile|stable|serial|primary|key|references|comment|column|schema|authorization|get|diagnostics|returning|drop|all|raise|notice|warning|exception|external|security|definer|language|grant|execute|on|to|function|procedure|returns|end|then|deterministic|exception|when|others|subtype|constant|range|binary_integer|declare|begin|in|out|is|as|exit|open|fetch|into|close|type|rowtype|default|\\.(extend|count|first|last|next|nextval|currval)|cost|alter|owner)\\b",
|
||||||
|
"name": "keyword.other.postgres"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"match": "(?i)\\b(select|perform|from|where|order\\s+by|group\\s+by|asc|desc|update|set|insert|into|values|delete|from|distinct|union|having|limit|table|of|prepare|(inner|left|outer) join)\\b",
|
||||||
|
"name": "keyword.other.sql.postgres"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"match": "[$][0-9]+",
|
||||||
|
"name": "storage.type.postgres"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"match": "(?i)\\b(dbms_lock|dbms_output)\\b",
|
||||||
|
"name": "support.class.postgres"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"match": "(?i)\\b(put_line)\\b",
|
||||||
|
"name": "support.function.postgres"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"begin": "'",
|
||||||
|
"end": "'",
|
||||||
|
"name": "string.quoted.single.postgres"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"begin": "\"",
|
||||||
|
"end": "\"",
|
||||||
|
"name": "string.quoted.double.postgres"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"match": "(?i)\\b(number|integer|bigint|varchar2|varchar|boolean|date|setof|record|query|numeric|void|character varying|text|([-a-z0-9_.]+%(row)?type))\\b",
|
||||||
|
"name": "storage.type.postgres"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"scopeName": "source.plpgsql.postgres",
|
||||||
|
"uuid": "28DCE4DD-F5E1-4ED3-8847-64DA6B1F9163"
|
||||||
|
}
|
66
assets/highlighting/yaml.json
Normal file
66
assets/highlighting/yaml.json
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
{
|
||||||
|
"name": "YAML",
|
||||||
|
"fileTypes": ["yaml", "yml"],
|
||||||
|
"scopeName": "source.yaml",
|
||||||
|
"patterns": [
|
||||||
|
{
|
||||||
|
"name": "comment.line.number-sign.yaml",
|
||||||
|
"match": "#.*",
|
||||||
|
"captures": {
|
||||||
|
"0": {
|
||||||
|
"name": "punctuation.definition.comment.yaml"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "entity.name.tag.yaml",
|
||||||
|
"match": "^\\s*\\w+",
|
||||||
|
"captures": {
|
||||||
|
"0": {
|
||||||
|
"name": "punctuation.definition.tag.yaml"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "punctuation.separator.key-value.yaml",
|
||||||
|
"match": ":",
|
||||||
|
"captures": {
|
||||||
|
"0": {
|
||||||
|
"name": "punctuation.separator.key-value.yaml"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "string.quoted.double.yaml",
|
||||||
|
"begin": "\"",
|
||||||
|
"end": "\"",
|
||||||
|
"patterns": [
|
||||||
|
{
|
||||||
|
"name": "constant.character.escape.yaml",
|
||||||
|
"match": "\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{6}|.)"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "string.quoted.single.yaml",
|
||||||
|
"begin": "'",
|
||||||
|
"end": "'",
|
||||||
|
"patterns": [
|
||||||
|
{
|
||||||
|
"name": "constant.character.escape.yaml",
|
||||||
|
"match": "''"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"repository": {
|
||||||
|
"scalar-plain": {
|
||||||
|
"patterns": [
|
||||||
|
{
|
||||||
|
"match": "\\b(\\w+)\\b",
|
||||||
|
"name": "scalar.plain.yaml"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,9 +1,12 @@
|
|||||||
|
import 'dart:async';
|
||||||
import 'dart:math';
|
import 'dart:math';
|
||||||
|
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:infinite_scroll_pagination/infinite_scroll_pagination.dart';
|
import 'package:infinite_scroll_pagination/infinite_scroll_pagination.dart';
|
||||||
|
import 'package:solian/models/attachment.dart';
|
||||||
import 'package:solian/models/pagination.dart';
|
import 'package:solian/models/pagination.dart';
|
||||||
import 'package:solian/models/post.dart';
|
import 'package:solian/models/post.dart';
|
||||||
|
import 'package:solian/providers/content/attachment.dart';
|
||||||
import 'package:solian/providers/content/posts.dart';
|
import 'package:solian/providers/content/posts.dart';
|
||||||
import 'package:solian/providers/last_read.dart';
|
import 'package:solian/providers/last_read.dart';
|
||||||
|
|
||||||
@ -31,9 +34,18 @@ class PostListController extends GetxController {
|
|||||||
pagingController.addPageRequestListener(_onPagingControllerRequest);
|
pagingController.addPageRequestListener(_onPagingControllerRequest);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Completer<void>? _pagingLoadCompleter;
|
||||||
|
|
||||||
Future<void> _onPagingControllerRequest(int pageKey) async {
|
Future<void> _onPagingControllerRequest(int pageKey) async {
|
||||||
try {
|
try {
|
||||||
|
if (_pagingLoadCompleter != null) {
|
||||||
|
await _pagingLoadCompleter!.future;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_pagingLoadCompleter = Completer();
|
||||||
final result = await loadMore();
|
final result = await loadMore();
|
||||||
|
_pagingLoadCompleter!.complete();
|
||||||
|
_pagingLoadCompleter = null;
|
||||||
|
|
||||||
if (result != null && hasMore.value) {
|
if (result != null && hasMore.value) {
|
||||||
pagingController.appendPage(result, nextPageKey.value);
|
pagingController.appendPage(result, nextPageKey.value);
|
||||||
@ -97,9 +109,6 @@ class PostListController extends GetxController {
|
|||||||
hasMore.value = false;
|
hasMore.value = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
final idx = <dynamic>{};
|
|
||||||
postList.retainWhere((x) => idx.add(x.id));
|
|
||||||
|
|
||||||
if (postList.isNotEmpty) {
|
if (postList.isNotEmpty) {
|
||||||
var lastId = postList.map((x) => x.id).reduce(max);
|
var lastId = postList.map((x) => x.id).reduce(max);
|
||||||
Get.find<LastReadProvider>().feedLastReadAt = lastId;
|
Get.find<LastReadProvider>().feedLastReadAt = lastId;
|
||||||
@ -111,35 +120,39 @@ class PostListController extends GetxController {
|
|||||||
Future<List<Post>?> _loadPosts(int pageKey) async {
|
Future<List<Post>?> _loadPosts(int pageKey) async {
|
||||||
isBusy.value = true;
|
isBusy.value = true;
|
||||||
|
|
||||||
final PostProvider provider = Get.find();
|
final PostProvider posts = Get.find();
|
||||||
|
|
||||||
Response resp;
|
Response resp;
|
||||||
try {
|
try {
|
||||||
if (author != null) {
|
if (author != null) {
|
||||||
resp = await provider.listPost(
|
resp = await posts.listPost(
|
||||||
pageKey,
|
pageKey,
|
||||||
author: author,
|
author: author,
|
||||||
|
take: 10,
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
switch (mode.value) {
|
switch (mode.value) {
|
||||||
case 2:
|
case 2:
|
||||||
resp = await provider.listRecommendations(
|
resp = await posts.listRecommendations(
|
||||||
pageKey,
|
pageKey,
|
||||||
channel: 'shuffle',
|
channel: 'shuffle',
|
||||||
realm: realm,
|
realm: realm,
|
||||||
|
take: 10,
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
resp = await provider.listRecommendations(
|
resp = await posts.listRecommendations(
|
||||||
pageKey,
|
pageKey,
|
||||||
channel: 'friends',
|
channel: 'friends',
|
||||||
realm: realm,
|
realm: realm,
|
||||||
|
take: 10,
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
resp = await provider.listRecommendations(
|
resp = await posts.listRecommendations(
|
||||||
pageKey,
|
pageKey,
|
||||||
realm: realm,
|
realm: realm,
|
||||||
|
take: 10,
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -153,6 +166,27 @@ class PostListController extends GetxController {
|
|||||||
final result = PaginationResult.fromJson(resp.body);
|
final result = PaginationResult.fromJson(resp.body);
|
||||||
final out = result.data?.map((e) => Post.fromJson(e)).toList();
|
final out = result.data?.map((e) => Post.fromJson(e)).toList();
|
||||||
|
|
||||||
|
final AttachmentProvider attach = Get.find();
|
||||||
|
|
||||||
|
if (out != null) {
|
||||||
|
final attachmentIds = out
|
||||||
|
.mapMany((x) => x.body['attachments'] ?? [])
|
||||||
|
.cast<String>()
|
||||||
|
.toSet()
|
||||||
|
.toList();
|
||||||
|
final attachmentOut = await attach.listMetadata(attachmentIds);
|
||||||
|
|
||||||
|
for (var idx = 0; idx < out.length; idx++) {
|
||||||
|
final rids = List<String>.from(out[idx].body['attachments'] ?? []);
|
||||||
|
out[idx].preload = PostPreload(
|
||||||
|
attachments: attachmentOut
|
||||||
|
.where((x) => x != null && rids.contains(x.rid))
|
||||||
|
.cast<Attachment>()
|
||||||
|
.toList(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
postTotal.value = result.count;
|
postTotal.value = result.count;
|
||||||
|
|
||||||
return out;
|
return out;
|
||||||
|
@ -1,10 +1,19 @@
|
|||||||
import 'package:json_annotation/json_annotation.dart';
|
import 'package:json_annotation/json_annotation.dart';
|
||||||
import 'package:solian/models/account.dart';
|
import 'package:solian/models/account.dart';
|
||||||
|
import 'package:solian/models/attachment.dart';
|
||||||
import 'package:solian/models/post_categories.dart';
|
import 'package:solian/models/post_categories.dart';
|
||||||
import 'package:solian/models/realm.dart';
|
import 'package:solian/models/realm.dart';
|
||||||
|
|
||||||
part 'post.g.dart';
|
part 'post.g.dart';
|
||||||
|
|
||||||
|
class PostPreload {
|
||||||
|
List<Attachment> attachments;
|
||||||
|
|
||||||
|
PostPreload({
|
||||||
|
required this.attachments,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
@JsonSerializable()
|
@JsonSerializable()
|
||||||
class Post {
|
class Post {
|
||||||
int id;
|
int id;
|
||||||
@ -33,6 +42,9 @@ class Post {
|
|||||||
Account author;
|
Account author;
|
||||||
PostMetric? metric;
|
PostMetric? metric;
|
||||||
|
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
PostPreload? preload;
|
||||||
|
|
||||||
Post({
|
Post({
|
||||||
required this.id,
|
required this.id,
|
||||||
required this.createdAt,
|
required this.createdAt,
|
||||||
|
@ -125,7 +125,7 @@ class AuthProvider extends GetConnect {
|
|||||||
userAgent: await ServiceFinder.getUserAgent(),
|
userAgent: await ServiceFinder.getUserAgent(),
|
||||||
sendUserAgent: true,
|
sendUserAgent: true,
|
||||||
);
|
);
|
||||||
client.httpClient.addAuthenticator(requestAuthenticator);
|
client.httpClient.addRequestModifier(requestAuthenticator);
|
||||||
client.httpClient.baseUrl = ServiceFinder.buildUrl(service, null);
|
client.httpClient.baseUrl = ServiceFinder.buildUrl(service, null);
|
||||||
|
|
||||||
return client;
|
return client;
|
||||||
|
@ -41,25 +41,27 @@ class AttachmentProvider extends GetConnect {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final resp = await get(
|
if (pendingQuery.isNotEmpty) {
|
||||||
'/attachments?take=${pendingQuery.length}&id=${pendingQuery.join(',')}',
|
final resp = await get(
|
||||||
);
|
'/attachments?take=${pendingQuery.length}&id=${pendingQuery.join(',')}',
|
||||||
if (resp.statusCode != 200) return result;
|
);
|
||||||
|
if (resp.statusCode != 200) return result;
|
||||||
|
|
||||||
final rawOut = PaginationResult.fromJson(resp.body);
|
final rawOut = PaginationResult.fromJson(resp.body);
|
||||||
if (rawOut.data == null) return result;
|
if (rawOut.data == null) return result;
|
||||||
|
|
||||||
final List<Attachment> out =
|
final List<Attachment> out =
|
||||||
rawOut.data!.map((x) => Attachment.fromJson(x)).toList();
|
rawOut.data!.map((x) => Attachment.fromJson(x)).toList();
|
||||||
for (final item in out) {
|
for (final item in out) {
|
||||||
if (item.destination != 0 && item.isAnalyzed) {
|
if (item.destination != 0 && item.isAnalyzed) {
|
||||||
_cachedResponses[item.rid] = item;
|
_cachedResponses[item.rid] = item;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
for (var i = 0; i < out.length; i++) {
|
||||||
for (var i = 0; i < out.length; i++) {
|
for (var j = 0; j < rid.length; j++) {
|
||||||
for (var j = 0; j < rid.length; j++) {
|
if (out[i].rid == rid[j]) {
|
||||||
if (out[i].rid == rid[j]) {
|
result[j] = out[i];
|
||||||
result[j] = out[i];
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,22 +3,11 @@ import 'package:solian/exceptions/request.dart';
|
|||||||
import 'package:solian/exceptions/unauthorized.dart';
|
import 'package:solian/exceptions/unauthorized.dart';
|
||||||
import 'package:solian/models/post.dart';
|
import 'package:solian/models/post.dart';
|
||||||
import 'package:solian/providers/auth.dart';
|
import 'package:solian/providers/auth.dart';
|
||||||
import 'package:solian/services.dart';
|
|
||||||
|
|
||||||
class PostProvider extends GetConnect {
|
|
||||||
@override
|
|
||||||
void onInit() {
|
|
||||||
httpClient.baseUrl = ServiceFinder.buildUrl('interactive', null);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
class PostProvider extends GetxController {
|
||||||
Future<Response> seeWhatsNew(int pivot) async {
|
Future<Response> seeWhatsNew(int pivot) async {
|
||||||
GetConnect client;
|
|
||||||
final AuthProvider auth = Get.find();
|
final AuthProvider auth = Get.find();
|
||||||
if (auth.isAuthorized.value) {
|
final client = await auth.configureClient('co');
|
||||||
client = await auth.configureClient('co');
|
|
||||||
} else {
|
|
||||||
client = await ServiceFinder.configureClient('co');
|
|
||||||
}
|
|
||||||
final resp = await client.get('/whats-new?pivot=$pivot');
|
final resp = await client.get('/whats-new?pivot=$pivot');
|
||||||
if (resp.statusCode != 200) {
|
if (resp.statusCode != 200) {
|
||||||
throw RequestException(resp);
|
throw RequestException(resp);
|
||||||
@ -28,19 +17,14 @@ class PostProvider extends GetConnect {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<Response> listRecommendations(int page,
|
Future<Response> listRecommendations(int page,
|
||||||
{String? realm, String? channel}) async {
|
{String? realm, String? channel, int take = 10}) async {
|
||||||
GetConnect client;
|
|
||||||
final AuthProvider auth = Get.find();
|
|
||||||
final queries = [
|
final queries = [
|
||||||
'take=${10}',
|
'take=$take',
|
||||||
'offset=$page',
|
'offset=$page',
|
||||||
if (realm != null) 'realm=$realm',
|
if (realm != null) 'realm=$realm',
|
||||||
];
|
];
|
||||||
if (auth.isAuthorized.value) {
|
final AuthProvider auth = Get.find();
|
||||||
client = await auth.configureClient('co');
|
final client = await auth.configureClient('interactive');
|
||||||
} else {
|
|
||||||
client = await ServiceFinder.configureClient('co');
|
|
||||||
}
|
|
||||||
final resp = await client.get(
|
final resp = await client.get(
|
||||||
channel == null
|
channel == null
|
||||||
? '/recommendations?${queries.join('&')}'
|
? '/recommendations?${queries.join('&')}'
|
||||||
@ -71,16 +55,18 @@ class PostProvider extends GetConnect {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<Response> listPost(int page,
|
Future<Response> listPost(int page,
|
||||||
{String? realm, String? author, tag, category}) async {
|
{String? realm, String? author, tag, category, int take = 10}) async {
|
||||||
final queries = [
|
final queries = [
|
||||||
'take=${10}',
|
'take=$take',
|
||||||
'offset=$page',
|
'offset=$page',
|
||||||
if (tag != null) 'tag=$tag',
|
if (tag != null) 'tag=$tag',
|
||||||
if (category != null) 'category=$category',
|
if (category != null) 'category=$category',
|
||||||
if (author != null) 'author=$author',
|
if (author != null) 'author=$author',
|
||||||
if (realm != null) 'realm=$realm',
|
if (realm != null) 'realm=$realm',
|
||||||
];
|
];
|
||||||
final resp = await get('/posts?${queries.join('&')}');
|
final AuthProvider auth = Get.find();
|
||||||
|
final client = await auth.configureClient('co');
|
||||||
|
final resp = await client.get('/posts?${queries.join('&')}');
|
||||||
if (resp.statusCode != 200) {
|
if (resp.statusCode != 200) {
|
||||||
throw RequestException(resp);
|
throw RequestException(resp);
|
||||||
}
|
}
|
||||||
@ -89,7 +75,10 @@ class PostProvider extends GetConnect {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<Response> listPostReplies(String alias, int page) async {
|
Future<Response> listPostReplies(String alias, int page) async {
|
||||||
final resp = await get('/posts/$alias/replies?take=${10}&offset=$page');
|
final AuthProvider auth = Get.find();
|
||||||
|
final client = await auth.configureClient('co');
|
||||||
|
final resp =
|
||||||
|
await client.get('/posts/$alias/replies?take=${10}&offset=$page');
|
||||||
if (resp.statusCode != 200) {
|
if (resp.statusCode != 200) {
|
||||||
throw RequestException(resp);
|
throw RequestException(resp);
|
||||||
}
|
}
|
||||||
@ -98,7 +87,9 @@ class PostProvider extends GetConnect {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<List<Post>> listPostFeaturedReply(String alias, {int take = 1}) async {
|
Future<List<Post>> listPostFeaturedReply(String alias, {int take = 1}) async {
|
||||||
final resp = await get('/posts/$alias/replies/featured?take=$take');
|
final AuthProvider auth = Get.find();
|
||||||
|
final client = await auth.configureClient('co');
|
||||||
|
final resp = await client.get('/posts/$alias/replies/featured?take=$take');
|
||||||
if (resp.statusCode != 200) {
|
if (resp.statusCode != 200) {
|
||||||
throw RequestException(resp);
|
throw RequestException(resp);
|
||||||
}
|
}
|
||||||
@ -107,16 +98,9 @@ class PostProvider extends GetConnect {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<Response> getPost(String alias) async {
|
Future<Response> getPost(String alias) async {
|
||||||
final resp = await get('/posts/$alias');
|
final AuthProvider auth = Get.find();
|
||||||
if (resp.statusCode != 200) {
|
final client = await auth.configureClient('co');
|
||||||
throw RequestException(resp);
|
final resp = await client.get('/posts/$alias');
|
||||||
}
|
|
||||||
|
|
||||||
return resp;
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<Response> getArticle(String alias) async {
|
|
||||||
final resp = await get('/articles/$alias');
|
|
||||||
if (resp.statusCode != 200) {
|
if (resp.statusCode != 200) {
|
||||||
throw RequestException(resp);
|
throw RequestException(resp);
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,6 @@ import 'package:solian/widgets/app_bar_leading.dart';
|
|||||||
import 'package:solian/widgets/attachments/attachment_list.dart';
|
import 'package:solian/widgets/attachments/attachment_list.dart';
|
||||||
import 'package:solian/widgets/daily_sign/history_chart.dart';
|
import 'package:solian/widgets/daily_sign/history_chart.dart';
|
||||||
import 'package:solian/widgets/posts/post_list.dart';
|
import 'package:solian/widgets/posts/post_list.dart';
|
||||||
import 'package:solian/widgets/posts/post_warped_list.dart';
|
|
||||||
import 'package:solian/widgets/reports/abuse_report.dart';
|
import 'package:solian/widgets/reports/abuse_report.dart';
|
||||||
import 'package:solian/widgets/root_container.dart';
|
import 'package:solian/widgets/root_container.dart';
|
||||||
import 'package:solian/widgets/sized_container.dart';
|
import 'package:solian/widgets/sized_container.dart';
|
||||||
@ -609,7 +608,7 @@ class _AccountProfilePageState extends State<AccountProfilePage> {
|
|||||||
child: Center(child: CircularProgressIndicator()),
|
child: Center(child: CircularProgressIndicator()),
|
||||||
),
|
),
|
||||||
if (_userinfo != null)
|
if (_userinfo != null)
|
||||||
PostWarpedListWidget(
|
ControlledPostListWidget(
|
||||||
isPinned: false,
|
isPinned: false,
|
||||||
controller: _postController.pagingController,
|
controller: _postController.pagingController,
|
||||||
onUpdate: () => _postController.reloadAllOver(),
|
onUpdate: () => _postController.reloadAllOver(),
|
||||||
|
@ -69,6 +69,8 @@ class _ChatListState extends State<ChatList> {
|
|||||||
|
|
||||||
late final ChannelProvider _channels = Get.find();
|
late final ChannelProvider _channels = Get.find();
|
||||||
|
|
||||||
|
bool _isBusy = true;
|
||||||
|
|
||||||
List<Channel> _sortChannels(List<Channel> channels) {
|
List<Channel> _sortChannels(List<Channel> channels) {
|
||||||
channels.sort(
|
channels.sort(
|
||||||
(a, b) =>
|
(a, b) =>
|
||||||
@ -117,18 +119,25 @@ class _ChatListState extends State<ChatList> {
|
|||||||
final ctrl = ChatEventController();
|
final ctrl = ChatEventController();
|
||||||
await ctrl.initialize();
|
await ctrl.initialize();
|
||||||
final messages = await ctrl.src.getLastInAllChannels();
|
final messages = await ctrl.src.getLastInAllChannels();
|
||||||
setState(() {
|
if (mounted) {
|
||||||
_lastMessages = messages
|
setState(() {
|
||||||
.map((k, v) => MapEntry(k, v.firstOrNull))
|
_lastMessages = messages
|
||||||
.cast<int, LocalMessageEventTableData>();
|
.map((k, v) => MapEntry(k, v.firstOrNull))
|
||||||
});
|
.cast<int, LocalMessageEventTableData>();
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
_loadLastMessages().then((_) {
|
_loadLastMessages().then((_) {
|
||||||
_loadAllChannels();
|
if (!mounted) return;
|
||||||
|
_loadAllChannels().then((_) {
|
||||||
|
if (mounted) {
|
||||||
|
setState(() => _isBusy = false);
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -143,16 +152,7 @@ class _ChatListState extends State<ChatList> {
|
|||||||
child: ResponsiveRootContainer(
|
child: ResponsiveRootContainer(
|
||||||
child: Scaffold(
|
child: Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
leading: Obx(() {
|
leading: AppBarLeadingButton.adaptive(context),
|
||||||
final adaptive = AppBarLeadingButton.adaptive(context);
|
|
||||||
if (adaptive != null) return adaptive;
|
|
||||||
if (_channels.isLoading.value) {
|
|
||||||
return const CircularProgressIndicator(
|
|
||||||
strokeWidth: 3,
|
|
||||||
).paddingAll(18);
|
|
||||||
}
|
|
||||||
return const SizedBox.shrink();
|
|
||||||
}),
|
|
||||||
title: AppBarTitle('chat'.tr),
|
title: AppBarTitle('chat'.tr),
|
||||||
centerTitle: true,
|
centerTitle: true,
|
||||||
toolbarHeight: AppTheme.toolbarHeight(context),
|
toolbarHeight: AppTheme.toolbarHeight(context),
|
||||||
@ -280,6 +280,26 @@ class _ChatListState extends State<ChatList> {
|
|||||||
return Column(
|
return Column(
|
||||||
children: [
|
children: [
|
||||||
const ChatCallCurrentIndicator(),
|
const ChatCallCurrentIndicator(),
|
||||||
|
if (_isBusy)
|
||||||
|
Container(
|
||||||
|
color: Theme.of(context)
|
||||||
|
.colorScheme
|
||||||
|
.surfaceContainerLow
|
||||||
|
.withOpacity(0.8),
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
const SizedBox(
|
||||||
|
height: 16,
|
||||||
|
width: 16,
|
||||||
|
child: CircularProgressIndicator(strokeWidth: 2.5),
|
||||||
|
),
|
||||||
|
const Gap(8),
|
||||||
|
Text('loading'.tr)
|
||||||
|
],
|
||||||
|
).paddingSymmetric(vertical: 8),
|
||||||
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: TabBarView(
|
child: TabBarView(
|
||||||
children: [
|
children: [
|
||||||
|
@ -75,10 +75,12 @@ class _DashboardScreenState extends State<DashboardScreen> {
|
|||||||
final src = Get.find<MessagesFetchingProvider>();
|
final src = Get.find<MessagesFetchingProvider>();
|
||||||
final out = await src.getWhatsNewEvents(_lastRead.messagesLastReadAt!);
|
final out = await src.getWhatsNewEvents(_lastRead.messagesLastReadAt!);
|
||||||
if (out == null) return;
|
if (out == null) return;
|
||||||
setState(() {
|
if (mounted) {
|
||||||
_currentMessages = out.$1;
|
setState(() {
|
||||||
_currentMessagesCount = out.$2;
|
_currentMessages = out.$1;
|
||||||
});
|
_currentMessagesCount = out.$2;
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool _signingDaily = true;
|
bool _signingDaily = true;
|
||||||
@ -89,13 +91,17 @@ class _DashboardScreenState extends State<DashboardScreen> {
|
|||||||
try {
|
try {
|
||||||
_signRecord = await _dailySign.getToday();
|
_signRecord = await _dailySign.getToday();
|
||||||
_dailySign.listLastRecord(14).then((value) {
|
_dailySign.listLastRecord(14).then((value) {
|
||||||
setState(() => _signRecordHistory = value);
|
if (mounted) {
|
||||||
|
setState(() => _signRecordHistory = value);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
context.showErrorDialog(e);
|
context.showErrorDialog(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
setState(() => _signingDaily = false);
|
if (mounted) {
|
||||||
|
setState(() => _signingDaily = false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _signDaily() async {
|
Future<void> _signDaily() async {
|
||||||
|
@ -13,8 +13,8 @@ import 'package:solian/widgets/account/signin_required_overlay.dart';
|
|||||||
import 'package:solian/widgets/current_state_action.dart';
|
import 'package:solian/widgets/current_state_action.dart';
|
||||||
import 'package:solian/widgets/app_bar_leading.dart';
|
import 'package:solian/widgets/app_bar_leading.dart';
|
||||||
import 'package:solian/widgets/navigation/realm_switcher.dart';
|
import 'package:solian/widgets/navigation/realm_switcher.dart';
|
||||||
|
import 'package:solian/widgets/posts/post_list.dart';
|
||||||
import 'package:solian/widgets/posts/post_shuffle_swiper.dart';
|
import 'package:solian/widgets/posts/post_shuffle_swiper.dart';
|
||||||
import 'package:solian/widgets/posts/post_warped_list.dart';
|
|
||||||
import 'package:solian/widgets/root_container.dart';
|
import 'package:solian/widgets/root_container.dart';
|
||||||
|
|
||||||
class ExploreScreen extends StatefulWidget {
|
class ExploreScreen extends StatefulWidget {
|
||||||
@ -80,62 +80,85 @@ class _ExploreScreenState extends State<ExploreScreen>
|
|||||||
body: NestedScrollView(
|
body: NestedScrollView(
|
||||||
headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) {
|
headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) {
|
||||||
return [
|
return [
|
||||||
SliverAppBar(
|
SliverLayoutBuilder(
|
||||||
flexibleSpace: SizedBox(
|
builder: (context, constraints) {
|
||||||
height: 48,
|
final scrollOffset = constraints.scrollOffset;
|
||||||
child: const Row(
|
final colorChangeOffset = 120;
|
||||||
children: [
|
|
||||||
RealmSwitcher(),
|
final scrollProgress =
|
||||||
|
(scrollOffset / colorChangeOffset).clamp(0.0, 1.0);
|
||||||
|
final backgroundColor = Color.lerp(
|
||||||
|
Theme.of(context)
|
||||||
|
.colorScheme
|
||||||
|
.surfaceContainerLow
|
||||||
|
.withOpacity(0),
|
||||||
|
Theme.of(context)
|
||||||
|
.colorScheme
|
||||||
|
.surfaceContainerLow
|
||||||
|
.withOpacity(0.9),
|
||||||
|
scrollProgress,
|
||||||
|
);
|
||||||
|
|
||||||
|
return SliverAppBar(
|
||||||
|
backgroundColor: backgroundColor,
|
||||||
|
flexibleSpace: SizedBox(
|
||||||
|
height: 48,
|
||||||
|
child: const Row(
|
||||||
|
children: [
|
||||||
|
RealmSwitcher(),
|
||||||
|
],
|
||||||
|
).paddingSymmetric(horizontal: 8),
|
||||||
|
).paddingOnly(top: MediaQuery.of(context).padding.top),
|
||||||
|
snap: true,
|
||||||
|
floating: true,
|
||||||
|
toolbarHeight: AppTheme.toolbarHeight(context),
|
||||||
|
leading: AppBarLeadingButton.adaptive(context),
|
||||||
|
actions: [
|
||||||
|
const BackgroundStateWidget(),
|
||||||
|
const NotificationButton(),
|
||||||
|
SizedBox(
|
||||||
|
width: AppTheme.isLargeScreen(context) ? 8 : 16,
|
||||||
|
),
|
||||||
],
|
],
|
||||||
).paddingSymmetric(horizontal: 8),
|
bottom: TabBar(
|
||||||
).paddingOnly(top: MediaQuery.of(context).padding.top),
|
controller: _tabController,
|
||||||
floating: true,
|
dividerHeight: 0.3,
|
||||||
toolbarHeight: AppTheme.toolbarHeight(context),
|
tabAlignment: TabAlignment.fill,
|
||||||
leading: AppBarLeadingButton.adaptive(context),
|
tabs: [
|
||||||
actions: [
|
Tab(
|
||||||
const BackgroundStateWidget(),
|
child: Row(
|
||||||
const NotificationButton(),
|
mainAxisSize: MainAxisSize.min,
|
||||||
SizedBox(
|
children: [
|
||||||
width: AppTheme.isLargeScreen(context) ? 8 : 16,
|
const Icon(Icons.feed, size: 20),
|
||||||
),
|
const Gap(8),
|
||||||
],
|
Text('postListNews'.tr),
|
||||||
bottom: TabBar(
|
],
|
||||||
controller: _tabController,
|
),
|
||||||
dividerHeight: 0.3,
|
),
|
||||||
tabAlignment: TabAlignment.fill,
|
Tab(
|
||||||
tabs: [
|
child: Row(
|
||||||
Tab(
|
mainAxisSize: MainAxisSize.min,
|
||||||
child: Row(
|
children: [
|
||||||
mainAxisSize: MainAxisSize.min,
|
const Icon(Icons.people, size: 20),
|
||||||
children: [
|
const Gap(8),
|
||||||
const Icon(Icons.feed, size: 20),
|
Text('postListFriends'.tr),
|
||||||
const Gap(8),
|
],
|
||||||
Text('postListNews'.tr),
|
),
|
||||||
],
|
),
|
||||||
),
|
Tab(
|
||||||
|
child: Row(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
const Icon(Icons.shuffle_on_outlined, size: 20),
|
||||||
|
const Gap(8),
|
||||||
|
Text('postListShuffle'.tr),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
Tab(
|
);
|
||||||
child: Row(
|
},
|
||||||
mainAxisSize: MainAxisSize.min,
|
|
||||||
children: [
|
|
||||||
const Icon(Icons.people, size: 20),
|
|
||||||
const Gap(8),
|
|
||||||
Text('postListFriends'.tr),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Tab(
|
|
||||||
child: Row(
|
|
||||||
mainAxisSize: MainAxisSize.min,
|
|
||||||
children: [
|
|
||||||
const Icon(Icons.shuffle_on_outlined, size: 20),
|
|
||||||
const Gap(8),
|
|
||||||
Text('postListShuffle'.tr),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
)
|
)
|
||||||
];
|
];
|
||||||
},
|
},
|
||||||
@ -156,7 +179,7 @@ class _ExploreScreenState extends State<ExploreScreen>
|
|||||||
RefreshIndicator(
|
RefreshIndicator(
|
||||||
onRefresh: () => _postController.reloadAllOver(),
|
onRefresh: () => _postController.reloadAllOver(),
|
||||||
child: CustomScrollView(slivers: [
|
child: CustomScrollView(slivers: [
|
||||||
PostWarpedListWidget(
|
ControlledPostListWidget(
|
||||||
controller: _postController.pagingController,
|
controller: _postController.pagingController,
|
||||||
onUpdate: () => _postController.reloadAllOver(),
|
onUpdate: () => _postController.reloadAllOver(),
|
||||||
),
|
),
|
||||||
@ -167,7 +190,7 @@ class _ExploreScreenState extends State<ExploreScreen>
|
|||||||
return RefreshIndicator(
|
return RefreshIndicator(
|
||||||
onRefresh: () => _postController.reloadAllOver(),
|
onRefresh: () => _postController.reloadAllOver(),
|
||||||
child: CustomScrollView(slivers: [
|
child: CustomScrollView(slivers: [
|
||||||
PostWarpedListWidget(
|
ControlledPostListWidget(
|
||||||
controller: _postController.pagingController,
|
controller: _postController.pagingController,
|
||||||
onUpdate: () => _postController.reloadAllOver(),
|
onUpdate: () => _postController.reloadAllOver(),
|
||||||
),
|
),
|
||||||
|
@ -3,7 +3,7 @@ import 'package:get/get.dart';
|
|||||||
import 'package:infinite_scroll_pagination/infinite_scroll_pagination.dart';
|
import 'package:infinite_scroll_pagination/infinite_scroll_pagination.dart';
|
||||||
import 'package:solian/models/pagination.dart';
|
import 'package:solian/models/pagination.dart';
|
||||||
import 'package:solian/providers/content/posts.dart';
|
import 'package:solian/providers/content/posts.dart';
|
||||||
import 'package:solian/widgets/posts/post_warped_list.dart';
|
import 'package:solian/widgets/posts/post_list.dart';
|
||||||
|
|
||||||
import '../../models/post.dart';
|
import '../../models/post.dart';
|
||||||
|
|
||||||
@ -77,7 +77,7 @@ class _FeedSearchScreenState extends State<FeedSearchScreen> {
|
|||||||
onRefresh: () => Future.sync(() => _pagingController.refresh()),
|
onRefresh: () => Future.sync(() => _pagingController.refresh()),
|
||||||
child: CustomScrollView(
|
child: CustomScrollView(
|
||||||
slivers: [
|
slivers: [
|
||||||
PostWarpedListWidget(
|
ControlledPostListWidget(
|
||||||
controller: _pagingController,
|
controller: _pagingController,
|
||||||
onUpdate: () => _pagingController.refresh(),
|
onUpdate: () => _pagingController.refresh(),
|
||||||
),
|
),
|
||||||
|
@ -273,116 +273,69 @@ class _PostPublishScreenState extends State<PostPublishScreen> {
|
|||||||
),
|
),
|
||||||
if (_isBusy) const LinearProgressIndicator().animate().scaleX(),
|
if (_isBusy) const LinearProgressIndicator().animate().scaleX(),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Row(
|
child: DefaultTabController(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
length: 2,
|
||||||
children: [
|
child: AppTheme.isLargeScreen(context)
|
||||||
Expanded(
|
? Row(
|
||||||
child: Column(
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
child: ListView(
|
child: _PostEditorTextField(
|
||||||
children: [
|
focusNode: _contentFocusNode,
|
||||||
Container(
|
controller: _editorController,
|
||||||
padding: const EdgeInsets.symmetric(
|
onUpdate: () => setState(() {}),
|
||||||
horizontal: 16,
|
),
|
||||||
vertical: 8,
|
),
|
||||||
),
|
const VerticalDivider(width: 0.3, thickness: 0.3)
|
||||||
child: TextField(
|
.paddingSymmetric(horizontal: 16),
|
||||||
maxLines: null,
|
Expanded(
|
||||||
autofocus: true,
|
child: SingleChildScrollView(
|
||||||
autocorrect: true,
|
padding:
|
||||||
keyboardType: TextInputType.multiline,
|
const EdgeInsets.only(top: 12, bottom: 64),
|
||||||
controller:
|
child: MarkdownTextContent(
|
||||||
_editorController.contentController,
|
isAutoWarp: _editorController.mode.value == 0,
|
||||||
focusNode: _contentFocusNode,
|
content:
|
||||||
decoration: InputDecoration.collapsed(
|
_editorController.contentController.text,
|
||||||
hintText: 'postContentPlaceholder'.tr,
|
parentId: 'post-editor-preview',
|
||||||
),
|
).paddingOnly(right: 16),
|
||||||
onTapOutside: (_) => FocusManager
|
),
|
||||||
.instance.primaryFocus
|
),
|
||||||
?.unfocus(),
|
],
|
||||||
),
|
)
|
||||||
),
|
: Column(
|
||||||
const Gap(120)
|
children: [
|
||||||
|
TabBar(
|
||||||
|
tabs: [
|
||||||
|
const Tab(icon: Icon(Icons.edit)),
|
||||||
|
const Tab(icon: Icon(Icons.preview)),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
Expanded(
|
||||||
Obx(() {
|
child: TabBarView(
|
||||||
final textStyle = TextStyle(
|
|
||||||
fontSize: 12,
|
|
||||||
color: Theme.of(context)
|
|
||||||
.colorScheme
|
|
||||||
.onSurface
|
|
||||||
.withOpacity(0.75),
|
|
||||||
);
|
|
||||||
final showFactors = [
|
|
||||||
_editorController.isRestoreFromLocal.value,
|
|
||||||
_editorController.lastSaveTime.value != null,
|
|
||||||
];
|
|
||||||
final doShow = showFactors.any((x) => x);
|
|
||||||
return Container(
|
|
||||||
padding: const EdgeInsets.symmetric(
|
|
||||||
vertical: 4,
|
|
||||||
horizontal: 16,
|
|
||||||
),
|
|
||||||
child: Row(
|
|
||||||
children: [
|
children: [
|
||||||
if (showFactors[0])
|
_PostEditorTextField(
|
||||||
Text('postRestoreFromLocal'.tr,
|
focusNode: _contentFocusNode,
|
||||||
style: textStyle)
|
controller: _editorController,
|
||||||
.paddingOnly(right: 4),
|
onUpdate: () => setState(() {}),
|
||||||
if (showFactors[0])
|
),
|
||||||
InkWell(
|
SingleChildScrollView(
|
||||||
child: Text('clear'.tr, style: textStyle),
|
padding: const EdgeInsets.only(
|
||||||
onTap: () {
|
top: 12,
|
||||||
_editorController.localClear();
|
bottom: 64,
|
||||||
_editorController.currentClear();
|
|
||||||
setState(() {});
|
|
||||||
},
|
|
||||||
),
|
|
||||||
if (showFactors.where((x) => x).length > 1)
|
|
||||||
Text(
|
|
||||||
'·',
|
|
||||||
style: textStyle,
|
|
||||||
).paddingSymmetric(horizontal: 8),
|
|
||||||
if (showFactors[1])
|
|
||||||
Text(
|
|
||||||
'postAutoSaveAt'.trParams({
|
|
||||||
'date': DateFormat('HH:mm:ss').format(
|
|
||||||
_editorController.lastSaveTime.value ??
|
|
||||||
DateTime.now(),
|
|
||||||
)
|
|
||||||
}),
|
|
||||||
style: textStyle,
|
|
||||||
),
|
),
|
||||||
|
child: MarkdownTextContent(
|
||||||
|
isAutoWarp:
|
||||||
|
_editorController.mode.value == 0,
|
||||||
|
content: _editorController
|
||||||
|
.contentController.text,
|
||||||
|
parentId: 'post-editor-preview',
|
||||||
|
).paddingOnly(left: 16, right: 16),
|
||||||
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
)
|
),
|
||||||
.animate(
|
],
|
||||||
key: const Key('post-editor-hint-animation'),
|
|
||||||
target: doShow ? 1 : 0,
|
|
||||||
)
|
|
||||||
.fade(curve: Curves.easeInOut, duration: 300.ms);
|
|
||||||
}),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
if (AppTheme.isLargeScreen(context))
|
|
||||||
const VerticalDivider(width: 0.3, thickness: 0.3)
|
|
||||||
.paddingSymmetric(
|
|
||||||
horizontal: 16,
|
|
||||||
),
|
|
||||||
if (AppTheme.isLargeScreen(context))
|
|
||||||
Expanded(
|
|
||||||
child: SingleChildScrollView(
|
|
||||||
child: MarkdownTextContent(
|
|
||||||
isAutoWarp: _editorController.mode.value == 0,
|
|
||||||
content: _editorController.contentController.text,
|
|
||||||
parentId: 'post-editor-preview',
|
|
||||||
).paddingOnly(top: 12, right: 16),
|
|
||||||
),
|
),
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Material(
|
Material(
|
||||||
@ -391,6 +344,26 @@ class _PostPublishScreenState extends State<PostPublishScreen> {
|
|||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
const Divider(thickness: 0.3, height: 0.3),
|
const Divider(thickness: 0.3, height: 0.3),
|
||||||
|
SizedBox(
|
||||||
|
height: 40,
|
||||||
|
child: SingleChildScrollView(
|
||||||
|
scrollDirection: Axis.horizontal,
|
||||||
|
child: MarkdownToolbar(
|
||||||
|
width: 38,
|
||||||
|
height: 38,
|
||||||
|
iconSize: 20,
|
||||||
|
spacing: 8,
|
||||||
|
hideImage: true,
|
||||||
|
useIncludedTextField: false,
|
||||||
|
backgroundColor: Theme.of(context).colorScheme.surface,
|
||||||
|
iconColor: Theme.of(context).colorScheme.onSurface,
|
||||||
|
controller: _editorController.contentController,
|
||||||
|
focusNode: _contentFocusNode,
|
||||||
|
borderRadius:
|
||||||
|
const BorderRadius.all(Radius.circular(20)),
|
||||||
|
).paddingSymmetric(horizontal: 12),
|
||||||
|
),
|
||||||
|
).paddingOnly(top: 12),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: 56,
|
height: 56,
|
||||||
child: ListView(
|
child: ListView(
|
||||||
@ -520,7 +493,7 @@ class _PostPublishScreenState extends State<PostPublishScreen> {
|
|||||||
top: -4,
|
top: -4,
|
||||||
end: -6,
|
end: -6,
|
||||||
),
|
),
|
||||||
child: const Icon(Icons.preview),
|
child: const Icon(Icons.wallpaper),
|
||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
color: Theme.of(context).colorScheme.primary,
|
color: Theme.of(context).colorScheme.primary,
|
||||||
@ -547,18 +520,6 @@ class _PostPublishScreenState extends State<PostPublishScreen> {
|
|||||||
_editorController.editPublishDate(context);
|
_editorController.editPublishDate(context);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
MarkdownToolbar(
|
|
||||||
hideImage: true,
|
|
||||||
useIncludedTextField: false,
|
|
||||||
backgroundColor:
|
|
||||||
Theme.of(context).colorScheme.surface,
|
|
||||||
iconColor: Theme.of(context).colorScheme.onSurface,
|
|
||||||
controller: _editorController.contentController,
|
|
||||||
focusNode: _contentFocusNode,
|
|
||||||
borderRadius:
|
|
||||||
const BorderRadius.all(Radius.circular(20)),
|
|
||||||
width: 40,
|
|
||||||
).paddingSymmetric(horizontal: 2),
|
|
||||||
],
|
],
|
||||||
).paddingSymmetric(horizontal: 6, vertical: 8),
|
).paddingSymmetric(horizontal: 6, vertical: 8),
|
||||||
),
|
),
|
||||||
@ -578,3 +539,101 @@ class _PostPublishScreenState extends State<PostPublishScreen> {
|
|||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class _PostEditorTextField extends StatelessWidget {
|
||||||
|
final FocusNode focusNode;
|
||||||
|
final PostEditorController controller;
|
||||||
|
final Function onUpdate;
|
||||||
|
|
||||||
|
const _PostEditorTextField({
|
||||||
|
required this.focusNode,
|
||||||
|
required this.controller,
|
||||||
|
required this.onUpdate,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Column(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: ListView(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
padding: const EdgeInsets.symmetric(
|
||||||
|
horizontal: 16,
|
||||||
|
vertical: 8,
|
||||||
|
),
|
||||||
|
child: TextField(
|
||||||
|
maxLines: null,
|
||||||
|
autofocus: true,
|
||||||
|
autocorrect: true,
|
||||||
|
keyboardType: TextInputType.multiline,
|
||||||
|
controller: controller.contentController,
|
||||||
|
focusNode: focusNode,
|
||||||
|
decoration: InputDecoration.collapsed(
|
||||||
|
hintText: 'postContentPlaceholder'.tr,
|
||||||
|
),
|
||||||
|
onTapOutside: (_) =>
|
||||||
|
FocusManager.instance.primaryFocus?.unfocus(),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const Gap(120)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Obx(() {
|
||||||
|
final textStyle = TextStyle(
|
||||||
|
fontSize: 12,
|
||||||
|
color: Theme.of(context).colorScheme.onSurface.withOpacity(0.75),
|
||||||
|
);
|
||||||
|
final showFactors = [
|
||||||
|
controller.isRestoreFromLocal.value,
|
||||||
|
controller.lastSaveTime.value != null,
|
||||||
|
];
|
||||||
|
final doShow = showFactors.any((x) => x);
|
||||||
|
return Container(
|
||||||
|
padding: const EdgeInsets.symmetric(
|
||||||
|
vertical: 4,
|
||||||
|
horizontal: 16,
|
||||||
|
),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
if (showFactors[0])
|
||||||
|
Text('postRestoreFromLocal'.tr, style: textStyle)
|
||||||
|
.paddingOnly(right: 4),
|
||||||
|
if (showFactors[0])
|
||||||
|
InkWell(
|
||||||
|
child: Text('clear'.tr, style: textStyle),
|
||||||
|
onTap: () {
|
||||||
|
controller.localClear();
|
||||||
|
controller.currentClear();
|
||||||
|
onUpdate();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
if (showFactors.where((x) => x).length > 1)
|
||||||
|
Text(
|
||||||
|
'·',
|
||||||
|
style: textStyle,
|
||||||
|
).paddingSymmetric(horizontal: 8),
|
||||||
|
if (showFactors[1])
|
||||||
|
Text(
|
||||||
|
'postAutoSaveAt'.trParams({
|
||||||
|
'date': DateFormat('HH:mm:ss').format(
|
||||||
|
controller.lastSaveTime.value ?? DateTime.now(),
|
||||||
|
)
|
||||||
|
}),
|
||||||
|
style: textStyle,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)
|
||||||
|
.animate(
|
||||||
|
key: const Key('post-editor-hint-animation'),
|
||||||
|
target: doShow ? 1 : 0,
|
||||||
|
)
|
||||||
|
.fade(curve: Curves.easeInOut, duration: 300.ms);
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -49,6 +49,7 @@ class RootShell extends StatelessWidget {
|
|||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
key: rootScaffoldKey,
|
key: rootScaffoldKey,
|
||||||
|
backgroundColor: Theme.of(context).colorScheme.surface,
|
||||||
bottomNavigationBar: showBottomNavigation
|
bottomNavigationBar: showBottomNavigation
|
||||||
? AppNavigationBottom(
|
? AppNavigationBottom(
|
||||||
initialIndex: destNames.indexOf(routeName ?? 'page'),
|
initialIndex: destNames.indexOf(routeName ?? 'page'),
|
||||||
|
@ -15,7 +15,8 @@ import 'package:solian/widgets/sized_container.dart';
|
|||||||
|
|
||||||
class AttachmentList extends StatefulWidget {
|
class AttachmentList extends StatefulWidget {
|
||||||
final String parentId;
|
final String parentId;
|
||||||
final List<String> attachmentsId;
|
final List<String>? attachmentIds;
|
||||||
|
final List<Attachment>? attachments;
|
||||||
final bool isGrid;
|
final bool isGrid;
|
||||||
final bool isColumn;
|
final bool isColumn;
|
||||||
final bool isForceGrid;
|
final bool isForceGrid;
|
||||||
@ -29,7 +30,8 @@ class AttachmentList extends StatefulWidget {
|
|||||||
const AttachmentList({
|
const AttachmentList({
|
||||||
super.key,
|
super.key,
|
||||||
required this.parentId,
|
required this.parentId,
|
||||||
required this.attachmentsId,
|
this.attachmentIds,
|
||||||
|
this.attachments,
|
||||||
this.isGrid = false,
|
this.isGrid = false,
|
||||||
this.isColumn = false,
|
this.isColumn = false,
|
||||||
this.isForceGrid = false,
|
this.isForceGrid = false,
|
||||||
@ -50,21 +52,21 @@ class _AttachmentListState extends State<AttachmentList> {
|
|||||||
|
|
||||||
double _aspectRatio = 1;
|
double _aspectRatio = 1;
|
||||||
|
|
||||||
List<Attachment?> _attachmentsMeta = List.empty();
|
List<Attachment?> _attachments = List.empty();
|
||||||
|
|
||||||
void _getMetadataList() {
|
void _getMetadataList() {
|
||||||
final AttachmentProvider attach = Get.find();
|
final AttachmentProvider attach = Get.find();
|
||||||
|
|
||||||
if (widget.attachmentsId.isEmpty) {
|
if (widget.attachmentIds?.isEmpty ?? false) {
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
_attachmentsMeta = List.filled(widget.attachmentsId.length, null);
|
_attachments = List.filled(widget.attachmentIds!.length, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
attach.listMetadata(widget.attachmentsId).then((result) {
|
attach.listMetadata(widget.attachmentIds!).then((result) {
|
||||||
if (mounted) {
|
if (mounted) {
|
||||||
setState(() {
|
setState(() {
|
||||||
_attachmentsMeta = result;
|
_attachments = result;
|
||||||
_isLoading = false;
|
_isLoading = false;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -76,7 +78,7 @@ class _AttachmentListState extends State<AttachmentList> {
|
|||||||
bool isConsistent = true;
|
bool isConsistent = true;
|
||||||
double? consistentValue;
|
double? consistentValue;
|
||||||
int portrait = 0, square = 0, landscape = 0;
|
int portrait = 0, square = 0, landscape = 0;
|
||||||
for (var entry in _attachmentsMeta) {
|
for (var entry in _attachments) {
|
||||||
if (entry == null) continue;
|
if (entry == null) continue;
|
||||||
if (entry.metadata?['ratio'] != null) {
|
if (entry.metadata?['ratio'] != null) {
|
||||||
if (entry.metadata?['ratio'] is int) {
|
if (entry.metadata?['ratio'] is int) {
|
||||||
@ -117,10 +119,9 @@ class _AttachmentListState extends State<AttachmentList> {
|
|||||||
item: element,
|
item: element,
|
||||||
parentId: widget.parentId,
|
parentId: widget.parentId,
|
||||||
width: width ?? widget.width,
|
width: width ?? widget.width,
|
||||||
badgeContent: '${idx + 1}/${_attachmentsMeta.length}',
|
badgeContent: '${idx + 1}/${_attachments.length}',
|
||||||
showBadge:
|
showBadge: _attachments.length > 1 && !widget.isGrid && !widget.isColumn,
|
||||||
_attachmentsMeta.length > 1 && !widget.isGrid && !widget.isColumn,
|
showBorder: _attachments.length > 1,
|
||||||
showBorder: widget.attachmentsId.length > 1,
|
|
||||||
showMature: _showMature,
|
showMature: _showMature,
|
||||||
autoload: widget.autoload,
|
autoload: widget.autoload,
|
||||||
onReveal: (value) {
|
onReveal: (value) {
|
||||||
@ -132,7 +133,16 @@ class _AttachmentListState extends State<AttachmentList> {
|
|||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
_getMetadataList();
|
assert(widget.attachmentIds != null || widget.attachments != null);
|
||||||
|
if (widget.attachments == null) {
|
||||||
|
_getMetadataList();
|
||||||
|
} else {
|
||||||
|
setState(() {
|
||||||
|
_attachments = widget.attachments!;
|
||||||
|
_isLoading = false;
|
||||||
|
});
|
||||||
|
_calculateAspectRatio();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Color get _unFocusColor =>
|
Color get _unFocusColor =>
|
||||||
@ -140,7 +150,7 @@ class _AttachmentListState extends State<AttachmentList> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
if (widget.attachmentsId.isEmpty) {
|
if (widget.attachmentIds?.isEmpty ?? widget.attachments!.isEmpty) {
|
||||||
return const SizedBox.shrink();
|
return const SizedBox.shrink();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -154,7 +164,7 @@ class _AttachmentListState extends State<AttachmentList> {
|
|||||||
).paddingOnly(right: 5),
|
).paddingOnly(right: 5),
|
||||||
Text(
|
Text(
|
||||||
'attachmentHint'.trParams(
|
'attachmentHint'.trParams(
|
||||||
{'count': widget.attachmentsId.length.toString()},
|
{'count': _attachments.toString()},
|
||||||
),
|
),
|
||||||
style: TextStyle(color: _unFocusColor, fontSize: 12),
|
style: TextStyle(color: _unFocusColor, fontSize: 12),
|
||||||
)
|
)
|
||||||
@ -171,8 +181,8 @@ class _AttachmentListState extends State<AttachmentList> {
|
|||||||
return Wrap(
|
return Wrap(
|
||||||
spacing: 8,
|
spacing: 8,
|
||||||
runSpacing: 8,
|
runSpacing: 8,
|
||||||
children: widget.attachmentsId.map((x) {
|
children: _attachments.map((x) {
|
||||||
final element = _attachmentsMeta[idx];
|
final element = _attachments[idx];
|
||||||
idx++;
|
idx++;
|
||||||
if (element == null) return const SizedBox.shrink();
|
if (element == null) return const SizedBox.shrink();
|
||||||
double ratio = element.metadata?['ratio']?.toDouble() ?? 16 / 9;
|
double ratio = element.metadata?['ratio']?.toDouble() ?? 16 / 9;
|
||||||
@ -202,7 +212,7 @@ class _AttachmentListState extends State<AttachmentList> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
final isNotPureImage = _attachmentsMeta.any(
|
final isNotPureImage = _attachments.any(
|
||||||
(x) => x?.mimetype.split('/').firstOrNull != 'image',
|
(x) => x?.mimetype.split('/').firstOrNull != 'image',
|
||||||
);
|
);
|
||||||
if (widget.isGrid && (widget.isForceGrid || !isNotPureImage)) {
|
if (widget.isGrid && (widget.isForceGrid || !isNotPureImage)) {
|
||||||
@ -213,13 +223,13 @@ class _AttachmentListState extends State<AttachmentList> {
|
|||||||
physics: const NeverScrollableScrollPhysics(),
|
physics: const NeverScrollableScrollPhysics(),
|
||||||
shrinkWrap: true,
|
shrinkWrap: true,
|
||||||
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
||||||
crossAxisCount: math.min(3, widget.attachmentsId.length),
|
crossAxisCount: math.min(3, _attachments.length),
|
||||||
mainAxisSpacing: 8.0,
|
mainAxisSpacing: 8.0,
|
||||||
crossAxisSpacing: 8.0,
|
crossAxisSpacing: 8.0,
|
||||||
),
|
),
|
||||||
itemCount: widget.attachmentsId.length,
|
itemCount: _attachments.length,
|
||||||
itemBuilder: (context, idx) {
|
itemBuilder: (context, idx) {
|
||||||
final element = _attachmentsMeta[idx];
|
final element = _attachments[idx];
|
||||||
return Container(
|
return Container(
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: Theme.of(context).colorScheme.surfaceContainerHigh,
|
color: Theme.of(context).colorScheme.surfaceContainerHigh,
|
||||||
@ -257,12 +267,12 @@ class _AttachmentListState extends State<AttachmentList> {
|
|||||||
animateToClosest: true,
|
animateToClosest: true,
|
||||||
aspectRatio: _aspectRatio,
|
aspectRatio: _aspectRatio,
|
||||||
viewportFraction:
|
viewportFraction:
|
||||||
widget.viewport ?? (widget.attachmentsId.length > 1 ? 0.95 : 1),
|
widget.viewport ?? (_attachments.length > 1 ? 0.95 : 1),
|
||||||
enableInfiniteScroll: false,
|
enableInfiniteScroll: false,
|
||||||
),
|
),
|
||||||
itemCount: _attachmentsMeta.length,
|
itemCount: _attachments.length,
|
||||||
itemBuilder: (context, idx, _) {
|
itemBuilder: (context, idx, _) {
|
||||||
final element = _attachmentsMeta[idx];
|
final element = _attachments[idx];
|
||||||
return _buildEntry(element, idx);
|
return _buildEntry(element, idx);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
@ -78,7 +78,7 @@ class ChatEvent extends StatelessWidget {
|
|||||||
child: AttachmentList(
|
child: AttachmentList(
|
||||||
key: Key('m${item.uuid}attachments'),
|
key: Key('m${item.uuid}attachments'),
|
||||||
parentId: item.uuid,
|
parentId: item.uuid,
|
||||||
attachmentsId: attachments,
|
attachmentIds: attachments,
|
||||||
isColumn: true,
|
isColumn: true,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
@ -1,12 +1,16 @@
|
|||||||
|
import 'dart:ui';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_markdown_selectionarea/flutter_markdown.dart';
|
import 'package:flutter_markdown/flutter_markdown.dart';
|
||||||
import 'package:gap/gap.dart';
|
import 'package:gap/gap.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
import 'package:google_fonts/google_fonts.dart';
|
||||||
import 'package:markdown/markdown.dart' as markdown;
|
import 'package:markdown/markdown.dart' as markdown;
|
||||||
import 'package:markdown/markdown.dart';
|
import 'package:path/path.dart';
|
||||||
import 'package:solian/providers/stickers.dart';
|
import 'package:solian/providers/stickers.dart';
|
||||||
import 'package:solian/widgets/attachments/attachment_list.dart';
|
import 'package:solian/widgets/attachments/attachment_list.dart';
|
||||||
import 'package:solian/widgets/auto_cache_image.dart';
|
import 'package:solian/widgets/auto_cache_image.dart';
|
||||||
|
import 'package:syntax_highlight/syntax_highlight.dart';
|
||||||
import 'package:url_launcher/url_launcher_string.dart';
|
import 'package:url_launcher/url_launcher_string.dart';
|
||||||
|
|
||||||
import 'account/account_profile_popup.dart';
|
import 'account/account_profile_popup.dart';
|
||||||
@ -39,15 +43,6 @@ class MarkdownTextContent extends StatelessWidget {
|
|||||||
// Getting paragraph
|
// Getting paragraph
|
||||||
var paragraph = paragraphs[idx];
|
var paragraph = paragraphs[idx];
|
||||||
|
|
||||||
// Auto adding new-lines
|
|
||||||
if (isAutoWarp) {
|
|
||||||
paragraph = paragraph.replaceAll('\n', '\\\n');
|
|
||||||
}
|
|
||||||
const charactersToTrim = '\\\n\t\r ';
|
|
||||||
final trimPattern =
|
|
||||||
RegExp('^[$charactersToTrim]+|[$charactersToTrim]+\$');
|
|
||||||
paragraph = paragraph.trim().replaceAll(trimPattern, '');
|
|
||||||
|
|
||||||
// Matching stickers
|
// Matching stickers
|
||||||
final stickerMatch = stickerRegex.allMatches(paragraph);
|
final stickerMatch = stickerRegex.allMatches(paragraph);
|
||||||
final isOnlySticker =
|
final isOnlySticker =
|
||||||
@ -62,31 +57,48 @@ class MarkdownTextContent extends StatelessWidget {
|
|||||||
styleSheet: MarkdownStyleSheet.fromTheme(
|
styleSheet: MarkdownStyleSheet.fromTheme(
|
||||||
Theme.of(context),
|
Theme.of(context),
|
||||||
).copyWith(
|
).copyWith(
|
||||||
textScaleFactor: isLargeText ? 1.1 : 1,
|
textScaler: TextScaler.linear(isLargeText ? 1.1 : 1),
|
||||||
blockquote: TextStyle(
|
blockquote: TextStyle(
|
||||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||||
),
|
),
|
||||||
blockquoteDecoration: BoxDecoration(
|
blockquoteDecoration: BoxDecoration(
|
||||||
color: Theme.of(context).colorScheme.surfaceContainerHigh,
|
color: Theme.of(context).colorScheme.surfaceContainerHigh,
|
||||||
borderRadius: const BorderRadius.all(Radius.circular(4)),
|
borderRadius: const BorderRadius.all(Radius.circular(4)),
|
||||||
),
|
),
|
||||||
horizontalRuleDecoration: BoxDecoration(
|
horizontalRuleDecoration: BoxDecoration(
|
||||||
border: Border(
|
border: Border(
|
||||||
top: BorderSide(
|
top: BorderSide(
|
||||||
width: 1.0,
|
width: 1.0,
|
||||||
color: Theme.of(context).dividerColor,
|
color: Theme.of(context).dividerColor,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
codeblockDecoration: BoxDecoration(
|
||||||
),
|
border: Border.all(
|
||||||
|
color: Theme.of(context).dividerColor,
|
||||||
|
width: 0.3,
|
||||||
|
),
|
||||||
|
borderRadius: const BorderRadius.all(Radius.circular(4)),
|
||||||
|
color: Theme.of(context).colorScheme.surface.withOpacity(0.5),
|
||||||
|
)),
|
||||||
|
builders: {
|
||||||
|
'code': _MarkdownTextCodeElement(),
|
||||||
|
},
|
||||||
|
softLineBreak: true,
|
||||||
extensionSet: markdown.ExtensionSet(
|
extensionSet: markdown.ExtensionSet(
|
||||||
markdown.ExtensionSet.gitHubFlavored.blockSyntaxes,
|
<markdown.BlockSyntax>[
|
||||||
|
markdown.CodeBlockSyntax(),
|
||||||
|
...markdown.ExtensionSet.commonMark.blockSyntaxes,
|
||||||
|
...markdown.ExtensionSet.gitHubFlavored.blockSyntaxes,
|
||||||
|
],
|
||||||
<markdown.InlineSyntax>[
|
<markdown.InlineSyntax>[
|
||||||
|
if (isAutoWarp) markdown.LineBreakSyntax(),
|
||||||
_UserNameCardInlineSyntax(),
|
_UserNameCardInlineSyntax(),
|
||||||
_CustomEmoteInlineSyntax(),
|
_CustomEmoteInlineSyntax(),
|
||||||
markdown.EmojiSyntax(),
|
|
||||||
markdown.AutolinkSyntax(),
|
markdown.AutolinkSyntax(),
|
||||||
markdown.AutolinkExtensionSyntax(),
|
markdown.AutolinkExtensionSyntax(),
|
||||||
|
markdown.CodeSyntax(),
|
||||||
|
...markdown.ExtensionSet.commonMark.inlineSyntaxes,
|
||||||
...markdown.ExtensionSet.gitHubFlavored.inlineSyntaxes
|
...markdown.ExtensionSet.gitHubFlavored.inlineSyntaxes
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@ -209,7 +221,7 @@ class MarkdownTextContent extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class _UserNameCardInlineSyntax extends InlineSyntax {
|
class _UserNameCardInlineSyntax extends markdown.InlineSyntax {
|
||||||
_UserNameCardInlineSyntax() : super(r'@[a-zA-Z0-9_]+');
|
_UserNameCardInlineSyntax() : super(r'@[a-zA-Z0-9_]+');
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -225,7 +237,7 @@ class _UserNameCardInlineSyntax extends InlineSyntax {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class _CustomEmoteInlineSyntax extends InlineSyntax {
|
class _CustomEmoteInlineSyntax extends markdown.InlineSyntax {
|
||||||
_CustomEmoteInlineSyntax() : super(r':([-\w]+):');
|
_CustomEmoteInlineSyntax() : super(r':([-\w]+):');
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -245,3 +257,48 @@ class _CustomEmoteInlineSyntax extends InlineSyntax {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class _MarkdownTextCodeElement extends MarkdownElementBuilder {
|
||||||
|
@override
|
||||||
|
Widget? visitElementAfter(
|
||||||
|
markdown.Element element,
|
||||||
|
TextStyle? preferredStyle,
|
||||||
|
) {
|
||||||
|
var language = '';
|
||||||
|
|
||||||
|
if (element.attributes['class'] != null) {
|
||||||
|
String lg = element.attributes['class'] as String;
|
||||||
|
language = lg.substring(9).trim();
|
||||||
|
}
|
||||||
|
return SizedBox(
|
||||||
|
child: FutureBuilder(
|
||||||
|
future: (() async {
|
||||||
|
final docPath = '../../../';
|
||||||
|
final highlightingPath =
|
||||||
|
join(docPath, 'assets/highlighting', language);
|
||||||
|
await Highlighter.initialize([highlightingPath]);
|
||||||
|
return Highlighter(
|
||||||
|
language: highlightingPath,
|
||||||
|
theme: PlatformDispatcher.instance.platformBrightness ==
|
||||||
|
Brightness.light
|
||||||
|
? await HighlighterTheme.loadLightTheme()
|
||||||
|
: await HighlighterTheme.loadDarkTheme(),
|
||||||
|
);
|
||||||
|
})(),
|
||||||
|
builder: (context, snapshot) {
|
||||||
|
if (snapshot.hasData) {
|
||||||
|
final highlighter = snapshot.data!;
|
||||||
|
return Text.rich(
|
||||||
|
highlighter.highlight(element.textContent.trim()),
|
||||||
|
style: GoogleFonts.robotoMono(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return Text(
|
||||||
|
element.textContent.trim(),
|
||||||
|
style: GoogleFonts.robotoMono(),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
).paddingAll(8);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -455,14 +455,16 @@ class _PostAttachmentWidget extends StatelessWidget {
|
|||||||
if (attachments.length > 3) {
|
if (attachments.length > 3) {
|
||||||
return AttachmentList(
|
return AttachmentList(
|
||||||
parentId: item.id.toString(),
|
parentId: item.id.toString(),
|
||||||
attachmentsId: attachments,
|
attachmentIds: item.preload == null ? attachments : null,
|
||||||
|
attachments: item.preload?.attachments,
|
||||||
autoload: false,
|
autoload: false,
|
||||||
isGrid: true,
|
isGrid: true,
|
||||||
).paddingOnly(left: 36, top: 4, bottom: 4);
|
).paddingOnly(left: 36, top: 4, bottom: 4);
|
||||||
} else if (attachments.length > 1 || isLargeScreen) {
|
} else if (attachments.length > 1 || isLargeScreen) {
|
||||||
return AttachmentList(
|
return AttachmentList(
|
||||||
parentId: item.id.toString(),
|
parentId: item.id.toString(),
|
||||||
attachmentsId: attachments,
|
attachmentIds: item.preload == null ? attachments : null,
|
||||||
|
attachments: item.preload?.attachments,
|
||||||
autoload: false,
|
autoload: false,
|
||||||
isColumn: true,
|
isColumn: true,
|
||||||
).paddingOnly(left: 60, right: 24, top: 4, bottom: 4);
|
).paddingOnly(left: 60, right: 24, top: 4, bottom: 4);
|
||||||
@ -470,7 +472,8 @@ class _PostAttachmentWidget extends StatelessWidget {
|
|||||||
return AttachmentList(
|
return AttachmentList(
|
||||||
flatMaxHeight: MediaQuery.of(context).size.width,
|
flatMaxHeight: MediaQuery.of(context).size.width,
|
||||||
parentId: item.id.toString(),
|
parentId: item.id.toString(),
|
||||||
attachmentsId: attachments,
|
attachmentIds: item.preload == null ? attachments : null,
|
||||||
|
attachments: item.preload?.attachments,
|
||||||
autoload: false,
|
autoload: false,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -48,7 +48,6 @@ class PostListWidget extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class PostListEntryWidget extends StatelessWidget {
|
class PostListEntryWidget extends StatelessWidget {
|
||||||
final int renderOrder;
|
|
||||||
final bool isShowEmbed;
|
final bool isShowEmbed;
|
||||||
final bool isNestedClickable;
|
final bool isNestedClickable;
|
||||||
final bool isClickable;
|
final bool isClickable;
|
||||||
@ -59,7 +58,6 @@ class PostListEntryWidget extends StatelessWidget {
|
|||||||
|
|
||||||
const PostListEntryWidget({
|
const PostListEntryWidget({
|
||||||
super.key,
|
super.key,
|
||||||
this.renderOrder = 0,
|
|
||||||
required this.isShowEmbed,
|
required this.isShowEmbed,
|
||||||
required this.isNestedClickable,
|
required this.isNestedClickable,
|
||||||
required this.isClickable,
|
required this.isClickable,
|
||||||
@ -101,3 +99,46 @@ class PostListEntryWidget extends StatelessWidget {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class ControlledPostListWidget extends StatelessWidget {
|
||||||
|
final bool isShowEmbed;
|
||||||
|
final bool isClickable;
|
||||||
|
final bool isNestedClickable;
|
||||||
|
final bool isPinned;
|
||||||
|
final PagingController<int, Post> controller;
|
||||||
|
final Function? onUpdate;
|
||||||
|
|
||||||
|
const ControlledPostListWidget({
|
||||||
|
super.key,
|
||||||
|
required this.controller,
|
||||||
|
this.isShowEmbed = true,
|
||||||
|
this.isClickable = true,
|
||||||
|
this.isNestedClickable = true,
|
||||||
|
this.isPinned = true,
|
||||||
|
this.onUpdate,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return PagedSliverList<int, Post>.separated(
|
||||||
|
addRepaintBoundaries: true,
|
||||||
|
pagingController: controller,
|
||||||
|
builderDelegate: PagedChildBuilderDelegate<Post>(
|
||||||
|
itemBuilder: (context, item, index) {
|
||||||
|
if (item.pinnedAt != null && !isPinned) {
|
||||||
|
return const SizedBox.shrink();
|
||||||
|
}
|
||||||
|
return PostListEntryWidget(
|
||||||
|
isShowEmbed: isShowEmbed,
|
||||||
|
isNestedClickable: isNestedClickable,
|
||||||
|
isClickable: isClickable,
|
||||||
|
showFeaturedReply: true,
|
||||||
|
item: item,
|
||||||
|
onUpdate: onUpdate ?? () {},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
separatorBuilder: (_, __) => const Divider(thickness: 0.3, height: 0.3),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -1,48 +0,0 @@
|
|||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:infinite_scroll_pagination/infinite_scroll_pagination.dart';
|
|
||||||
import 'package:solian/models/post.dart';
|
|
||||||
import 'package:solian/widgets/posts/post_list.dart';
|
|
||||||
|
|
||||||
class PostWarpedListWidget extends StatelessWidget {
|
|
||||||
final bool isShowEmbed;
|
|
||||||
final bool isClickable;
|
|
||||||
final bool isNestedClickable;
|
|
||||||
final bool isPinned;
|
|
||||||
final PagingController<int, Post> controller;
|
|
||||||
final Function? onUpdate;
|
|
||||||
|
|
||||||
const PostWarpedListWidget({
|
|
||||||
super.key,
|
|
||||||
required this.controller,
|
|
||||||
this.isShowEmbed = true,
|
|
||||||
this.isClickable = true,
|
|
||||||
this.isNestedClickable = true,
|
|
||||||
this.isPinned = true,
|
|
||||||
this.onUpdate,
|
|
||||||
});
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return PagedSliverList<int, Post>.separated(
|
|
||||||
addRepaintBoundaries: true,
|
|
||||||
pagingController: controller,
|
|
||||||
builderDelegate: PagedChildBuilderDelegate<Post>(
|
|
||||||
itemBuilder: (context, item, index) {
|
|
||||||
if (item.pinnedAt != null && !isPinned) {
|
|
||||||
return const SizedBox.shrink();
|
|
||||||
}
|
|
||||||
return PostListEntryWidget(
|
|
||||||
renderOrder: index,
|
|
||||||
isShowEmbed: isShowEmbed,
|
|
||||||
isNestedClickable: isNestedClickable,
|
|
||||||
isClickable: isClickable,
|
|
||||||
showFeaturedReply: true,
|
|
||||||
item: item,
|
|
||||||
onUpdate: onUpdate ?? () {},
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
separatorBuilder: (_, __) => const Divider(thickness: 0.3, height: 0.3),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
@ -340,7 +340,7 @@ EXTERNAL SOURCES:
|
|||||||
SPEC CHECKSUMS:
|
SPEC CHECKSUMS:
|
||||||
connectivity_plus: ddd7f30999e1faaef5967c23d5b6d503d10434db
|
connectivity_plus: ddd7f30999e1faaef5967c23d5b6d503d10434db
|
||||||
desktop_drop: 69eeff437544aa619c8db7f4481b3a65f7696898
|
desktop_drop: 69eeff437544aa619c8db7f4481b3a65f7696898
|
||||||
device_info_plus: ce1b7762849d3ec103d0e0517299f2db7ad60720
|
device_info_plus: f1aae8670672f75c4c8850ecbe0b2ddef62b0a22
|
||||||
file_selector_macos: cc3858c981fe6889f364731200d6232dac1d812d
|
file_selector_macos: cc3858c981fe6889f364731200d6232dac1d812d
|
||||||
Firebase: 98e6bf5278170668a7983e12971a66b2cd57fc8c
|
Firebase: 98e6bf5278170668a7983e12971a66b2cd57fc8c
|
||||||
firebase_analytics: 30ff72f6d4847ff0b479d8edd92fc8582e719072
|
firebase_analytics: 30ff72f6d4847ff0b479d8edd92fc8582e719072
|
||||||
|
20
pubspec.lock
20
pubspec.lock
@ -346,10 +346,10 @@ packages:
|
|||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
name: device_info_plus
|
name: device_info_plus
|
||||||
sha256: a7fd703482b391a87d60b6061d04dfdeab07826b96f9abd8f5ed98068acc0074
|
sha256: db03b2d2a3fa466a4627709e1db58692c3f7f658e36a5942d342d86efedc4091
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "10.1.2"
|
version: "11.0.0"
|
||||||
device_info_plus_platform_interface:
|
device_info_plus_platform_interface:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@ -795,14 +795,6 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.7.3+2"
|
version: "0.7.3+2"
|
||||||
flutter_markdown_selectionarea:
|
|
||||||
dependency: "direct main"
|
|
||||||
description:
|
|
||||||
name: flutter_markdown_selectionarea
|
|
||||||
sha256: d4bc27e70a5c40ebdab23a4b81f75d53696a214d4d1f13c12045b38a0ddc58a2
|
|
||||||
url: "https://pub.dev"
|
|
||||||
source: hosted
|
|
||||||
version: "0.6.17+1"
|
|
||||||
flutter_native_splash:
|
flutter_native_splash:
|
||||||
dependency: "direct dev"
|
dependency: "direct dev"
|
||||||
description:
|
description:
|
||||||
@ -1986,6 +1978,14 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "3.3.0+3"
|
version: "3.3.0+3"
|
||||||
|
syntax_highlight:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: syntax_highlight
|
||||||
|
sha256: ee33b6aa82cc722bb9b40152a792181dee222353b486c0255fde666a3e3a4997
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "0.4.0"
|
||||||
term_glyph:
|
term_glyph:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -2,7 +2,7 @@ name: solian
|
|||||||
description: "The Solar Network App"
|
description: "The Solar Network App"
|
||||||
publish_to: "none"
|
publish_to: "none"
|
||||||
|
|
||||||
version: 1.3.6+4
|
version: 1.3.7+7
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ">=3.3.4 <4.0.0"
|
sdk: ">=3.3.4 <4.0.0"
|
||||||
@ -38,7 +38,7 @@ dependencies:
|
|||||||
firebase_core: ^3.0.0
|
firebase_core: ^3.0.0
|
||||||
firebase_messaging: ^15.0.0
|
firebase_messaging: ^15.0.0
|
||||||
package_info_plus: ^8.0.0
|
package_info_plus: ^8.0.0
|
||||||
device_info_plus: ^10.1.0
|
device_info_plus: ^11.0.0
|
||||||
flutter_acrylic: ^1.1.4
|
flutter_acrylic: ^1.1.4
|
||||||
protocol_handler: ^0.2.0
|
protocol_handler: ^0.2.0
|
||||||
markdown: ^7.2.2
|
markdown: ^7.2.2
|
||||||
@ -49,7 +49,6 @@ dependencies:
|
|||||||
dismissible_page: ^1.0.2
|
dismissible_page: ^1.0.2
|
||||||
share_plus: ^10.0.0
|
share_plus: ^10.0.0
|
||||||
flutter_cache_manager: ^3.3.3
|
flutter_cache_manager: ^3.3.3
|
||||||
flutter_markdown_selectionarea: ^0.6.17+1
|
|
||||||
shared_preferences: ^2.2.3
|
shared_preferences: ^2.2.3
|
||||||
provider: ^6.1.2
|
provider: ^6.1.2
|
||||||
gal: ^2.3.0
|
gal: ^2.3.0
|
||||||
@ -84,6 +83,7 @@ dependencies:
|
|||||||
version: ^3.0.2
|
version: ^3.0.2
|
||||||
action_slider: ^0.7.0
|
action_slider: ^0.7.0
|
||||||
in_app_review: ^2.0.9
|
in_app_review: ^2.0.9
|
||||||
|
syntax_highlight: ^0.4.0
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_test:
|
flutter_test:
|
||||||
@ -103,6 +103,7 @@ flutter:
|
|||||||
assets:
|
assets:
|
||||||
- assets/logo.png
|
- assets/logo.png
|
||||||
- assets/locales/
|
- assets/locales/
|
||||||
|
- assets/highlighting/
|
||||||
|
|
||||||
fonts:
|
fonts:
|
||||||
- family: NotoSansEmoji
|
- family: NotoSansEmoji
|
||||||
|
9
roadsign.toml
Normal file
9
roadsign.toml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
id = "solian"
|
||||||
|
|
||||||
|
[[locations]]
|
||||||
|
id = "solian"
|
||||||
|
host = ["sn.solsynth.dev"]
|
||||||
|
path = ["/"]
|
||||||
|
[[locations.destinations]]
|
||||||
|
id = "solian-web"
|
||||||
|
uri = "files:///workdir/solian?fallback=index.html&index=index.html"
|
Reference in New Issue
Block a user