Skip to content

Commit

Permalink
Documentation updates (#45)
Browse files Browse the repository at this point in the history
## Changes made

- Add doc comments to `sheet_extent.dart`.
- Avoid using GitHub alert syntax. (Fixes #23)
- Rename `SingleChildSheet*` to `SizedContentSheet*`.
  • Loading branch information
fujidaiti authored Feb 25, 2024
1 parent 927afa3 commit 3aa642b
Show file tree
Hide file tree
Showing 10 changed files with 217 additions and 45 deletions.
4 changes: 4 additions & 0 deletions package/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 0.3.1 Feb 26, 2024

Documentation updates.

## 0.3.0 Feb 24, 2024

- Add iOS 15 style modal sheet transition (#21)
Expand Down
8 changes: 2 additions & 6 deletions package/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,9 @@

<br/>

> [!CAUTION]
>
> This library is currently in the experimental stage. The API may undergo changes without prior notice.
**CAUTION🚨**

> [!NOTE]
>
> For documentation of the latest published version, please visit the [package site](https://pub.dev/packages/smooth_sheets) on pub.dev.
This library is currently in the experimental stage. The API may undergo changes without prior notice. For documentation of the latest published version, please visit the [package site](https://pub.dev/packages/smooth_sheets) on pub.dev.

<br/>

Expand Down
12 changes: 6 additions & 6 deletions package/lib/src/draggable/draggable_sheet.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import 'package:flutter/widgets.dart';
import 'package:smooth_sheets/smooth_sheets.dart';
import 'package:smooth_sheets/src/foundation/single_child_sheet.dart';
import 'package:smooth_sheets/src/foundation/sized_content_sheet.dart';

class DraggableSheet extends SingleChildSheet {
class DraggableSheet extends SizedContentSheet {
const DraggableSheet({
super.key,
this.hitTestBehavior = HitTestBehavior.translucent,
Expand All @@ -18,12 +18,12 @@ class DraggableSheet extends SingleChildSheet {
final HitTestBehavior hitTestBehavior;

@override
SingleChildSheetState<SingleChildSheet> createState() {
SizedContentSheetState<SizedContentSheet> createState() {
return _DraggableSheetState();
}
}

class _DraggableSheetState extends SingleChildSheetState<DraggableSheet> {
class _DraggableSheetState extends SizedContentSheetState<DraggableSheet> {
@override
SheetExtentFactory createExtentFactory() {
return DraggableSheetExtentFactory(
Expand All @@ -43,7 +43,7 @@ class _DraggableSheetState extends SingleChildSheetState<DraggableSheet> {
}
}

class DraggableSheetExtentFactory extends SingleChildSheetExtentFactory {
class DraggableSheetExtentFactory extends SizedContentSheetExtentFactory {
const DraggableSheetExtentFactory({
required super.initialExtent,
required super.minExtent,
Expand All @@ -63,7 +63,7 @@ class DraggableSheetExtentFactory extends SingleChildSheetExtentFactory {
}
}

class DraggableSheetExtent extends SingleChildSheetExtent {
class DraggableSheetExtent extends SizedContentSheetExtent {
DraggableSheetExtent({
required super.context,
required super.physics,
Expand Down
21 changes: 21 additions & 0 deletions package/lib/src/draggable/sheet_draggable.dart
Original file line number Diff line number Diff line change
@@ -1,15 +1,36 @@
import 'package:flutter/widgets.dart';
import 'package:smooth_sheets/src/draggable/draggable_sheet.dart';
import 'package:smooth_sheets/src/foundation/sheet_activity.dart';
import 'package:smooth_sheets/src/foundation/sheet_extent.dart';
import 'package:smooth_sheets/src/scrollable/scrollable_sheet.dart';

/// A widget that makes its child as a drag-handle for a sheet.
///
/// Typically, this widget is used when placing non-scrollable widget(s)
/// in a [ScrollableSheet], since it only works with scrollable widgets,
/// so you can't drag the sheet by touching a non-scrollable area.
///
/// Note that [SheetDraggable] is not needed when using [DraggableSheet]
/// since it implicitly wraps the child widget with [SheetDraggable].
///
/// See also:
/// - [A tutorial](https://github.com/fujidaiti/smooth_sheets/blob/main/cookbook/lib/tutorial/sheet_draggable.dart),
/// in which a [SheetDraggable] is used to create a drag-handle for
/// a [ScrollableSheet].
class SheetDraggable extends StatefulWidget {
/// Creates a drag-handle for a sheet.
///
/// The [behavior] defaults to [HitTestBehavior.translucent].
const SheetDraggable({
super.key,
this.behavior = HitTestBehavior.translucent,
required this.child,
});

/// How to behave during hit testing.
final HitTestBehavior behavior;

/// The widget below this widget in the tree.
final Widget child;

@override
Expand Down
Loading

0 comments on commit 3aa642b

Please sign in to comment.