Skip to content

Commit

Permalink
整理目录
Browse files Browse the repository at this point in the history
  • Loading branch information
chen56 committed Mar 25, 2024
1 parent aad1d50 commit 4d574d4
Show file tree
Hide file tree
Showing 160 changed files with 548 additions and 615 deletions.
2 changes: 1 addition & 1 deletion mate_flutter/lib/mate_icons.g.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16001,7 +16001,7 @@ IconRegister registerIcon() {
);
result.register(
_i1.Icons.info,
'info',
'app_info',
);
result.register(
_i1.Icons.info_sharp,
Expand Down
60 changes: 30 additions & 30 deletions mate_flutter/lib/src/foundation/diagnostics.dart

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions mate_flutter/lib/src/painting/colors.dart
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ class ColorSwatch$Mate<T> extends _i1.ColorSwatch<T> with _i2.Mate {

/// class ColorProperty extends DiagnosticsProperty<Color>
class ColorProperty$Mate extends _i1.ColorProperty with _i2.Mate {
/// ColorProperty ColorProperty(String name, Color? value, {bool showName = true, Object? defaultValue = kNoDefaultValue, DiagnosticsTreeStyle style = DiagnosticsTreeStyle.singleLine, DiagnosticLevel level = DiagnosticLevel.info})
/// ColorProperty ColorProperty(String name, Color? value, {bool showName = true, Object? defaultValue = kNoDefaultValue, DiagnosticsTreeStyle style = DiagnosticsTreeStyle.singleLine, DiagnosticLevel level = DiagnosticLevel.app_info})
ColorProperty$Mate(
/// requiredParameters: String name
super.name,
Expand All @@ -163,7 +163,7 @@ class ColorProperty$Mate extends _i1.ColorProperty with _i2.Mate {
/// optionalParameters: {DiagnosticsTreeStyle style = DiagnosticsTreeStyle.singleLine} , default:processed=PrefixedIdentifierImpl
super.style,

/// optionalParameters: {DiagnosticLevel level = DiagnosticLevel.info} , default:processed=PrefixedIdentifierImpl
/// optionalParameters: {DiagnosticLevel level = DiagnosticLevel.app_info} , default:processed=PrefixedIdentifierImpl
super.level,
}) : mateParams = {
'name': _i2.BuilderArg<String>(
Expand Down
4 changes: 2 additions & 2 deletions mate_flutter/lib/src/painting/matrix_utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import 'package:flutter/foundation.dart' as _i5;

/// class TransformProperty extends DiagnosticsProperty<Matrix4>
class TransformProperty$Mate extends _i1.TransformProperty with _i2.Mate {
/// TransformProperty TransformProperty(String name, Matrix4? value, {bool showName = true, Object? defaultValue = kNoDefaultValue, DiagnosticLevel level = DiagnosticLevel.info})
/// TransformProperty TransformProperty(String name, Matrix4? value, {bool showName = true, Object? defaultValue = kNoDefaultValue, DiagnosticLevel level = DiagnosticLevel.app_info})
TransformProperty$Mate(
/// requiredParameters: String name
super.name,
Expand All @@ -22,7 +22,7 @@ class TransformProperty$Mate extends _i1.TransformProperty with _i2.Mate {
/// optionalParameters: {Object? defaultValue = kNoDefaultValue} , default:unprocessed=SimpleIdentifierImpl
super.defaultValue,

/// optionalParameters: {DiagnosticLevel level = DiagnosticLevel.info} , default:processed=PrefixedIdentifierImpl
/// optionalParameters: {DiagnosticLevel level = DiagnosticLevel.app_info} , default:processed=PrefixedIdentifierImpl
super.level,
}) : mateParams = {
'name': _i2.BuilderArg<String>(
Expand Down
4 changes: 2 additions & 2 deletions mate_flutter/lib/src/semantics/semantics.dart
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ class AttributedString$Mate extends _i1.AttributedString with _i2.Mate {

/// class AttributedStringProperty extends DiagnosticsProperty<AttributedString>
class AttributedStringProperty$Mate extends _i1.AttributedStringProperty with _i2.Mate {
/// AttributedStringProperty AttributedStringProperty(String name, AttributedString? value, {bool showName = true, bool showWhenEmpty = false, Object? defaultValue = kNoDefaultValue, DiagnosticLevel level = DiagnosticLevel.info, String? description})
/// AttributedStringProperty AttributedStringProperty(String name, AttributedString? value, {bool showName = true, bool showWhenEmpty = false, Object? defaultValue = kNoDefaultValue, DiagnosticLevel level = DiagnosticLevel.app_info, String? description})
AttributedStringProperty$Mate(
/// requiredParameters: String name
super.name,
Expand All @@ -137,7 +137,7 @@ class AttributedStringProperty$Mate extends _i1.AttributedStringProperty with _i
/// optionalParameters: {Object? defaultValue = kNoDefaultValue} , default:unprocessed=SimpleIdentifierImpl
super.defaultValue,

/// optionalParameters: {DiagnosticLevel level = DiagnosticLevel.info} , default:processed=PrefixedIdentifierImpl
/// optionalParameters: {DiagnosticLevel level = DiagnosticLevel.app_info} , default:processed=PrefixedIdentifierImpl
super.level,

/// optionalParameters: {String? description} , default:none
Expand Down
4 changes: 2 additions & 2 deletions mate_flutter/lib/src/widgets/icon_data.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import 'package:flutter/foundation.dart' as _i4;

/// class IconDataProperty extends DiagnosticsProperty<IconData>
class IconDataProperty$Mate extends _i1.IconDataProperty with _i2.Mate {
/// IconDataProperty IconDataProperty(String name, IconData? value, {String? ifNull, bool showName = true, DiagnosticsTreeStyle style = DiagnosticsTreeStyle.singleLine, DiagnosticLevel level = DiagnosticLevel.info})
/// IconDataProperty IconDataProperty(String name, IconData? value, {String? ifNull, bool showName = true, DiagnosticsTreeStyle style = DiagnosticsTreeStyle.singleLine, DiagnosticLevel level = DiagnosticLevel.app_info})
IconDataProperty$Mate(
/// requiredParameters: String name
super.name,
Expand All @@ -24,7 +24,7 @@ class IconDataProperty$Mate extends _i1.IconDataProperty with _i2.Mate {
/// optionalParameters: {DiagnosticsTreeStyle style = DiagnosticsTreeStyle.singleLine} , default:processed=PrefixedIdentifierImpl
super.style,

/// optionalParameters: {DiagnosticLevel level = DiagnosticLevel.info} , default:processed=PrefixedIdentifierImpl
/// optionalParameters: {DiagnosticLevel level = DiagnosticLevel.app_info} , default:processed=PrefixedIdentifierImpl
super.level,
}) : mateParams = {
'name': _i2.BuilderArg<String>(
Expand Down
4 changes: 2 additions & 2 deletions mate_flutter/lib/src/widgets/shortcuts.dart
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ class LogicalKeySet$Mate extends _i2.LogicalKeySet with _i3.Mate {

/// class ShortcutMapProperty extends DiagnosticsProperty<Map<ShortcutActivator, Intent>>
class ShortcutMapProperty$Mate extends _i2.ShortcutMapProperty with _i3.Mate {
/// ShortcutMapProperty ShortcutMapProperty(String name, Map<ShortcutActivator, Intent> value, {bool showName = true, Object defaultValue = kNoDefaultValue, DiagnosticLevel level = DiagnosticLevel.info, String? description})
/// ShortcutMapProperty ShortcutMapProperty(String name, Map<ShortcutActivator, Intent> value, {bool showName = true, Object defaultValue = kNoDefaultValue, DiagnosticLevel level = DiagnosticLevel.app_info, String? description})
ShortcutMapProperty$Mate(
/// requiredParameters: String name
super.name,
Expand All @@ -166,7 +166,7 @@ class ShortcutMapProperty$Mate extends _i2.ShortcutMapProperty with _i3.Mate {
/// optionalParameters: {Object defaultValue = kNoDefaultValue} , default:unprocessed=SimpleIdentifierImpl
super.defaultValue,

/// optionalParameters: {DiagnosticLevel level = DiagnosticLevel.info} , default:processed=PrefixedIdentifierImpl
/// optionalParameters: {DiagnosticLevel level = DiagnosticLevel.app_info} , default:processed=PrefixedIdentifierImpl
super.level,

/// optionalParameters: {String? description} , default:none
Expand Down
2 changes: 1 addition & 1 deletion mate_flutter/tools/gen_mates.dart
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,7 @@ void _genMateLib({
// var resolveResult = resolveDefaultValue(param, typeRefers);
//
// b.docs.add(
// "/// optionalParameters: ${param.getDisplayString(withNullability: true)} , ${resolveResult.info}");
// "/// optionalParameters: ${param.getDisplayString(withNullability: true)} , ${resolveResult.app_info}");
// b.defaultTo = resolveResult.value?.code;
// //有缺省值的,但无法处理的,就加个required,自己投参吧
// b.required = param.hasDefaultValue
Expand Down
54 changes: 21 additions & 33 deletions note/lib/src/note_core.dart
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ class NoteSystem {
final NoteContentExts contentExtensions;
final SpaceConf spaceConf;
final SharedPreferences sharedPreferences;

NoteSystem({
required this.root,
required this.contentExtensions,
Expand All @@ -61,8 +62,7 @@ class NoteSystem {
}) async {
return NoteSystem(
root: root,
spaceConf:
SpaceConf.decodeJson(await rootBundle.loadString('note_space.json')),
spaceConf: SpaceConf.decodeJson(await rootBundle.loadString('note_space.json')),
contentExtensions: contentExtensions,
sharedPreferences: await SharedPreferences.getInstance(),
);
Expand Down Expand Up @@ -90,24 +90,21 @@ class Note {
: basename = "",
parent = null;

Note put(String fullPath, NoteSourceData data,
DeferredNotePageBuilder deferredPageBuilder) {
var p = fullPath
.split("/")
.map((e) => e.trim())
.where((e) => e.isNotEmpty)
.toList();
Note put(String fullPath, NoteSourceData data, DeferredNotePageBuilder deferredPageBuilder) {
var p = fullPath.split("/").map((e) => e.trim()).where((e) => e.isNotEmpty).toList();
var path = _ensurePath(p);

path._source = NoteSource(pageGenInfo: data);
path.deferredPageBuilder = deferredPageBuilder;
return path;
}

void extendTree(bool value) {
expand = value;
void configTree({int extendLevel = 0}) {
if (extendLevel <= 0) return;

expand = extendLevel > 0;
for (var e in children) {
e.extendTree(value);
e.configTree(extendLevel: extendLevel - 1);
}
}

Expand All @@ -120,8 +117,7 @@ class Note {
return this;
}
String name = nameList[0];
assert(name != "" && name != "/",
"path:$nameList, path[0]:'$name' must not be '' and '/' ");
assert(name != "" && name != "/", "path:$nameList, path[0]:'$name' must not be '' and '/' ");
var next = _children.putIfAbsent(name, () {
var child = Note._child(basename: name, parent: this);
_children[name] = child;
Expand All @@ -136,8 +132,7 @@ class Note {

int levelTo(Note parent) => this.level - parent.level;

List<Note> get ancestors =>
this.isRoot ? [] : [parent!, ...parent!.ancestors];
List<Note> get ancestors => this.isRoot ? [] : [parent!, ...parent!.ancestors];

List<Note> get meAndAncestors => [this, ...ancestors];

Expand All @@ -147,8 +142,7 @@ class Note {

/// Note names, which can be set to human-readable names in note.json,
/// are displayed on the navigation tree
String get displayName =>
spaceNoteConf != null ? spaceNoteConf!.displayName : basename;
String get displayName => spaceNoteConf != null ? spaceNoteConf!.displayName : basename;

String get path {
if (isRoot) return "";
Expand Down Expand Up @@ -186,8 +180,7 @@ class Note {
// todo bug
Note? child(String path) {
Note? result = this;
for (var split
in path.split("/").map((e) => e.trim()).where((e) => e != "")) {
for (var split in path.split("/").map((e) => e.trim()).where((e) => e != "")) {
result = result?._children[split];
if (result == null) break;
}
Expand All @@ -196,8 +189,7 @@ class Note {

/// 扁平化name,去掉排序用的数字前缀
String get nameFlat {
return basename.replaceAll(
RegExp("\\d+[.]"), "") // 1.note-self -> note-self
return basename.replaceAll(RegExp("\\d+[.]"), "") // 1.z.about -> z.about
;
}

Expand Down Expand Up @@ -233,16 +225,15 @@ class Note {
}

String get dartAssetPath => conventions.noteDartAssetPath(path);

String get confAssetPath => conventions.noteConfAssetPath(path);

Future<NotePage> loadPage({NotePageBuilder? builder}) async {
return NotePage(
note: this,
// pageBuilder: await deferredPageBuilder!(this),
pageBuilder: builder,
conf: spaceNoteConf == null
? null
: NoteConf.decode(await rootBundle.loadString(confAssetPath)),
conf: spaceNoteConf == null ? null : NoteConf.decode(await rootBundle.loadString(confAssetPath)),
content: await rootBundle.loadString(dartAssetPath));
}
}
Expand Down Expand Up @@ -322,8 +313,7 @@ class Pen {
required this.defaultCodeExpand,
required this.outline,
}) : note = notePage.note {
assert(note.source._pageGenInfo.cells.isNotEmpty,
"page cells should not be empty");
assert(note.source._pageGenInfo.cells.isNotEmpty, "page cells should not be empty");

List<NoteCell> cells = List.empty(growable: true);
for (int i = 0; i < note.source._pageGenInfo.cells.length; i++) {
Expand Down Expand Up @@ -413,8 +403,7 @@ class NoteContentExts {
return w;
}
}
throw Exception(
"Must provide NoteContentExt for data <$data> of type <${data.runtimeType}>");
throw Exception("Must provide NoteContentExt for data <$data> of type <${data.runtimeType}>");
}
}

Expand Down Expand Up @@ -506,8 +495,7 @@ class OutlineNode {
class NoteSource {
final NoteSourceData _pageGenInfo;

NoteSource({required NoteSourceData pageGenInfo})
: _pageGenInfo = pageGenInfo;
NoteSource({required NoteSourceData pageGenInfo}) : _pageGenInfo = pageGenInfo;
}

/// CodeEntity is same as analyzer [SyntacticEntity]
Expand All @@ -530,6 +518,7 @@ class CellSource {
final CodeEntity codeEntity;
final List<SpecialSource> specialSources;
final NoteCell cell;

CellSource({
required this.cellType,
required this.codeEntity,
Expand Down Expand Up @@ -642,8 +631,7 @@ class NoteCell extends ChangeNotifier {
}

void call(Object? object) {
_add(contentExtensions.create(
object, NoteContentArg(cell: this, outline: outline)));
_add(contentExtensions.create(object, NoteContentArg(cell: this, outline: outline)));
}

void _add(NoteContentWidgetMixin content) {
Expand Down
7 changes: 3 additions & 4 deletions note/test/note_cell_test.dart
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import 'package:flutter_test/flutter_test.dart';
import 'package:note/note.dart';

void main() {
group("note cell info", () {
group("note cell app_info", () {
test("cell", () async {
var root = Note.root();
NotePage notePage = await root.loadPage();
// var root = Note.root();
// NotePage notePage = await root.loadPage();
});
});
}
2 changes: 1 addition & 1 deletion note_tools/lib/src/note_dev_gen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ class NoteLib {
var names = dir.split(path.separator).where((e) => e.isNotEmpty);
return names
.map((e) => e
.replaceAll(RegExp("^\\d+\."), "") // 1.note-self -> note_note-self
.replaceAll(RegExp("^\\d+\."), "") // 1.z.about -> note_note-self
.replaceAll(".", "_")
.replaceAll("-", "_")
.replaceAll("&", "_")
Expand Down
4 changes: 2 additions & 2 deletions note_tools/test/src/note_dev_gen_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ void main() {
});

group("NotesGenerator", () {
test('basic info', () {
test('basic app_info', () {
expect(gen.projectDir, ".");
expect(gen.libDir, "./lib");
expect(gen.noteRootDir, "./lib/notes");
Expand Down Expand Up @@ -65,7 +65,7 @@ void main() {
});
});

group("gen cell info", () {
group("gen cell app_info", () {
test('1', () async {
fs.file("/n/lib/notes/note.dart").writeAsStringSync("""import 'package:flutter/widgets.dart';
import 'package:note/note.dart';
Expand Down
5 changes: 2 additions & 3 deletions spaces/flutter_note/lib/note_app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import 'package:shared_preferences/shared_preferences.dart';
// Path<void>("not_found", meta: notFoundPage),
// Path<void>("note", meta: notePage, kids: [
// Path<void>("welcome", meta: welcome, kids: [
// Path<void>("note-self", meta: page),
// Path<void>("z.about", meta: page),
// ]),
// Path<void>("layout", meta: layoutNote),
// Path<void>("material", kids: [
Expand Down Expand Up @@ -99,8 +99,7 @@ class NoteApp extends StatelessWidget {
spaceConf: noteSystem.spaceConf,
sharedPreferences: noteSystem.sharedPreferences);

notes.root.extendTree(true);
notes.z_draft.extendTree(false);
notes.root.configTree(extendLevel: 2);

var routerApp = MaterialApp.router(
title: 'Flutter Note',
Expand Down
Loading

0 comments on commit 4d574d4

Please sign in to comment.