-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor: Lift sheet context up (#201)
## Fixes / Closes (optional) <!-- List any issues or pull requests that this PR fixes or closes. Use the format: "Fixes #123" or "Closes #456". --> None. ## Description <!-- Provide a clear and concise description of what this PR does. Explain the problem it solves and the approach you've taken. --> `SheetExtentScopeState` no longer implements `SheetContext`. Instead, these implementations have been moved to `SheetContextStateMixin`, which is mixed in by all the `*SheetState` classes. ## Summary (check all that apply) <!-- Mark the boxes that apply to this PR. Add details if necessary. --> - [x] Modified / added code - [ ] Modified / added tests - [ ] Modified / added examples - [ ] Modified / added others (pubspec.yaml, workflows, etc...) - [ ] Updated README - [ ] Contains breaking changes - [ ] Created / updated migration guide - [ ] Incremented version number - [ ] Updated CHANGELOG
- Loading branch information
Showing
12 changed files
with
103 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import 'package:flutter/widgets.dart'; | ||
import 'package:meta/meta.dart'; | ||
|
||
import 'sheet_extent.dart'; | ||
|
||
/// An interface that provides a set of dependencies required by [SheetExtent]. | ||
@internal | ||
abstract class SheetContext { | ||
TickerProvider get vsync; | ||
BuildContext? get notificationContext; | ||
} | ||
|
||
@internal | ||
@optionalTypeArgs | ||
mixin SheetContextStateMixin<T extends StatefulWidget> | ||
on State<T>, TickerProviderStateMixin<T> | ||
implements SheetContext { | ||
@override | ||
TickerProvider get vsync => this; | ||
|
||
@override | ||
BuildContext? get notificationContext => mounted ? context : null; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters