flutter: A view can now be positioned and sized
This commit is contained in:
@@ -23,8 +23,8 @@ class PositionedWidget extends StatefulWidget {
|
||||
|
||||
class _PositionedWidgetState extends State<PositionedWidget> {
|
||||
final View_flutter kddwView;
|
||||
int x = 100;
|
||||
int y = 100;
|
||||
int x = 0;
|
||||
int y = 0;
|
||||
int width = 400;
|
||||
int height = 400;
|
||||
|
||||
@@ -33,11 +33,14 @@ class _PositionedWidgetState extends State<PositionedWidget> {
|
||||
_PositionedWidgetState(this.kddwView) {
|
||||
kddwView.updatePositionCallback = updatePosition;
|
||||
kddwView.updateSizeCallback = updateSize;
|
||||
|
||||
x = kddwView.m_x;
|
||||
y = kddwView.m_y;
|
||||
width = kddwView.m_width;
|
||||
height = kddwView.m_height;
|
||||
}
|
||||
|
||||
void updatePosition(int kddwX, int kddwY) {
|
||||
final int kddwX = kddwView.x();
|
||||
final int kddwY = kddwView.y();
|
||||
setState(() {
|
||||
this.x = kddwX;
|
||||
this.y = kddwY;
|
||||
|
||||
@@ -31,14 +31,27 @@ class View_flutter extends KDDockWidgetBindings.View_flutter {
|
||||
}
|
||||
|
||||
View_flutter.fromCppPointer(var cppPointer, [var needsAutoDelete = false])
|
||||
: super.fromCppPointer(cppPointer, needsAutoDelete) {}
|
||||
: super.fromCppPointer(cppPointer, needsAutoDelete) {
|
||||
flutterWidget = PositionedWidget(this);
|
||||
}
|
||||
|
||||
setSize_2(int width, int height) {
|
||||
print("View_flutter::setSize called ${width}x${height}");
|
||||
if (m_width != width || m_height != height) {
|
||||
m_height = height;
|
||||
m_width = width;
|
||||
m_height = height;
|
||||
if (updateSizeCallback != null) updateSizeCallback!(width, height);
|
||||
}
|
||||
}
|
||||
|
||||
move_2(int x, int y) {
|
||||
print("View_flutter::move called ${x},${y}");
|
||||
if (m_x != x || m_y != y) {
|
||||
m_x = x;
|
||||
m_y = y;
|
||||
print(updatePositionCallback);
|
||||
print(updateSizeCallback);
|
||||
if (updatePositionCallback != null) updatePositionCallback!(x, y);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,9 +18,5 @@ void f(Function(int x, int y)? f) {
|
||||
|
||||
void main(List<String> args) {
|
||||
var p = Platform_flutter();
|
||||
|
||||
var config = KDDockWidgetBindings.Config.self();
|
||||
print("Config.separatorThickness: ${config.separatorThickness()}");
|
||||
|
||||
print("Platform.name: " + p.name());
|
||||
}
|
||||
|
||||
@@ -10,6 +10,8 @@ dependencies:
|
||||
meta:
|
||||
KDDockWidgetsBindings:
|
||||
path: '../generated/KDDockWidgetsBindings/dart/'
|
||||
flutter:
|
||||
sdk: flutter
|
||||
|
||||
dev_dependencies:
|
||||
pedantic: ^1.9.0
|
||||
|
||||
Reference in New Issue
Block a user