Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improvements and Tests #6

Merged
merged 26 commits into from
Aug 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ jobs:
architecture: x64
cache: true

- name: Disable flutter cli animations
run: flutter config --no-cli-animations

- name: Install dependencies
run: dart pub get

Expand All @@ -48,8 +51,8 @@ jobs:
- name: Analyze static code
run: dart analyze

# - name: Run tests
# run: flutter test --no-pub --coverage
- name: Run tests
run: flutter test --no-pub --coverage

- name: Check publish warnings
run: dart pub publish --dry-run
Expand Down
3 changes: 1 addition & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@

- Add optional size and scaleFactor parameters
- Introduce constructors on Gutter: `Gutter.tiny`, `Gutter.small`, `Gutter.medium`, `Gutter.large`, `Gutter.extraLarge`
- Add `Gutter.expand` and `Gutter.singleLine`
- Add extension to add Gutter on Lists
- Migrate to `flutter_adaptive_scaffold` to remove deprecated package
- Add `AdaptiveGutter` that switches `Gutter` size based on the current breakpoint
- Add `PaddingGutter` that adds material padding
- BREAKING CHANGE: Removal of `Gap`
- BREAKING CHANGE: Rename `Margin` to `GutterMargin`

## [1.0.3] - 07/27/2024

Expand Down
17 changes: 14 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,10 @@ Gutters and margins:
definition (small gap on small screens, larger gap on large screens)

`Gutter.tiny`, `Gutter.small`, `Gutter.medium`, `Gutter.large` and `Gutter.extraLarge` all provide gaps that are factors of the base gutter
size for situations where larger or smaller gaps are more appropriate. `Gutter.expand` can be used to expand the Gutter on the crossAxis.
The default sizing is used on: `Gutter` or `Gutter.medium`.
size for situations where larger or smaller gaps are more appropriate. The default sizing is used on: `Gutter` or `Gutter.medium`.

For more flexibility, you can also use the provided extension on `BuildContext` to reference the
gutter and margin sizes directly (`context.gutter`, `context.margin`).
gutter and margin sizes directly (`context.gutter`, `context.gutterLarge`, `context.margin`, etc).

It is possible to manually create a `Gutter` with a specific `size` or `scaleFactor`.

Expand Down Expand Up @@ -49,6 +48,18 @@ On Iterable Widgets you can set a Gutter on every item:
].withGutter() // Optional parameter to set which Gutter size you want to use
```

Using `GutterPadding` you can add a `Widget` that insets its child by the material padding or the given padding.

```dart
const GutterPadding.only(
left: Gutter.medium(),
right: Gutter.small(),
top: Gutter(size: 20),
bottom: Gutter.medium(scaleFactor: 3),
child: ColoredBox(color: Colors.blue, child: Text('Child')),
)
```

You can use `Gutter` with other packages using `GutterConfiguration` and `widgetToAxis` (see example).

## Supported Widgets
Expand Down
4 changes: 2 additions & 2 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,14 @@ class _MyHomePageState extends State<MyHomePage> {
),
const Gutter.medium(),
const Text('times'),
const Gutter(size: 20, scaleFactor: 3, type: GutterType.large),
const Gutter.from(size: 20, scaleFactor: 3),
const Text('test'),
const AdaptiveGutter(
small: Gutter.tiny(),
medium: Gutter.large(),
large: Gutter.extraLarge(),
),
].withGutter(),
],
),
),
),
Expand Down
29 changes: 0 additions & 29 deletions example/test/widget_test.dart

This file was deleted.

6 changes: 4 additions & 2 deletions lib/flutter_gutter.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
export 'src/adaptive_gutter.dart';
export 'src/axis_aware.dart';
export 'src/breakpoints_utils.dart';
export 'src/axis_aware_orientation.dart';
export 'src/gutter.dart';
export 'src/gutter_configuration.dart';
export 'src/gutter_extensions.dart';
export 'src/gutter_margin.dart';
export 'src/gutter_type.dart';
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import 'package:flutter/material.dart';

import '../flutter_gutter.dart';

/// Axis-aware widget that provides the orientation.
class AxisAware extends StatelessWidget {
/// Creates a new [AxisAware] widget.
const AxisAware({
class AxisAwareOrientation extends StatelessWidget {
/// Creates a new [AxisAwareOrientation] widget.
const AxisAwareOrientation({
super.key,
required this.builder,
});
Expand Down
62 changes: 0 additions & 62 deletions lib/src/breakpoints_utils.dart

This file was deleted.

Loading
Loading