Skip to content

Commit

Permalink
feat: adding a basic gallery brick
Browse files Browse the repository at this point in the history
  • Loading branch information
erickzanardo committed Sep 4, 2023
1 parent 39c4a20 commit bab3932
Show file tree
Hide file tree
Showing 11 changed files with 124 additions and 0 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ Add the dependency to your `pubspec.yaml`
dashbook: ^0.1.12
```

> Tip ℹ️: If you use [mason](https://pub.dev/packages/mason_cli), a basic Dashbook brick called
`dashbook_gallery` is available in brickhub.dev, which creates a basic gallery in seconds.


A `Dashbook` instance has a collection of the app widgets (Stories) and its variants (Chapters). Here you can see a very simple example of how to use it.

```dart
Expand Down
3 changes: 3 additions & 0 deletions bricks/dashbook_gallery/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# 0.1.0+1

- TODO: Describe initial release.
1 change: 1 addition & 0 deletions bricks/dashbook_gallery/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
TODO: Add your license here.
27 changes: 27 additions & 0 deletions bricks/dashbook_gallery/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# dashbook_gallery

[![Powered by Mason](https://img.shields.io/endpoint?url=https%3A%2F%2Ftinyurl.com%2Fmason-badge)](https://github.com/felangel/mason)

A new brick created with the Mason CLI.

_Generated by [mason][1] 🧱_

## Getting Started 🚀

This is a starting point for a new brick.
A few resources to get you started if this is your first brick template:

- [Official Mason Documentation][2]
- [Code generation with Mason Blog][3]
- [Very Good Livestream: Felix Angelov Demos Mason][4]
- [Flutter Package of the Week: Mason][5]
- [Observable Flutter: Building a Mason brick][6]
- [Meet Mason: Flutter Vikings 2022][7]

[1]: https://github.com/felangel/mason
[2]: https://docs.brickhub.dev
[3]: https://verygood.ventures/blog/code-generation-with-mason
[4]: https://youtu.be/G4PTjA6tpTU
[5]: https://youtu.be/qjA0JFiPMnQ
[6]: https://youtu.be/o8B1EfcUisw
[7]: https://youtu.be/LXhgiF5HiQg
3 changes: 3 additions & 0 deletions bricks/dashbook_gallery/__brick__/gallery/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Gallery

Dashbook based gallery sandbox.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
include: package:very_good_analysis/analysis_options.5.0.0.yaml
linter:
rules:
public_member_api_docs: false
11 changes: 11 additions & 0 deletions bricks/dashbook_gallery/__brick__/gallery/lib/main.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import 'package:dashbook/dashbook.dart';
import 'package:flutter/material.dart';
import 'package:gallery/widgets/widgets.dart';

void main() {
final dashbook = Dashbook();

addTextStories(dashbook);

runApp(dashbook);
}
47 changes: 47 additions & 0 deletions bricks/dashbook_gallery/__brick__/gallery/lib/widgets/text.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import 'package:dashbook/dashbook.dart';
import 'package:flutter/material.dart';

void addTextStories(Dashbook dashbook) {
dashbook
.storiesOf('Text')
.decorator(CenterDecorator())
.add(
'default',
(context) => Text(
context.textProperty('text', 'Hello'),
),
)
.add(
'with style',
(_) => const Text(
'Hello world',
style: TextStyle(
color: Colors.blue,
fontSize: 20,
fontWeight: FontWeight.bold,
),
),
)
.add(
'with overflow',
(_) => const SizedBox(
width: 100,
child: Text(
'Hello world'
'Hello world'
'Hello world'
'Hello world'
'Hello world'
'Hello world'
'Hello world'
'Hello world'
'Hello world'
'Hello world'
'Hello world'
'Hello world'
'Hello world' ,
overflow: TextOverflow.ellipsis,
),
),
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export 'text.dart';
16 changes: 16 additions & 0 deletions bricks/dashbook_gallery/__brick__/gallery/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: gallery
publish_to: none

environment:
sdk: '>=3.0.6 <4.0.0'

dependencies:
dashbook: ^0.1.12
flutter:
sdk: flutter

dev_dependencies:
very_good_analysis: ^5.1.0

flutter:
uses-material-design: true
7 changes: 7 additions & 0 deletions bricks/dashbook_gallery/brick.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
name: dashbook_gallery
description: Creates a simple dashbook gallery app with a minimal structure to get started.

version: 0.1.0+1

environment:
mason: ">=0.1.0-dev.50 <0.1.0"

0 comments on commit bab3932

Please sign in to comment.