Skip to content

Commit

Permalink
Bump to v0.3.0 (#43)
Browse files Browse the repository at this point in the history
  • Loading branch information
fujidaiti authored Feb 24, 2024
1 parent eb563a2 commit 927afa3
Show file tree
Hide file tree
Showing 12 changed files with 113 additions and 30 deletions.
1 change: 1 addition & 0 deletions cookbook/lib/showcase/ai_playlist_generator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ class _AiPlaylistGeneratorExample extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp.router(
debugShowCheckedModeBanner: false,
routerConfig: router,
);
}
Expand Down
1 change: 1 addition & 0 deletions cookbook/lib/showcase/airbnb_mobile_app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class _AirbnbMobileAppExample extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
theme: ThemeData(useMaterial3: false),
home: const _Home(),
);
Expand Down
5 changes: 4 additions & 1 deletion cookbook/lib/showcase/safari/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ class _SafariApp extends StatelessWidget {

@override
Widget build(BuildContext context) {
return const CupertinoApp(home: Home());
return const CupertinoApp(
debugShowCheckedModeBanner: false,
home: Home(),
);
}
}
5 changes: 4 additions & 1 deletion cookbook/lib/showcase/todo_list/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ class _TodoListExample extends StatelessWidget {

@override
Widget build(BuildContext context) {
return const MaterialApp(home: _Home());
return const MaterialApp(
debugShowCheckedModeBanner: false,
home: _Home(),
);
}
}

Expand Down
59 changes: 59 additions & 0 deletions docs/migration-guide-0.3.x.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Migration guide to 0.3.x from 0.2.x

## enablePullToDismiss removed from modal sheets

