Skip to content

Commit

Permalink
[flutter_web] notes widgets: LayoutCore_ContainerCell
Browse files Browse the repository at this point in the history
  • Loading branch information
chen56 committed Jun 13, 2024
1 parent 9c4bbac commit af783e5
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 20 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import 'package:flutter/material.dart';

main() {
runApp(const MaterialApp(home: Scaffold(body: LayoutCore_ContainerCell())));
}

// ignore: camel_case_types
class LayoutCore_ContainerCell extends StatelessWidget {
const LayoutCore_ContainerCell({super.key});

@override
Widget build(BuildContext context) {
var colors = Theme.of(context).colorScheme;
return Wrap(children: [
Container(
width: 100,
height: 100,
alignment: Alignment.center,
decoration: BoxDecoration(color: colors.surface, borderRadius: BorderRadius.circular(4.0), boxShadow: [
BoxShadow(color: colors.shadow.withOpacity(0.2), spreadRadius: 2, blurRadius: 2, offset: const Offset(2, 1)),
]),
child: const Text("模仿Card\nImitate Card"))
]);
}
}
22 changes: 2 additions & 20 deletions notes/flutter_web/lib/routes/notes/cheatsheets/widgets/page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import 'package:flutter/services.dart';
import 'package:flutter_web/app.dart';
import 'package:flutter_web/routes/notes/cheatsheets/widgets/_examples/Input_ButtonStyleButton.dart';
import 'package:flutter_web/routes/notes/cheatsheets/widgets/_examples/Input_FloatingActionButton.dart';
import 'package:flutter_web/routes/notes/cheatsheets/widgets/_examples/LayoutCore_ContainerCell.dart';
import 'package:flutter_web/routes/notes/cheatsheets/widgets/_examples/Navigation_AppBar.dart';
import 'package:flutter_web/routes/notes/cheatsheets/widgets/_examples/Navigation_BottomAppBar.dart';
import 'package:flutter_web/routes/notes/cheatsheets/widgets/_examples/Navigation_Menu.dart';
Expand All @@ -22,7 +23,6 @@ import 'package:you_flutter/state.dart';

@NoteAnnotation(label: "Widgets", publish: true)
void build(BuildContext context, Cell print) {
LayoutCore layoutCore = LayoutCore();
ButtonAndInput buttonAndInput = ButtonAndInput();
TextAndInfoAndTip textAndInfoAndTip = TextAndInfoAndTip();
AdvancedTemplateContainer advancedTemplateContainer = AdvancedTemplateContainer();
Expand All @@ -46,7 +46,7 @@ void build(BuildContext context, Cell print) {
FlutterExample(title: "Placeholder", source: assets.lib_routes_notes_cheatsheets_widgets__examples_Spacer_Placeholder_dart, child: const Spacer_Placeholder()),
]),
Level1MasonryLayout(title: "布局,Layout", cellWidth: 500, children: [
FlutterExample(title: "Container", child: layoutCore.containerCell()),
FlutterExample(title: "Container", source: assets.lib_routes_notes_cheatsheets_widgets__examples_LayoutCore_ContainerCell_dart, child: const LayoutCore_ContainerCell()),
]),
Level1MasonryLayout(title: "button&input&form", cellWidth: 500, children: [
FlutterExample(title: "ButtonStyleButton", source: assets.lib_routes_notes_cheatsheets_widgets__examples_Input_ButtonStyleButton_dart, child: const Input_ButtonStyleButtonExample()),
Expand Down Expand Up @@ -766,24 +766,6 @@ class ButtonAndInput {
}
}

class LayoutCore {
Widget containerCell() {
return Builder(builder: (context) {
var colors = Theme.of(context).colorScheme;
return Wrap(children: [
Container(
width: 100,
height: 100,
alignment: Alignment.center,
decoration: BoxDecoration(color: colors.surface, borderRadius: BorderRadius.circular(4.0), boxShadow: [
BoxShadow(color: colors.shadow.withOpacity(0.2), spreadRadius: 2, blurRadius: 2, offset: const Offset(2, 1)),
]),
child: const Text("模仿Card\nImitate Card"))
]);
});
}
}

class TextAndInfoAndTip {
Widget circleAvatar() {
return const Row(children: [
Expand Down

0 comments on commit af783e5

Please sign in to comment.