Compare commits
No commits in common. "442ef061475f1f2b16d4196f1b701ff5f1493b9b" and "558828f3e03e6a99f3d29103060f0d574e56a386" have entirely different histories.
442ef06147
...
558828f3e0
@ -1,358 +0,0 @@
|
||||
{
|
||||
"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": ";"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
@ -117,13 +117,11 @@ class _ChatListState extends State<ChatList> {
|
||||
final ctrl = ChatEventController();
|
||||
await ctrl.initialize();
|
||||
final messages = await ctrl.src.getLastInAllChannels();
|
||||
if (mounted) {
|
||||
setState(() {
|
||||
_lastMessages = messages
|
||||
.map((k, v) => MapEntry(k, v.firstOrNull))
|
||||
.cast<int, LocalMessageEventTableData>();
|
||||
});
|
||||
}
|
||||
setState(() {
|
||||
_lastMessages = messages
|
||||
.map((k, v) => MapEntry(k, v.firstOrNull))
|
||||
.cast<int, LocalMessageEventTableData>();
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -273,69 +273,116 @@ class _PostPublishScreenState extends State<PostPublishScreen> {
|
||||
),
|
||||
if (_isBusy) const LinearProgressIndicator().animate().scaleX(),
|
||||
Expanded(
|
||||
child: DefaultTabController(
|
||||
length: 2,
|
||||
child: AppTheme.isLargeScreen(context)
|
||||
? Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Expanded(
|
||||
child: _PostEditorTextField(
|
||||
focusNode: _contentFocusNode,
|
||||
controller: _editorController,
|
||||
onUpdate: () => setState(() {}),
|
||||
),
|
||||
),
|
||||
const VerticalDivider(width: 0.3, thickness: 0.3)
|
||||
.paddingSymmetric(horizontal: 16),
|
||||
Expanded(
|
||||
child: SingleChildScrollView(
|
||||
padding:
|
||||
const EdgeInsets.only(top: 12, bottom: 64),
|
||||
child: MarkdownTextContent(
|
||||
isAutoWarp: _editorController.mode.value == 0,
|
||||
content:
|
||||
_editorController.contentController.text,
|
||||
parentId: 'post-editor-preview',
|
||||
).paddingOnly(right: 16),
|
||||
),
|
||||
),
|
||||
],
|
||||
)
|
||||
: Column(
|
||||
children: [
|
||||
TabBar(
|
||||
tabs: [
|
||||
const Tab(icon: Icon(Icons.edit)),
|
||||
const Tab(icon: Icon(Icons.preview)),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Expanded(
|
||||
child: 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:
|
||||
_editorController.contentController,
|
||||
focusNode: _contentFocusNode,
|
||||
decoration: InputDecoration.collapsed(
|
||||
hintText: 'postContentPlaceholder'.tr,
|
||||
),
|
||||
onTapOutside: (_) => FocusManager
|
||||
.instance.primaryFocus
|
||||
?.unfocus(),
|
||||
),
|
||||
),
|
||||
const Gap(120)
|
||||
],
|
||||
),
|
||||
Expanded(
|
||||
child: TabBarView(
|
||||
),
|
||||
Obx(() {
|
||||
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: [
|
||||
_PostEditorTextField(
|
||||
focusNode: _contentFocusNode,
|
||||
controller: _editorController,
|
||||
onUpdate: () => setState(() {}),
|
||||
),
|
||||
SingleChildScrollView(
|
||||
padding: const EdgeInsets.only(
|
||||
top: 12,
|
||||
bottom: 64,
|
||||
if (showFactors[0])
|
||||
Text('postRestoreFromLocal'.tr,
|
||||
style: textStyle)
|
||||
.paddingOnly(right: 4),
|
||||
if (showFactors[0])
|
||||
InkWell(
|
||||
child: Text('clear'.tr, style: textStyle),
|
||||
onTap: () {
|
||||
_editorController.localClear();
|
||||
_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(
|
||||
@ -344,26 +391,6 @@ class _PostPublishScreenState extends State<PostPublishScreen> {
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
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(
|
||||
height: 56,
|
||||
child: ListView(
|
||||
@ -493,7 +520,7 @@ class _PostPublishScreenState extends State<PostPublishScreen> {
|
||||
top: -4,
|
||||
end: -6,
|
||||
),
|
||||
child: const Icon(Icons.wallpaper),
|
||||
child: const Icon(Icons.preview),
|
||||
);
|
||||
}),
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
@ -520,6 +547,18 @@ class _PostPublishScreenState extends State<PostPublishScreen> {
|
||||
_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),
|
||||
),
|
||||
@ -539,102 +578,3 @@ class _PostPublishScreenState extends State<PostPublishScreen> {
|
||||
super.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
class _PostEditorTextField extends StatelessWidget {
|
||||
final FocusNode focusNode;
|
||||
final PostEditorController controller;
|
||||
final Function onUpdate;
|
||||
|
||||
const _PostEditorTextField({
|
||||
super.key,
|
||||
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,7 +49,6 @@ class RootShell extends StatelessWidget {
|
||||
|
||||
return Scaffold(
|
||||
key: rootScaffoldKey,
|
||||
backgroundColor: Theme.of(context).colorScheme.surface,
|
||||
bottomNavigationBar: showBottomNavigation
|
||||
? AppNavigationBottom(
|
||||
initialIndex: destNames.indexOf(routeName ?? 'page'),
|
||||
|
Loading…
x
Reference in New Issue
Block a user