adjustable_positioned 1.0.0 adjustable_positioned: ^1.0.0 copied to clipboard
A Positioned Widget that can handle repositioning itself based on user input.
A Positioned Widget that can handle repositioning itself based on user input.
Features #
Reposition your widget.
Change the size of your widget.
Customize drag handles.
Getting started #
1. Depend on it #
Add this to your package's pubspec.yaml
file:
dependencies:
adjustable_positioned: '^1.0.0'
copied to clipboard
2. Install it
You can install packages from the command line:
$ pub get
..
copied to clipboard
Alternatively, your editor might support pub. Check the docs for your editor to learn more.
3. Import it
Now in your Dart code, you can use:
import 'package:adjustable_positioned/adjustable_positioned.dart';
copied to clipboard
Usage #
...
var handleSize = 24.0;
Stack(
children: [
Positioned(...),
AdjustablePositionedWidget<Object>(
startX: 48,
startY: 64,
startW: 128,
startH: 128,
minW: 64,
minH: 64,
activeAdjustmentCallback: (rect) { /** Do something */ },
finishedAdjustmentCallback: (rect) { /** Do something else */ },
handleWidgetBuilder: (context, handleId) => const Icon(Icons.circle),
handleSize: handleSize,
dragData: null,
child: Padding(
padding: EdgeInsets.all(handleSize),
child: Container(color: Colors.red,),
),
),
....
]);
...
copied to clipboard