@@ -35,7 +35,7 @@ class ControlInheritedNotifier extends InheritedNotifier<Control> {
3535///
3636/// If `"skip_inherited_notifier"` internal is `true` , this returns
3737/// [builder] unwrapped to preserve historical semantics.
38- Widget withControlInheritedNotifier (Control control, WidgetBuilder builder) {
38+ Widget withControlNotifier (Control control, WidgetBuilder builder) {
3939 if (control.internals? ["skip_inherited_notifier" ] == true ) {
4040 return Builder (builder: builder);
4141 }
@@ -50,15 +50,15 @@ Widget withControlInheritedNotifier(Control control, WidgetBuilder builder) {
5050}
5151
5252/// Convenience wrapper that applies both:
53- /// - [withControlInheritedNotifier ]
54- /// - [wrapWithControlTheme ]
55- Widget wrapWithControlInheritedNotifierAndTheme (
53+ /// - [withControlNotifier ]
54+ /// - [withControlTheme ]
55+ Widget withControlContext (
5656 Control control,
5757 WidgetBuilder builder,
5858) {
5959 return Builder (builder: (context) {
60- final child = withControlInheritedNotifier (control, builder);
61- return wrapWithControlTheme (control, context, child);
60+ final child = withControlNotifier (control, builder);
61+ return withControlTheme (control, context, child);
6262 });
6363}
6464
@@ -73,8 +73,7 @@ Widget wrapWithControlInheritedNotifierAndTheme(
7373/// - `control` : the control whose per-control theme (if any) will be applied.
7474/// - `context` : used to access `FletBackend` and the ambient `Theme` .
7575/// - `child` : the widget subtree to wrap with the per-control `Theme` .
76- Widget wrapWithControlTheme (
77- Control control, BuildContext context, Widget child) {
76+ Widget withControlTheme (Control control, BuildContext context, Widget child) {
7877 if (control == FletBackend .of (context).page) return child;
7978
8079 if (control.internals? ["skip_inherited_notifier" ] == true ) return child;
@@ -114,3 +113,11 @@ Widget wrapWithControlTheme(
114113
115114 return buildTheme (themeModeToBrightness (themeMode));
116115}
116+
117+ extension ControlContextBuilder on Control {
118+ /// Builds a widget under this control's standard "control context":
119+ /// [ControlInheritedNotifier] + per-control theme wrapping.
120+ Widget buildInControlContext (WidgetBuilder builder) {
121+ return withControlContext (this , builder);
122+ }
123+ }
0 commit comments