Skip to content

Commit

Permalink
[flutter_web] clean
Browse files Browse the repository at this point in the history
  • Loading branch information
chen56 committed May 20, 2024
1 parent d7445cb commit 610dbf3
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 62 deletions.
8 changes: 4 additions & 4 deletions notes/flutter_web/lib/routes.g.dart
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import 'package:flutter_web/routes/notes/dev/devtool/page.dart' as _devtool_page
import 'package:flutter_web/routes/notes/dev/devtool/vmservice/page.dart' as _vmservice_page;
import 'package:flutter_web/routes/notes/dev/debug/page.dart' as _debug_page;
import 'package:flutter_web/routes/notes/cheatsheets/color_roles/page.dart' as _color_roles_page;
import 'package:flutter_web/routes/notes/cheatsheets/index/page.dart' as _index_page;
import 'package:flutter_web/routes/notes/cheatsheets/widgets/page.dart' as _widgets_page;
import 'package:flutter_web/routes/notes/thinking_in_ui/readable_html_vs_dart/page.dart' as _readable_html_vs_dart_page;
import 'package:flutter_web/routes/notes/x.note_inside/how_note_work/page.dart' as _how_note_work_page;
import 'package:flutter_web/routes/notes/x.note_inside/mockup_content/page.dart' as _mockup_content_page;
Expand Down Expand Up @@ -99,7 +99,7 @@ mixin RoutesMixin {
]),
ToNote('cheatsheets', children: [
ToNote('color_roles', page: _color_roles_page.build, pageAnno: _Pages.notes_cheatsheets_color_roles),
ToNote('index', page: _index_page.build, pageAnno: _Pages.notes_cheatsheets_index),
ToNote('widgets', page: _widgets_page.build, pageAnno: _Pages.notes_cheatsheets_widgets),
]),
ToNote('thinking_in_ui', children: [
ToNote('readable_html_vs_dart', page: _readable_html_vs_dart_page.build),
Expand Down Expand Up @@ -166,7 +166,7 @@ mixin RoutesMixin {
late final ToNote routes_notes_dev_devtool_vmservice = (root.find('/notes/dev/devtool/vmservice')! as ToNote);
late final ToNote routes_notes_dev_debug = (root.find('/notes/dev/debug')! as ToNote);
late final ToNote routes_notes_cheatsheets_color_roles = (root.find('/notes/cheatsheets/color_roles')! as ToNote);
late final ToNote routes_notes_cheatsheets_index = (root.find('/notes/cheatsheets/index')! as ToNote);
late final ToNote routes_notes_cheatsheets_widgets = (root.find('/notes/cheatsheets/widgets')! as ToNote);
late final ToNote routes_notes_thinking_in_ui_readable_html_vs_dart = (root.find('/notes/thinking_in_ui/readable_html_vs_dart')! as ToNote);
late final ToNote routes_notes_x_note_inside_how_note_work = (root.find('/notes/x.note_inside/how_note_work')! as ToNote);
late final ToNote routes_notes_x_note_inside_mockup_content = (root.find('/notes/x.note_inside/mockup_content')! as ToNote);
Expand All @@ -191,7 +191,7 @@ class Routes with RoutesMixin {}
class _Pages {
static const notes = NoteAnnotation(label: "笔记");
static const notes_cheatsheets_color_roles = NoteAnnotation(label: "Color roles", publish: true);
static const notes_cheatsheets_index = NoteAnnotation(label: "Widgets cheatsheets", publish: true);
static const notes_cheatsheets_widgets = NoteAnnotation(label: "Widgets", publish: true);
static const notes_widgets_specific_widgets_button = NoteAnnotation(label: "按钮", publish: false);
static const notes_Improve_app = NoteAnnotation(label: "完善应用的技术");
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import 'dart:math';

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_web/views/cell_view.dart';
import 'package:flutter_web/views/cell_layouts.dart';
import 'package:you_flutter/note.dart';
import 'package:you_flutter/state.dart';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,62 +1,9 @@
import 'package:flutter/material.dart';
import 'package:flutter_staggered_grid_view/flutter_staggered_grid_view.dart';

class CellView extends StatelessWidget {
final String title;
final Widget child;
final double? width;
final double? height;
final BoxConstraints? constraints;

const CellView({
super.key,
required this.title,
this.width,
this.height,
this.constraints,
required this.child,
});

@override
Widget build(BuildContext context) {
var colors = Theme.of(context).colorScheme;
var textStyle = Theme.of(context).textTheme;
return Container(
decoration: BoxDecoration(color: colors.surfaceContainerLow, borderRadius: BorderRadius.circular(8.0), border: Border.all(width: 1, color: colors.outlineVariant)),
child: Column(
children: [
Container(
height: 36,
color: colors.surfaceContainerHigh,
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
const SizedBox(width: 10),
Text(title, style: textStyle.titleMedium),
const Spacer(),
IconButton(icon: const Icon(size: 24, Icons.code), onPressed: () {}),
IconButton(icon: const Icon(size: 24, Icons.fullscreen), onPressed: () {}),
],
),
),
Container(
width: width,
height: height,
constraints: constraints,
// color: colors.surface,

padding: const EdgeInsets.all(12),
child: child,
),
],
),
);
}
}

class Level1GridLayout extends StatelessWidget {
final String title;
final List<CellView> children;
final List<Widget> children;
final double? cellWidth;

const Level1GridLayout({super.key, required this.title, this.cellWidth, required this.children});
Expand Down Expand Up @@ -103,7 +50,7 @@ class Level1GridLayout extends StatelessWidget {

class Level1MasonryLayout extends StatelessWidget {
final String title;
final List<CellView> children;
final List<Widget> children;
final double? cellWidth;

const Level1MasonryLayout({super.key, required this.title, this.cellWidth, required this.children});
Expand Down
3 changes: 1 addition & 2 deletions packages/you_flutter/lib/note.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ library note;

import 'package:meta/meta.dart';

export 'src/note/note.dart' show ToNote, NoteAnnotation, NoteBuilder, NoteLayoutBuilder, NoteMixin, Cell;
export 'src/note/note.dart' show ToNote, NoteAnnotation, NoteBuilder, NoteLayoutBuilder, NoteMixin, Cell, CellView;

export 'src/note/contents/contents.dart' show contents, Contents;
export 'src/note/contents/mockup.dart' show MockupWindow;
export 'src/note/contents/markdown_content.dart' show MD;

56 changes: 56 additions & 0 deletions packages/you_flutter/lib/src/note/note.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:meta/meta.dart';
import 'package:meta/meta_meta.dart';
Expand Down Expand Up @@ -230,3 +231,58 @@ base class Cell {
return (dartTrace: dartTrace, callerFrame: findCallerLineInDartTrace(dartTrace, location));
}
}



class CellView extends StatelessWidget {
final String title;
final Widget child;
final double? width;
final double? height;
final BoxConstraints? constraints;

const CellView({
super.key,
required this.title,
this.width,
this.height,
this.constraints,
required this.child,
});

@override
Widget build(BuildContext context) {
var colors = Theme.of(context).colorScheme;
var textStyle = Theme.of(context).textTheme;
return Container(
decoration: BoxDecoration(color: colors.surfaceContainerLow, borderRadius: BorderRadius.circular(8.0), border: Border.all(width: 1, color: colors.outlineVariant)),
child: Column(
children: [
Container(
height: 36,
color: colors.surfaceContainerHigh,
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
const SizedBox(width: 10),
Text(title, style: textStyle.titleMedium),
const Spacer(),
IconButton(icon: const Icon(size: 24, Icons.code), onPressed: () {}),
IconButton(icon: const Icon(size: 24, Icons.fullscreen), onPressed: () {}),
],
),
),
Container(
width: width,
height: height,
constraints: constraints,
// color: colors.surface,

padding: const EdgeInsets.all(12),
child: child,
),
],
),
);
}
}

0 comments on commit 610dbf3

Please sign in to comment.