The `enablePullToDismiss` property, that enables the pull-to-dismiss action for the modal sheets, was removed from the constructors of `ModalSheetRoute`, `ModalSheetPage`, `CupertinoModalSheetRoute,` and `CupertinoModalSheetPage`. Instead, wrap the sheet with a `SheetDismissible` to create the same behavior. See the [tutorial code](https://github.com/fujidaiti/smooth_sheets/blob/90c8f10b89db5b18c1fd382692cfba3a09be67f1/cookbook/lib/tutorial/imperative_modal_sheet.dart#L52) for more detailed usage.

BEFORE:
```dart
ModalSheetRoute(
enablePullToDismiss: true,
(context) => MySheet(...),
);
```

AFTER:
```dart
ModalSheetRoute(
(context) => SheetDismissible(
onDismiss: () {...}, // Dismissing event can be handled here.
child: MySheet(...),
),
);
```

## SnapToNearest can no longer be `const`

`SnapToNearest` can no longer be a `const` in exchange for performance improvement. Due to this, `SnapToNearestEdge` is now used as the default value for `SnappingSheetPhysics.snappingBehavior` instead. If you want the sheet to snap only to the `minPixels` and the `maxPixels`, it is preferable to use `SnapToNearestEdge` rather than `SnapToNearest` as it is more simplified and performant.

BEFORE:

```dart
physics: const StretchingSheetPhysics(
parent: SnappingSheetPhysics(
snappingBehavior: SnapToNearest(
snapTo: [
Extent.proportional(0.2),
Extent.proportional(0.5),
Extent.proportional(1),
],
),
),
),
```

AFTER:

```dart
physics: StretchingSheetPhysics( // Can no longer be a const
parent: SnappingSheetPhysics(
snappingBehavior: SnapToNearest(
snapTo: [
const Extent.proportional(0.2),
const Extent.proportional(0.5),
const Extent.proportional(1),
],
),
),
),
```
9 changes: 9 additions & 0 deletions package/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Changelog

## 0.3.0 Feb 24, 2024

- Add iOS 15 style modal sheet transition (#21)
- Improve the sheet motion while opening/closing the keyboard (#27)
- Add `settings` and `fullscreenDialog` params to the constructors of modal sheet routes and pages (#28)
- Physics improvements (#32)
- Add conditional modal sheet popping feature (#39)
- Remove `enablePullToDismiss` (#44)

## 0.2.0 Jan 29, 2024

- Add a showcase that uses TextFields in a sheet (#2)
Expand Down
53 changes: 30 additions & 23 deletions package/README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
# smooth_sheets

> *Sheet widgets with smooth motion and great flexibility*
<br/>

**smooth_sheets** package offers modal and persistent sheet widgets for Flutter apps. The key features are:
**smooth_sheets** offers modal and persistent sheet widgets for Flutter apps. The key features are:

- **Smooth motion**: The sheets respond to user interaction with smooth, graceful motion.
- **Highly flexible**: Not restricted to a specific design. Both modal and persistent styles are supported, as well as scrollable and non-scrollable widgets.
- **Supports nested navigation**: A sheet is able to have multiple pages and to navigate between the pages with motion animation for transitions.
- **Works with imperative & declarative Navigator API**: No special navigation mechanism is required. The traditional ways such as `Navigator.push` is supported and it works with Navigator 2.0 packages like go_route as well.
- **iOS flavor**: The modal sheets in the style of iOS 15 are supported.

<br/>

Expand All @@ -19,15 +16,23 @@
> [!NOTE]
>
> For documentation of the latest published version, please visit the [package page](https://pub.dev/packages/smooth_sheets) on pub.dev.
> For documentation of the latest published version, please visit the [package site](https://pub.dev/packages/smooth_sheets) on pub.dev.
<br/>

## Migration guide

- [0.2.x to 0.3.x](https://github.com/fujidaiti/smooth_sheets/blob/main/docs/migration-guide-0.3.x.md) 🆕

See [here](https://github.com/fujidaiti/smooth_sheets/blob/main/docs/) for older versions.

<br/>

## Showcases

<table>
<tr>
<td width="30%"><img src="https://github.com/fujidaiti/smooth_sheets/assets/68946713/f34ad8f7-2435-4bed-adbf-2d61c659c803"/></td>
<td width="30%"><img src="https://github.com/fujidaiti/smooth_sheets/assets/68946713/636d5ca8-2883-4447-ad75-47fcb210718c"/></td>
<td>
<h3>AI Playlist Generator</h3>
<p>An AI assistant that helps create a music playlist based on the user's preferences. See <a href="https://github.com/fujidaiti/smooth_sheets/blob/main/cookbook/lib/showcase/ai_playlist_generator.dart">the cookbook</a> for more details.</p>
Expand All @@ -37,11 +42,12 @@
<li>ModalSheetPage</li>
<li>DraggableNavigationSheetPage</li>
<li>ScrollableNavigationSheetPage</li>
<li>SheetDismissible</li>
</ul>
</td>
</tr>
<tr>
<td width="30%"><img src="https://github.com/fujidaiti/smooth_sheets/assets/68946713/ad3f0ec1-fd7b-45d3-94a3-0b17c12b5889"/></td>
<td width="30%"><img src="https://github.com/fujidaiti/smooth_sheets/assets/68946713/cfbc79d1-4290-4dec-88bd-a355a27726ea"/></td>
<td>
<h3>Safari app</h3>
<p>A practical example of ios-style modal sheets. See <a href="https://github.com/fujidaiti/smooth_sheets/blob/main/cookbook/lib/showcase/safari">the cookbook</a> for more details.</p>
Expand Down Expand Up @@ -76,11 +82,14 @@
<li>ScrollableSheet</li>
<li>SheetContentScaffold</li>
<li>SheetKeyboardDismissBehavior</li>
<li>SheetDismissible</li>
</ul>
</td>
</tr>
</table>



<br/>

## Why use this?
Expand Down Expand Up @@ -174,12 +183,13 @@ See also:
### ModalSheets

<div align="center">
<img width="160" src="https://github.com/fujidaiti/smooth_sheets/assets/68946713/67128764-e809-4bff-ae2d-b0884928a2da"/>
<img width="160" src="https://github.com/fujidaiti/smooth_sheets/assets/68946713/f2212362-e193-4dab-8f8b-f24942051775"/>
</div>



A sheet can be displayed as a modal sheet using ModalSheetRoute for imperative navigation, or ModalSheetPage for declarative navigation. A modal sheet offers the *pull-to-dismiss* action; the user can dismiss the sheet by swiping it down.

A sheet can be displayed as a modal sheet using ModalSheetRoute for imperative navigation, or ModalSheetPage for declarative navigation. To enable the *pull-to-dismiss* action, which allows the user to dismiss the sheet with a swiping-down gesture, wrap the sheet in a SheetDismissible.

<div align="center">
<img width="160" src="https://github.com/fujidaiti/smooth_sheets/assets/68946713/242a8d32-a355-4d4a-8248-4572a03c64eb"/>
Expand All @@ -195,6 +205,7 @@ See also:
- [declarative_modal_sheet.dart](https://github.com/fujidaiti/smooth_sheets/blob/main/cookbook/lib/tutorial/declarative_modal_sheet.dart), a tutorial of integration with declarative navigation using [go_router](https://pub.dev/packages/go_router) package.
- [imperative_modal_sheet.dart](https://github.com/fujidaiti/smooth_sheets/blob/main/cookbook/lib/tutorial/imperative_modal_sheet.dart), a tutorial of integration with imperative Navigator API.
- [cupertino_modal_sheet.dart](https://github.com/fujidaiti/smooth_sheets/blob/main/cookbook/lib/tutorial/cupertino_modal_sheet.dart), a tutorial of iOS style modal sheets.
- [showcase/todo_list](https://github.com/fujidaiti/smooth_sheets/blob/main/cookbook/lib/showcase/todo_list), which uses SheetDismissible to show a confirmation dialog when the user tries to discard the todo editing sheet without saving the content.

<br/>

Expand Down Expand Up @@ -337,19 +348,6 @@ See also:

<br/>

## Roadmap

- [ ] doc: Provide more documentation
- [x] doc: Add a showcase that uses a TextField in a sheet
- [ ] doc: Add an example of `NavigationSheet` using [auto_route](https://pub.dev/packages/auto_route)
- [ ] feat: Sheet decoration; a way to place an extra widget above the sheet
- [ ] feat: Provide a way to interrupt a modal route popping
- [ ] feat: Support shared appbars in NavigationSheet
- [x] feat: Dispatch a [Notification](https://api.flutter.dev/flutter/widgets/Notification-class.html) when the sheet extent changes
- [x] feat: Implement modal sheet route adapted for iOS

<br/>

## Questions

If you have any questions, feel free to ask them on [the discussions page](https://github.com/fujidaiti/smooth_sheets/discussions).
Expand All @@ -371,3 +369,12 @@ Don't forget to give the project a star! Thanks again!

<br/>

## Links

- [Roadmap](https://github.com/fujidaiti/smooth_sheets/issues?q=is%3Aissue+is%3Aopen+label%3A%22feature+request%22)
- [API Documentation](https://pub.dev/documentation/smooth_sheets/latest/)
- [pub.dev](https://pub.dev/packages/smooth_sheets)
- [norelease.dev](https://pub.dev/publishers/norelease.dev/packages)

<br/>

2 changes: 1 addition & 1 deletion package/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: smooth_sheets
description: Sheet widgets with smooth motion and great flexibility. Also supports nested navigation in both imperative and declarative ways.
version: 0.2.0
version: 0.3.0
repository: https://github.com/fujidaiti/smooth_sheets

environment:
Expand Down
Binary file modified resources/cookbook-ai-playlist-generator.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/cookbook-imperative-modal-sheet.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified resources/cookbook-safari.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 4 additions & 4 deletions resources/index.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
![cookbook-ai-playlist-generator](https://github.com/fujidaiti/smooth_sheets/assets/68946713/f34ad8f7-2435-4bed-adbf-2d61c659c803)
![cookbook-ai-playlist-generator](https://github.com/fujidaiti/smooth_sheets/assets/68946713/636d5ca8-2883-4447-ad75-47fcb210718c)
![cookbook-sheet-physics](https://github.com/fujidaiti/smooth_sheets/assets/68946713/e08e3f58-cc98-4858-8b76-6e84a7e9e416)
![cookbook-sheet-draggable](https://github.com/fujidaiti/smooth_sheets/assets/68946713/aacc7b27-3d6f-4314-8672-d6f99fafabed)
![cookbook-sheet-controller](https://github.com/fujidaiti/smooth_sheets/assets/68946713/40f3fba5-9fec-40e8-a5cf-8f0312b57288)
![cookbook-sheet-content-scaffold](https://github.com/fujidaiti/smooth_sheets/assets/68946713/52a0de82-b85c-4b2f-b10a-eb882b849900)
![cookbook-scrollable-sheet](https://github.com/fujidaiti/smooth_sheets/assets/68946713/28cf4760-de78-425b-a64e-c2ac6fb6817c)
![cookbook-imperative-navigation-sheet](https://github.com/fujidaiti/smooth_sheets/assets/68946713/2f56696c-5086-4235-88a8-a2ce60cd8637)
![cookbook-imerative-modal-sheet](https://github.com/fujidaiti/smooth_sheets/assets/68946713/47e7c7a8-cf1a-451c-bc6b-b0fcb3fbf4aa)
![cookbook-imperative-modal-sheet](https://github.com/fujidaiti/smooth_sheets/assets/68946713/f2212362-e193-4dab-8f8b-f24942051775)
![cookbook-draggable-sheet](https://github.com/fujidaiti/smooth_sheets/assets/68946713/51c483a0-5d1d-49d1-bff1-0051d1d3d937)
![cookbook-declerative-modal-sheet](https://github.com/fujidaiti/smooth_sheets/assets/68946713/67128764-e809-4bff-ae2d-b0884928a2da)
![cookbook-declarative-modal-sheet](https://github.com/fujidaiti/smooth_sheets/assets/68946713/67128764-e809-4bff-ae2d-b0884928a2da)
![cookbook-declarative-navigation-sheet](https://github.com/fujidaiti/smooth_sheets/assets/68946713/3367d3bc-a895-42be-8154-2f6fc83b30b5)
![cookbook-airbnb-mobile-app](https://github.com/fujidaiti/smooth_sheets/assets/68946713/1fb3f047-c993-42be-9a7e-b3efc89be635)
![cookbook-extent-driven-animation](https://github.com/fujidaiti/smooth_sheets/assets/68946713/8b9ed0ef-675e-4468-8a3f-cd3f1ed3dfb0)
![cookbook-cupertino-modal-sheet](https://github.com/fujidaiti/smooth_sheets/assets/68946713/242a8d32-a355-4d4a-8248-4572a03c64eb)
![cookbook-safari](https://github.com/fujidaiti/smooth_sheets/assets/68946713/ad3f0ec1-fd7b-45d3-94a3-0b17c12b5889)
![cookbook-safari](https://github.com/fujidaiti/smooth_sheets/assets/68946713/cfbc79d1-4290-4dec-88bd-a355a27726ea)

0 comments on commit 927afa3

Please sign in to comment.