Skip to content

Commit dbf006f

Browse files
committed
Initial commit
1 parent f4392b6 commit dbf006f

8 files changed

Lines changed: 467 additions & 213 deletions

File tree

CHANGELOG.md

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,3 @@
1-
## 0.2.1
2-
- Added nested coroutine support
3-
- Fixed concurrent access issues (@luanpotter 💙)
4-
- Added [Flame game engine](https://flame-engine.org/) example (@luanpotter 💙)
5-
- Improved async tests (@luanpotter 💙)
6-
- Improved CI & docgen tasks
7-
8-
## 0.2.0
9-
- Added async coroutine support
10-
- (**breaking!**) Removed `dart:coroutine/coroutine.dart` barrel import (use `dart:coroutines/sync.dart` or `dart:coroutines/async.dart` instead)
11-
- Improved documentation
12-
13-
## 0.1.1
14-
15-
- Fixed coroutine instance not being removed after completion
16-
- Implemented `isCoroutineRunning`
17-
- Improved inlining
18-
19-
201
## 0.1.0
212

223
- Initial release
23-
- Implemented synchronous coroutines
24-
- Added tests

README.md

Lines changed: 75 additions & 99 deletions
Original file line numberDiff line numberDiff line change
@@ -1,129 +1,105 @@
11
<div align="center">
22

3-
# dart_package_template
4-
GitHub template repository for Dart packages, ready for pub.dev publication.
3+
# auto_layout_frame
4+
Flutter implementation of Figma's Auto Layout frames with support for alignment, padding, gap, resizing, and overflow behavior.
55

66
```bash
7-
dart pub get dart_package_template
7+
flutter pub add auto_layout_frame
88
```
99

1010
<!-- Badges -->
1111
<!-- remember to update these badges when using the template! -->
1212

13-
[![License: MPL 2.0](https://img.shields.io/badge/License-MPL_2.0-brightgreen.svg)](LICENSE)
14-
[![build](https://github.com/kerberjg/dart_package_template/actions/workflows/package.yaml/badge.svg)](https://github.com/kerberjg/dart_package_template/actions/workflows/package.yaml)
15-
[![example](https://github.com/kerberjg/dart_package_template/actions/workflows/example.yaml/badge.svg)](https://github.com/kerberjg/dart_package_template/actions/workflows/example.yaml)
16-
[![stars](https://img.shields.io/github/stars/kerberjg/dart_package_template.svg)](https://github.com/kerberjg/dart_package_template/stargazers)
13+
[![License: MPL-2.0](https://img.shields.io/badge/License-MPL_2.0-brightgreen.svg)](LICENSE)
14+
[![build](https://github.com/kerberjg/auto_layout_frame.dart/actions/workflows/package.yaml/badge.svg)](https://github.com/kerberjg/auto_layout_frame.dart/actions/workflows/package.yaml)
15+
[![example](https://github.com/kerberjg/auto_layout_frame.dart/actions/workflows/example.yaml/badge.svg)](https://github.com/kerberjg/auto_layout_frame.dart/actions/workflows/example.yaml)
16+
[![stars](https://img.shields.io/github/stars/kerberjg/auto_layout_frame.dart.svg)](https://github.com/kerberjg/auto_layout_frame.dart/stargazers)
1717
<br/>
18-
[![pub package](https://img.shields.io/pub/v/dart_package_template?logo=dart)](https://pub.dev/packages/dart_package_template)
19-
[![pub score](https://img.shields.io/pub/points/dart_package_template?logo=dart)](https://pub.dev/packages/dart_package_template/score)
20-
[![likes](https://img.shields.io/pub/likes/dart_package_template?logo=dart)](https://pub.dev/packages/dart_package_template/likes)
18+
[![pub package](https://img.shields.io/pub/v/auto_layout_frame?logo=dart)](https://pub.dev/packages/auto_layout_frame)
19+
[![pub score](https://img.shields.io/pub/points/auto_layout_frame?logo=dart)](https://pub.dev/packages/auto_layout_frame/score)
20+
[![likes](https://img.shields.io/pub/likes/auto_layout_frame?logo=dart)](https://pub.dev/packages/auto_layout_frame/likes)
2121

2222
</div>
2323

2424
### 💙 Use cases
25-
- 🏝️ **A weekend project**: quickly start a new OSS Dart project with everything set up
26-
- 📚 **Learning**: understand best practices for Dart package structure, linting, testing, and CI
27-
- 💻 **Production-ready boilerplate**: complete starting point for a high-quality Dart package
25+
- 🎨 **Figma-like layouts**: Replicate Figma's Auto Layout behavior in your Flutter apps
26+
- 📱 **Responsive UI**: Build flexible, responsive layouts that adapt to different screen sizes
27+
- 🚀 **Rapid prototyping**: Quickly create complex layouts with intuitive, declarative syntax
2828

2929

3030
## ✨ Features
31-
- Unopinionated! A minimal example focused on compliance with Dart guidelines
32-
- Ready for immediate package publication to [pub.dev](https://pub.dev/)
33-
- Pre-configured `pubspec.yaml` with recommended fields
34-
- Multiple example projects in the `example/` directory
35-
- Linting setup with `lints` package for code quality, following the [Effective Dart](https://dart.dev/guides/language/effective-dart) style guide
36-
- (Recommended) [MPL-2.0 License](https://opensource.org/licenses/MPL-2.0) for open source projects
37-
- Unit tests setup with `test` package
38-
- GitHub Actions workflows for automated testing/QA jobs on push events and PRs
39-
40-
This repository is also published as a package on [pub.dev](https://pub.dev/packages/dart_package_template) to make sure it's always kept up to date on the most recent best practices 🫶
41-
42-
#### Coming up next:
43-
- GitHub **Issue/PR templates**
44-
- **CLI utility** for maintenance/updates (separate repo/package)
31+
- **🎯 Alignment**: Control child alignment with `alignChildren` and self alignment with `alignSelf`
32+
- **📏 Padding & Gap**: Set padding around children and gap between them (including auto-spacing with `gap: double.infinity`)
33+
- **📐 Resizing**: Choose from `fixed`, `hugContents`, or `fillContainer` for horizontal and vertical axes
34+
- **↔️ Direction**: Layout children horizontally, vertically, or with wrapping
35+
- **🔄 Overflow handling**: Choose from `none`, `clip`, `visible`, or `scroll` behaviors
36+
- **🪆 Proper nesting**: Automatically handles nested `AutoLayoutFrame`s with correct constraint handling
4537

4638
---
4739

4840
## 🔮 Usage Guide
4941

5042
### Getting Started
43+
Add `auto_layout_frame` to your `pubspec.yaml`:
44+
45+
```bash
46+
flutter pub add auto_layout_frame
47+
```
5148

52-
1. **Create a new repository**
53-
- Click the "Use this template" button on the GitHub page for this repository.
54-
- Fill in the details for your new repository and create it.
55-
- **🛑✋ IMPORTANT!** Make sure to name your new repository and package with underscore separators, **`just_like_this`** as required by Dart.
56-
2. **Clone your new repository**
57-
```bash
58-
git clone <your-repo-url>
59-
cd <your-repo-name>
60-
```
61-
3. **Update `pubspec.yaml`**
62-
- Change the `name`, `description`, `homepage`, `repository`, and `issue_tracker` fields to match your package
63-
- Update the `environment` SDK constraints if necessary
64-
- Update the same fields in `example/**/pubspec.yaml`
65-
4. **Rename the entrypoint file** `lib/dart_package_template.dart` to `lib/<your_package_name>.dart` - this is required by Dart package conventions
66-
5. **Update `README.md`**
67-
- We recommend you keep the sections, titles and the structure of this README as-is
68-
- Update the content to reflect your package's purpose, features, and usage
69-
- Update the badges at the top to reflect your repository and package details
70-
6. **Update `LICENSE`**
71-
- We recommend the included [`MPL-2.0 License`](https://opensource.org/licenses/MPL-2.0) for open source packages, as it's business-friendly and allows for both open source and proprietary use
72-
- If you choose a different license, make sure to update the `LICENSE` file accordingly
73-
74-
### Development & Maintenance
75-
76-
1. Make sure you have the following enabled in your IDE:
77-
- Dart SDK
78-
- Dart/Flutter Linting
79-
- "Format on Save"
80-
2. **Write your code!** implement your package functionality in `lib/`, however you like 💙
81-
- Make sure there are no format/analysis issues reported by your IDE!
82-
3. **Update & run tests** to ensure everything is working as expected:
83-
```bash
84-
dart test
85-
```
86-
4. **Commit & push your changes** to your repository. We recommend using a standardized branching strategy (such as [`GitFlow`](https://nvie.com/posts/a-successful-git-branching-model/)) and maintaining a cohesive commit message/history style.
87-
88-
5. **Create a Pull Request** to merge your changes into the `main` branch.
89-
- Make sure all **GitHub Actions** checks pass before merging
90-
- Once approved, merge the PR into `main`
91-
92-
6. **Review & Refine**
93-
- Regularly review your codebase for improvements, refactoring, and updates to dependencies
94-
- Keep your documentation up to date in `README.md` and `CHANGELOG.md`
95-
96-
97-
### Publishing
98-
99-
1. **Commit the version bump**
100-
- Update the version in `pubspec.yaml` according to [Semantic Versioning](https://semver.org/)
101-
- Update the `CHANGELOG.md` with the changes made in this version
102-
- 🤫 _psst!_ you can use [git log](https://git-scm.com/docs/git-log) command to help you with this, such as `git log --oneline --decorate 1.0.0..HEAD` to see all commits since version 1.0.0
103-
- Name the commit something like `Bump version to x.y.z`
104-
- Create a git tag for the new version: `git tag x.y.z`
105-
106-
2. **Publish to pub.dev**
107-
- **IMPORTANT:** Make sure you have an account on [pub.dev](https://pub.dev/) and are logged in via the command line using `dart pub login`
108-
- First run `dart pub publish --dry-run` to ensure everything is ready for publication
109-
- If the above command reports any issues, address them before proceeding
110-
- When ready, run `dart pub publish` to publish your package
111-
112-
### Next steps
113-
114-
- Share your work! Announce your package on social media, relevant forums, and communities to gain users and feedback.
115-
- Invite collaborators! Open your repository to contributions from others to help improve and maintain the package.
116-
- Keep learning and improving! Regularly update your package with new features, bug fixes, and improvements based on user feedback.
49+
Then import it in your Dart code:
11750

118-
---
51+
```dart
52+
import 'package:auto_layout_frame/auto_layout_frame.dart';
53+
```
54+
55+
### Basic Example
56+
57+
```dart
58+
AutoLayoutFrame(
59+
direction: AutoLayoutDirection.vertical,
60+
gap: 16,
61+
padding: EdgeInsets.all(20),
62+
alignChildren: Alignment.centerLeft,
63+
children: [
64+
Text('Hello'),
65+
Text('World'),
66+
Text('Auto Layout!'),
67+
],
68+
)
69+
```
70+
71+
### Advanced Example
72+
73+
```dart
74+
AutoLayoutFrame(
75+
direction: AutoLayoutDirection.horizontal,
76+
gap: double.infinity, // Auto-space children
77+
padding: EdgeInsets.symmetric(horizontal: 24, vertical: 16),
78+
alignChildren: Alignment.center,
79+
horizontalResizing: AutoLayoutResizing.fillContainer,
80+
verticalResizing: AutoLayoutResizing.hugContents,
81+
backgroundColor: Colors.blue.shade50,
82+
overflow: AutoLayoutOverflowBehavior.scroll,
83+
children: [
84+
Icon(Icons.star),
85+
Text('Featured Item'),
86+
Icon(Icons.arrow_forward),
87+
],
88+
)
89+
```
90+
91+
### Resizing Behaviors
11992

120-
**That's it! 🥳 Congratulations on starting the journey of creating your Dart package!** 🎉🤗💙
93+
- **`AutoLayoutResizing.fixed`**: Fixed size (requires explicit `width`/`height`)
94+
- **`AutoLayoutResizing.hugContents`**: Shrink-wrap to fit children
95+
- **`AutoLayoutResizing.fillContainer`**: Expand to fill available space
12196

122-
The Dart/Flutter community is made better by contributions like yours. Make sure to reach out and engage with others in the community, share experiences with other devs, and keep building amazing things!
97+
### Overflow Behaviors
12398

124-
>
125-
> Our community is warm and welcoming, make sure to act within that spirit! 💖
126-
>
99+
- **`AutoLayoutOverflowBehavior.none`**: Allow overflow errors (default)
100+
- **`AutoLayoutOverflowBehavior.clip`**: Clip overflow to frame bounds
101+
- **`AutoLayoutOverflowBehavior.visible`**: Allow overflow to be visible
102+
- **`AutoLayoutOverflowBehavior.scroll`**: Make frame scrollable
127103

128104
---
129105

@@ -149,7 +125,7 @@ Contributions are welcome! Please open an issue or submit a pull request for any
149125
This package is developed/maintained by the following rockstars!
150126
Your contributions make a difference! 💖
151127

152-
![contributors badge](https://readme-contribs.as93.net/contributors/kerberjg/dart_package_template?textColor=888888)
128+
![contributors badge](https://readme-contribs.as93.net/contributors/kerberjg/auto_layout_frame.dart?textColor=888888)
153129

154130
### Sponsors 🫶✨🥳
155131

example/advanced_example/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ environment:
1111

1212
# Add regular dependencies here.
1313
dependencies:
14-
dart_package_template:
14+
auto_layout_frame:
1515
path: ../../
1616

1717
dev_dependencies:

example/basic/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ environment:
1111

1212
# Add regular dependencies here.
1313
dependencies:
14-
dart_package_template:
14+
auto_layout_frame:
1515
path: ../../
1616

1717
dev_dependencies:

0 commit comments

Comments
 (0)