mirror of
https://github.com/pese-git/cherrypick.git
synced 2026-01-23 21:13:35 +00:00
feat: modify api in CherryPickProvider
This commit is contained in:
@@ -14,14 +14,15 @@ import 'package:flutter/widgets.dart';
|
|||||||
/// limitations under the License.
|
/// limitations under the License.
|
||||||
///
|
///
|
||||||
|
|
||||||
class CherryPickProvider extends InheritedWidget {
|
final class CherryPickProvider extends InheritedWidget {
|
||||||
// Holds a reference to the root scope object
|
Scope openRootScope() => CherryPick.openRootScope();
|
||||||
final Scope rootScope;
|
|
||||||
|
Scope openSubScope({String scopeName = '', String separator = '.'}) =>
|
||||||
|
CherryPick.openScope(scopeName: scopeName, separator: separator);
|
||||||
|
|
||||||
// Constructor for CherryPickProvider. Initializes with a required rootScope and child widget.
|
// Constructor for CherryPickProvider. Initializes with a required rootScope and child widget.
|
||||||
const CherryPickProvider({
|
const CherryPickProvider({
|
||||||
super.key,
|
super.key,
|
||||||
required this.rootScope,
|
|
||||||
required super.child,
|
required super.child,
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -38,7 +39,6 @@ class CherryPickProvider extends InheritedWidget {
|
|||||||
// Determines whether the widget should notify dependents when it changes
|
// Determines whether the widget should notify dependents when it changes
|
||||||
@override
|
@override
|
||||||
bool updateShouldNotify(CherryPickProvider oldWidget) {
|
bool updateShouldNotify(CherryPickProvider oldWidget) {
|
||||||
// Notify if the rootScope has changed
|
return false;
|
||||||
return rootScope != oldWidget.rootScope;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user