File tree Expand file tree Collapse file tree 2 files changed +17
-4
lines changed
packages/flutter_box_transform/lib/src Expand file tree Collapse file tree 2 files changed +17
-4
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,8 @@ import 'dart:math';
33import 'package:box_transform/box_transform.dart' ;
44import 'package:flutter/material.dart' ;
55
6+ import 'transformable_box.dart' ;
7+
68/// Default width of the border of the handles.
79const kDefaultHandleBorderWidth = 1.5 ;
810
@@ -167,9 +169,6 @@ class AngularHandle extends StatelessWidget {
167169 /// Whether the handle has a shadow.
168170 final bool hasShadow;
169171
170- /// The alignment of the handle.
171- final HandleAlignment handleAlignment;
172-
173172 /// Creates a new angular corner handle.
174173 const AngularHandle ({
175174 super .key,
@@ -178,11 +177,13 @@ class AngularHandle extends StatelessWidget {
178177 this .thickness = 5 ,
179178 this .color,
180179 this .hasShadow = true ,
181- this .handleAlignment = HandleAlignment .inside,
182180 });
183181
184182 @override
185183 Widget build (BuildContext context) {
184+ final handleAlignment =
185+ TransformableBox .widgetOf (context)? .handleAlignment ??
186+ HandleAlignment .outside;
186187 return LayoutBuilder (
187188 builder: (context, constraints) {
188189 return Container (
Original file line number Diff line number Diff line change @@ -282,6 +282,18 @@ class TransformableBox extends StatefulWidget {
282282 constraints = constraints ?? const BoxConstraints .expand (),
283283 resizeModeResolver = resizeModeResolver ?? defaultResizeModeResolver;
284284
285+ /// Returns the [TransformableBox] of the closest ancestor.
286+ static TransformableBox ? widgetOf (BuildContext context) {
287+ return context.findAncestorWidgetOfExactType <TransformableBox >();
288+ }
289+
290+ /// Returns the [TransformableBoxController] of the closest ancestor.
291+ static TransformableBoxController ? controllerOf (BuildContext context) {
292+ return context
293+ .findAncestorStateOfType <_TransformableBoxState >()
294+ ? .controller;
295+ }
296+
285297 @override
286298 State <TransformableBox > createState () => _TransformableBoxState ();
287299}
You can’t perform that action at this time.
0 commit comments