diff --git a/notes/flutter_web/lib/routes/notes/layout.dart b/notes/flutter_web/lib/routes/notes/layout.dart index b62ee6a5..6d81ab61 100644 --- a/notes/flutter_web/lib/routes/notes/layout.dart +++ b/notes/flutter_web/lib/routes/notes/layout.dart @@ -1,7 +1,6 @@ import 'package:flutter/material.dart'; import 'package:you_flutter/router.dart'; import 'package:you_flutter/note.dart'; -import 'package:you_flutter/state.dart'; /// [NoteLayoutBuilder] @ToType(type: ToNote) @@ -23,15 +22,7 @@ final class NoteLayout extends StatelessWidget with NoteMixin { @override Widget build(BuildContext context) { - return Scaffold( - body: SafeArea( - child: SelectionArea( - child: Watch((context) { - return SingleChildScrollView(child: child); - }), - ), - ), - ); + return SingleChildScrollView(child: child); } } diff --git a/notes/flutter_web/lib/routes/notes/page.dart b/notes/flutter_web/lib/routes/notes/page.dart index c970812c..96ef8e1d 100644 --- a/notes/flutter_web/lib/routes/notes/page.dart +++ b/notes/flutter_web/lib/routes/notes/page.dart @@ -1,7 +1,8 @@ import 'package:flutter/widgets.dart'; import 'package:you_flutter/note.dart'; +import 'package:you_flutter/router.dart'; -/// [PageBuilder] +@PageMeta(label: "笔记", toType: ToNote) void build(BuildContext context, Cell print) { print(const MD(r''' # home diff --git a/packages/you_flutter/lib/router.dart b/packages/you_flutter/lib/router.dart index 3afb7b84..10f04c8a 100644 --- a/packages/you_flutter/lib/router.dart +++ b/packages/you_flutter/lib/router.dart @@ -1,3 +1,3 @@ library you_router; -export 'package:you_flutter/src/router.dart' show YouRouter, RouteContext, To, ToType, RouteUri, PageBodyBuilder, LazyPageBodyBuilder, PageLayoutBuilder; +export 'package:you_flutter/src/router.dart' show YouRouter, PageMeta, RouteContext, To, ToType, RouteUri, PageBodyBuilder, LazyPageBodyBuilder, PageLayoutBuilder; diff --git a/packages/you_flutter/lib/src/router.dart b/packages/you_flutter/lib/src/router.dart index d57dc81b..339c2a8d 100644 --- a/packages/you_flutter/lib/src/router.dart +++ b/packages/you_flutter/lib/src/router.dart @@ -44,6 +44,24 @@ typedef PageBodyBuilder = WidgetBuilder; typedef PageLayoutBuilder = Widget Function(BuildContext context, Widget child); typedef LazyPageBodyBuilder = Future Function(); +/// page annotation +class PageMeta { + const PageMeta({ + required this.label, + this.publish = false, + this.toType = To, + }); + + /// 每个节点单独设置,子节点不继承 + final String label; + + /// 每个节点单独设置,子节点不继承 + final bool publish; + + /// 子节点若未设置此属性,则继承父节点 + final Type toType; +} + final class NotFoundError extends ArgumentError { NotFoundError({required Uri invalidValue, String name = "uri", String message = "Not Found"}) : super.value(invalidValue.toString(), name, message); }