Skip to content

Commit

Permalink
update notes dir
Browse files Browse the repository at this point in the history
  • Loading branch information
chen56 committed Mar 31, 2024
1 parent 7365a84 commit 48c36fa
Show file tree
Hide file tree
Showing 42 changed files with 345 additions and 207 deletions.
25 changes: 18 additions & 7 deletions bake
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env bash

# On Mac OS, readlink -f doesn't work, so use._real_path get the real path of the file
_real_path() {
_real_path() (
cd "$(dirname "$1")" || exit
file="$PWD/$(basename "$1")"
while [[ -L "$file" ]]; do
Expand All @@ -10,11 +10,14 @@ _real_path() {
file="$PWD/$(basename "$file")"
done
echo "$file"
}
)
SCRIPT_PATH="$(_real_path "${BASH_SOURCE[0]}")"
SCRIPT_DIR="$(dirname "$SCRIPT_PATH")"
SCRIPT_FILE="$(basename "$SCRIPT_PATH")"

# 进入脚本所在目录,这样上下文就是本项目了
cd "$SCRIPT_DIR"

_install_bake(){
mkdir -p "$SCRIPT_DIR/vendor"
echo "$SCRIPT_PATH -> _install_bake ▶︎【curl -o $SCRIPT_DIR/bake.bash https://github.com/chen56/bake/raw/main/bake.bash】"
Expand All @@ -32,7 +35,7 @@ source "$SCRIPT_DIR/vendor/bake.bash"
# 应用的命令脚本
##########################################

bake.cmd --cmd _root \
bake.cmd --cmd root \
--desc "$( cat <<-EOF
___ _ _ _ _ _ _
Expand All @@ -42,9 +45,10 @@ bake.cmd --cmd _root \
flutter-note build tools.
https://github.com/chen56/note
PWD: $PWD
Usage:
./$SCRIPT_FILE [cmd] [opts] [args...]
$SCRIPT_PATH [cmd] [opts] [args...]
Examples:
./${SCRIPT_FILE} # same as './${SCRIPT_FILE} -h'
Expand All @@ -64,7 +68,6 @@ Examples:
EOF
)"


# run一条命令,先print上下文信息,再执行
# Usage: run <some cmd>
# Example:
Expand Down Expand Up @@ -141,8 +144,8 @@ preview.macos() ( run p.flutter_note open build/macos/Build/Products/Release/fl

clean() { p.all flutter clean; rm -rf build;}

gen.all() { gen.notes; } # gen.mate;不再用了
gen.notes() { run p.flutter_note dart run tools/gen.dart; run p.flutter_note flutter pub get; }
gen.all() { gen.note; } # gen.mate;不再用了
gen.note() { run p.flutter_note dart run tools/gen.dart; run p.flutter_note flutter pub get; }
gen.mate() ( run p.mate_flutter dart run tools/gen_mates.dart; run p.mate_flutter dart run tools/gen_mate_icons.dart ; )
gen.clean() { run rm -f p.flutter_note/lib/pages.g.dart; run rm -rf mate_flutter/lib; }

Expand All @@ -153,6 +156,14 @@ docker.debug() { run docker run -v $PWD:/home/flutter/note --workdir /home/fl
docker.push() { docker image push younpc/note:latest ; }


info() {
echo "\$PWD : $PWD"
echo "\$SCRIPT_PATH: $SCRIPT_PATH"
echo "\$SCRIPT_DIR : $SCRIPT_DIR"
echo "\$SCRIPT_FILE: $SCRIPT_FILE"
echo
}

####################################################
# app entry script & _root cmd
####################################################
Expand Down
2 changes: 1 addition & 1 deletion learn_dart/test/regex_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ void main() {
test('replaceAll', () {
expect("a/page.dart/page.dart".replaceAll(RegExp("/\page.dart\$"), ""), "a/page.dart");
expect("a/page.dart/page.dart".replaceAll("/\page.dart\$", ""), "a/page.dart/page.dart");
expect("a1./1.button/page.dart".replaceAll(RegExp("/\\d+\."), "/"), "a1./button/page.dart");
expect("a1./1.overview/page.dart".replaceAll(RegExp("/\\d+\."), "/"), "a1./overview/page.dart");
expect("a1./2.dev/page.dart".replaceAll(RegExp("/\\d+\."), "/"), "a1./dev/page.dart");
});
test('match', () {
Expand Down
2 changes: 1 addition & 1 deletion mate_flutter/lib/src/material/text_theme.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import 'package:flutter/src/painting/text_style.dart' as _i3;

/// class TextTheme with Diagnosticable
class TextTheme$Mate extends _i1.TextTheme with _i2.Mate {
/// TextTheme TextTheme({TextStyle? displayLarge, TextStyle? displayMedium, TextStyle? displaySmall, TextStyle? headlineLarge, TextStyle? headlineMedium, TextStyle? headlineSmall, TextStyle? titleLarge, TextStyle? titleMedium, TextStyle? titleSmall, TextStyle? bodyLarge, TextStyle? bodyMedium, TextStyle? bodySmall, TextStyle? labelLarge, TextStyle? labelMedium, TextStyle? labelSmall, TextStyle? headline1, TextStyle? headline2, TextStyle? headline3, TextStyle? headline4, TextStyle? headline5, TextStyle? headline6, TextStyle? subtitle1, TextStyle? subtitle2, TextStyle? bodyText1, TextStyle? bodyText2, TextStyle? caption, TextStyle? button, TextStyle? overline})
/// TextTheme TextTheme({TextStyle? displayLarge, TextStyle? displayMedium, TextStyle? displaySmall, TextStyle? headlineLarge, TextStyle? headlineMedium, TextStyle? headlineSmall, TextStyle? titleLarge, TextStyle? titleMedium, TextStyle? titleSmall, TextStyle? bodyLarge, TextStyle? bodyMedium, TextStyle? bodySmall, TextStyle? labelLarge, TextStyle? labelMedium, TextStyle? labelSmall, TextStyle? headline1, TextStyle? headline2, TextStyle? headline3, TextStyle? headline4, TextStyle? headline5, TextStyle? headline6, TextStyle? subtitle1, TextStyle? subtitle2, TextStyle? bodyText1, TextStyle? bodyText2, TextStyle? caption, TextStyle? overview, TextStyle? overline})
TextTheme$Mate({
/// optionalParameters: {TextStyle? displayLarge} , default:none
super.displayLarge,
Expand Down
10 changes: 5 additions & 5 deletions mate_flutter/lib/src/semantics/semantics.dart
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,7 @@ class SemanticsHintOverrides$Mate extends _i1.SemanticsHintOverrides with _i2.Ma

/// class SemanticsProperties extends DiagnosticableTree
class SemanticsProperties$Mate extends _i1.SemanticsProperties with _i2.Mate {
/// SemanticsProperties SemanticsProperties({bool? enabled, bool? checked, bool? mixed, bool? expanded, bool? selected, bool? toggled, bool? button, bool? link, bool? header, bool? textField, bool? slider, bool? keyboardKey, bool? readOnly, bool? focusable, bool? focused, bool? inMutuallyExclusiveGroup, bool? hidden, bool? obscured, bool? multiline, bool? scopesRoute, bool? namesRoute, bool? image, bool? liveRegion, int? maxValueLength, int? currentValueLength, String? identifier, String? label, AttributedString? attributedLabel, String? value, AttributedString? attributedValue, String? increasedValue, AttributedString? attributedIncreasedValue, String? decreasedValue, AttributedString? attributedDecreasedValue, String? hint, String? tooltip, AttributedString? attributedHint, SemanticsHintOverrides? hintOverrides, TextDirection? textDirection, SemanticsSortKey? sortKey, SemanticsTag? tagForChildren, void Function()? onTap, void Function()? onLongPress, void Function()? onScrollLeft, void Function()? onScrollRight, void Function()? onScrollUp, void Function()? onScrollDown, void Function()? onIncrease, void Function()? onDecrease, void Function()? onCopy, void Function()? onCut, void Function()? onPaste, void Function(bool)? onMoveCursorForwardByCharacter, void Function(bool)? onMoveCursorBackwardByCharacter, void Function(bool)? onMoveCursorForwardByWord, void Function(bool)? onMoveCursorBackwardByWord, void Function(TextSelection)? onSetSelection, void Function(String)? onSetText, void Function()? onDidGainAccessibilityFocus, void Function()? onDidLoseAccessibilityFocus, void Function()? onDismiss, Map<CustomSemanticsAction, void Function()>? customSemanticsActions})
/// SemanticsProperties SemanticsProperties({bool? enabled, bool? checked, bool? mixed, bool? expanded, bool? selected, bool? toggled, bool? overview, bool? link, bool? header, bool? textField, bool? slider, bool? keyboardKey, bool? readOnly, bool? focusable, bool? focused, bool? inMutuallyExclusiveGroup, bool? hidden, bool? obscured, bool? multiline, bool? scopesRoute, bool? namesRoute, bool? image, bool? liveRegion, int? maxValueLength, int? currentValueLength, String? identifier, String? label, AttributedString? attributedLabel, String? value, AttributedString? attributedValue, String? increasedValue, AttributedString? attributedIncreasedValue, String? decreasedValue, AttributedString? attributedDecreasedValue, String? hint, String? tooltip, AttributedString? attributedHint, SemanticsHintOverrides? hintOverrides, TextDirection? textDirection, SemanticsSortKey? sortKey, SemanticsTag? tagForChildren, void Function()? onTap, void Function()? onLongPress, void Function()? onScrollLeft, void Function()? onScrollRight, void Function()? onScrollUp, void Function()? onScrollDown, void Function()? onIncrease, void Function()? onDecrease, void Function()? onCopy, void Function()? onCut, void Function()? onPaste, void Function(bool)? onMoveCursorForwardByCharacter, void Function(bool)? onMoveCursorBackwardByCharacter, void Function(bool)? onMoveCursorForwardByWord, void Function(bool)? onMoveCursorBackwardByWord, void Function(TextSelection)? onSetSelection, void Function(String)? onSetText, void Function()? onDidGainAccessibilityFocus, void Function()? onDidLoseAccessibilityFocus, void Function()? onDismiss, Map<CustomSemanticsAction, void Function()>? customSemanticsActions})
SemanticsProperties$Mate({
/// optionalParameters: {bool? enabled} , default:none
super.enabled,
Expand All @@ -497,7 +497,7 @@ class SemanticsProperties$Mate extends _i1.SemanticsProperties with _i2.Mate {
/// optionalParameters: {bool? toggled} , default:none
super.toggled,

/// optionalParameters: {bool? button} , default:none
/// optionalParameters: {bool? overview} , default:none
super.button,

/// optionalParameters: {bool? link} , default:none
Expand Down Expand Up @@ -695,8 +695,8 @@ class SemanticsProperties$Mate extends _i1.SemanticsProperties with _i2.Mate {
init: toggled,
isNamed: true,
),
'button': _i2.BuilderArg<bool?>(
name: 'button',
'overview': _i2.BuilderArg<bool?>(
name: 'overview',
init: button,
isNamed: true,
),
Expand Down Expand Up @@ -986,7 +986,7 @@ class SemanticsProperties$Mate extends _i1.SemanticsProperties with _i2.Mate {
expanded: p.get('expanded').build(),
selected: p.get('selected').build(),
toggled: p.get('toggled').build(),
button: p.get('button').build(),
button: p.get('overview').build(),
link: p.get('link').build(),
header: p.get('header').build(),
textField: p.get('textField').build(),
Expand Down
10 changes: 5 additions & 5 deletions mate_flutter/lib/src/widgets/basic.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4589,7 +4589,7 @@ class MetaData$Mate extends _i1.MetaData with _i2.Mate {

/// class Semantics extends SingleChildRenderObjectWidget
class Semantics$Mate extends _i1.Semantics with _i2.Mate {
/// Semantics Semantics({Key? key, Widget? child, bool container = false, bool explicitChildNodes = false, bool excludeSemantics = false, bool blockUserActions = false, bool? enabled, bool? checked, bool? mixed, bool? selected, bool? toggled, bool? button, bool? slider, bool? keyboardKey, bool? link, bool? header, bool? textField, bool? readOnly, bool? focusable, bool? focused, bool? inMutuallyExclusiveGroup, bool? obscured, bool? multiline, bool? scopesRoute, bool? namesRoute, bool? hidden, bool? image, bool? liveRegion, bool? expanded, int? maxValueLength, int? currentValueLength, String? identifier, String? label, AttributedString? attributedLabel, String? value, AttributedString? attributedValue, String? increasedValue, AttributedString? attributedIncreasedValue, String? decreasedValue, AttributedString? attributedDecreasedValue, String? hint, AttributedString? attributedHint, String? tooltip, String? onTapHint, String? onLongPressHint, TextDirection? textDirection, SemanticsSortKey? sortKey, SemanticsTag? tagForChildren, void Function()? onTap, void Function()? onLongPress, void Function()? onScrollLeft, void Function()? onScrollRight, void Function()? onScrollUp, void Function()? onScrollDown, void Function()? onIncrease, void Function()? onDecrease, void Function()? onCopy, void Function()? onCut, void Function()? onPaste, void Function()? onDismiss, void Function(bool)? onMoveCursorForwardByCharacter, void Function(bool)? onMoveCursorBackwardByCharacter, void Function(TextSelection)? onSetSelection, void Function(String)? onSetText, void Function()? onDidGainAccessibilityFocus, void Function()? onDidLoseAccessibilityFocus, Map<CustomSemanticsAction, void Function()>? customSemanticsActions})
/// Semantics Semantics({Key? key, Widget? child, bool container = false, bool explicitChildNodes = false, bool excludeSemantics = false, bool blockUserActions = false, bool? enabled, bool? checked, bool? mixed, bool? selected, bool? toggled, bool? overview, bool? slider, bool? keyboardKey, bool? link, bool? header, bool? textField, bool? readOnly, bool? focusable, bool? focused, bool? inMutuallyExclusiveGroup, bool? obscured, bool? multiline, bool? scopesRoute, bool? namesRoute, bool? hidden, bool? image, bool? liveRegion, bool? expanded, int? maxValueLength, int? currentValueLength, String? identifier, String? label, AttributedString? attributedLabel, String? value, AttributedString? attributedValue, String? increasedValue, AttributedString? attributedIncreasedValue, String? decreasedValue, AttributedString? attributedDecreasedValue, String? hint, AttributedString? attributedHint, String? tooltip, String? onTapHint, String? onLongPressHint, TextDirection? textDirection, SemanticsSortKey? sortKey, SemanticsTag? tagForChildren, void Function()? onTap, void Function()? onLongPress, void Function()? onScrollLeft, void Function()? onScrollRight, void Function()? onScrollUp, void Function()? onScrollDown, void Function()? onIncrease, void Function()? onDecrease, void Function()? onCopy, void Function()? onCut, void Function()? onPaste, void Function()? onDismiss, void Function(bool)? onMoveCursorForwardByCharacter, void Function(bool)? onMoveCursorBackwardByCharacter, void Function(TextSelection)? onSetSelection, void Function(String)? onSetText, void Function()? onDidGainAccessibilityFocus, void Function()? onDidLoseAccessibilityFocus, Map<CustomSemanticsAction, void Function()>? customSemanticsActions})
Semantics$Mate({
/// optionalParameters: {Key? key} , default:none
super.key,
Expand Down Expand Up @@ -4624,7 +4624,7 @@ class Semantics$Mate extends _i1.Semantics with _i2.Mate {
/// optionalParameters: {bool? toggled} , default:none
super.toggled,

/// optionalParameters: {bool? button} , default:none
/// optionalParameters: {bool? overview} , default:none
super.button,

/// optionalParameters: {bool? slider} , default:none
Expand Down Expand Up @@ -4851,8 +4851,8 @@ class Semantics$Mate extends _i1.Semantics with _i2.Mate {
init: toggled,
isNamed: true,
),
'button': _i2.BuilderArg<bool?>(
name: 'button',
'overview': _i2.BuilderArg<bool?>(
name: 'overview',
init: button,
isNamed: true,
),
Expand Down Expand Up @@ -5147,7 +5147,7 @@ class Semantics$Mate extends _i1.Semantics with _i2.Mate {
mixed: p.get('mixed').build(),
selected: p.get('selected').build(),
toggled: p.get('toggled').build(),
button: p.get('button').build(),
button: p.get('overview').build(),
slider: p.get('slider').build(),
keyboardKey: p.get('keyboardKey').build(),
link: p.get('link').build(),
Expand Down
2 changes: 1 addition & 1 deletion note/lib/note.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
library note;

export 'src/note_core.dart' show NoteSystem, Note, NotePage, NoteContent, Outline, OutlineNode, NoteContentWidgetMixin, Pen, NoteCell, NoteSourceData, DeferredNotePageBuilder, NoteContentExt, NoteContentExts, NoteContentArg;
export 'src/content_builtin.dart' show MarkdownPenExtension, WidgetContent, WindowContent;
export 'src/content_builtin.dart' show MarkdownPenExtension, WidgetContent, MockupContent;
16 changes: 9 additions & 7 deletions note/lib/src/content_builtin.dart
Original file line number Diff line number Diff line change
Expand Up @@ -235,34 +235,36 @@ class _PreBuilder extends MarkdownElementBuilder {
}
}

/// 在页面上表现一个样机的模样:模仿浏览器、桌面窗口、手机
/// 我们约束child为tight模式,以模仿最外层窗口
class WindowContent extends StatelessWidget {
/// 参考: https://daisyui.com/components/mockup-window/
class MockupContent extends StatelessWidget {
final Widget? child;
final double? width;
final double? height;
final String title;

WindowContent({
const MockupContent({
super.key,
this.title = "模仿窗口固定宽高限制",
this.title = "样机:固定宽高限制",
double? width,
double? height,
this.child,
}) : width = (width == null || width == double.infinity) ? 400 : width,
height = (height == null || height == double.infinity) ? 50 : height;

/// call() == withChild copy
WindowContent call(Widget child) {
return WindowContent(
MockupContent call(Widget child) {
return MockupContent(
key: key,
width: width,
height: height,
child: child,
);
}

WindowContent withChild(Widget child) {
return WindowContent(
MockupContent withChild(Widget child) {
return MockupContent(
key: key,
child: child,
);
Expand Down
2 changes: 1 addition & 1 deletion note_test/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ class _MyHomePageState extends State<MyHomePage> {
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
const Text(
'You have pushed the button this many times:',
'You have pushed the overview this many times:',
),
Text(
'$_counter',
Expand Down
6 changes: 3 additions & 3 deletions spaces/flutter_note/lib/note_app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import 'package:shared_preferences/shared_preferences.dart';
// ]),
// Path<void>("layout", meta: layoutNote),
// Path<void>("material", kids: [
// Path<void>("button", kids: [
// Path<void>("overview", kids: [
// Path<void>("ElevatedButton", meta: widgetElevatedButtonNote),
// ]),
// Path<void>("text", kids: [
Expand Down Expand Up @@ -64,12 +64,12 @@ class Notes extends BaseNotes with Navigable {
Screen get initial {
String? last = sharedPreferences.getString("flutter_note.notes.location");
if (last == null) {
return switchTo(welcome.path);
return switchTo(widgets_container_widgets_bar.path);
}
if (BaseNotes.rootroot.contains(last)) {
return switchTo(last);
}
return switchTo(welcome.path);
return switchTo(widgets_container_widgets_bar.path);
}

@override
Expand Down
Loading

0 comments on commit 48c36fa

Please sign in to comment.