Skip to content

Commit

Permalink
清理
Browse files Browse the repository at this point in the history
  • Loading branch information
chen56 committed Apr 17, 2024
1 parent 7806737 commit 4bded9f
Show file tree
Hide file tree
Showing 6 changed files with 66 additions and 697 deletions.
104 changes: 52 additions & 52 deletions notes/flutter_core/lib/notes.g.dart

Large diffs are not rendered by default.

9 changes: 4 additions & 5 deletions packages/note_dart/lib/src/note_core.dart
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class Note {

NoteSource _source = _emptyPageSource;

// TODO QRoute的 deferred处理可以看下 :https://medium.com/@SchabanBo/reduce-your-flutter-web-app-loading-time-8018d8f442
@internal
DeferredNotePageBuilder? deferredPageBuilder;

NoteConf? conf;
Expand Down Expand Up @@ -223,10 +223,9 @@ class Note {

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

Future<NotePage> loadPage({NotePageBuilder? builder}) async {
Future<NotePage> loadPage({required NotePageBuilder builder}) async {
return NotePage(
note: this,
// pageBuilder: await deferredPageBuilder!(this),
pageBuilder: builder,
conf: conf == null ? null : NoteConf.decode(await rootBundle.loadString(confAssetPath)),
content: await rootBundle.loadString(dartAssetPath));
Expand All @@ -235,7 +234,7 @@ class Note {

class NotePage {
final Note note;
final NotePageBuilder? pageBuilder;
final NotePageBuilder pageBuilder;
final NoteConf? conf;
final String content; // source code content
NotePage({
Expand Down Expand Up @@ -325,7 +324,7 @@ class Pen {
// Skip the header code block
$____________________________________________________________________();

notePage.pageBuilder!(context, this);
notePage.pageBuilder(context, this);
}

/// 新增一个cell,cell代表note中的一个代码块及其产生的内容
Expand Down
2 changes: 0 additions & 2 deletions packages/note_dart/lib/src/note_layout.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ class DeferredScreen extends StatelessWidget with Screen {
@override
Widget build(BuildContext context) {
return FutureBuilder<NotePage>(
// https://medium.com/@SchabanBo/reduce-your-flutter-web-app-loading-time-8018d8f442
// QRoute的 deferred处理可以看下
future: note.deferredPageBuilder!(note),
builder: (context, snapshot) {
if (snapshot.connectionState == ConnectionState.done) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@ import 'package:file/memory.dart';
import 'package:path/path.dart' as path;
import 'package:test/test.dart';

import '../../tools/note_dev_gen.dart';
import '../../bin/notecli.dart';



MemoryFileSystem fs = MemoryFileSystem();
NotesGenerator gen = NotesGenerator(packageBaseName: "test_note", fs: fs, projectDir: path.absolute("/note"));
NotesGenerator gen = NotesGenerator(packageBaseName: "test_note", fs: fs, projectDir: fs.directory(path.absolute("/note")));
File memoryPubspec(String content) {
MemoryFileSystem fs = MemoryFileSystem();
var file = fs.file("/note/pubspec.yaml");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'package:file/memory.dart';
import 'package:test/test.dart';

import '../../tools/note_dev_gen.dart';
import '../../bin/notecli.dart';

void main() {
late NotesGenerator gen;
Expand All @@ -15,15 +15,15 @@ void main() {
gen = NotesGenerator(
packageBaseName: "flutter_core",
fs: fs,
projectDir: "./",
projectDir: fs.directory("./"),
);
});

group("NotesGenerator", () {
test('basic app_info', () {
expect(gen.projectDir, ".");
expect(gen.libDir, "./lib");
expect(gen.noteRootDir, "./lib/notes");
expect(gen.projectDir.path, "./");
expect(gen.libDir.path, "./lib");
expect(gen.noteRootDir.path, "./lib/notes");
});
});

Expand All @@ -46,8 +46,8 @@ void main() {
test('absolute path', () {
gen = NotesGenerator(
packageBaseName: "flutter_core",
fs: MemoryFileSystem(),
projectDir: "/n",
fs: fs,
projectDir: fs.directory("/n"),
);

var testcases = [
Expand Down
Loading

0 comments on commit 4bded9f

Please sign in to comment.