flutter: Deal in StatefulWidget instead of PositionedWidget

So we can wrap PositionedWidget in something else
This commit is contained in:
Sergio Martins
2022-08-09 19:07:18 +01:00
parent 2afe86e63b
commit 192533647d
2 changed files with 4 additions and 9 deletions

View File

@@ -33,14 +33,11 @@ class PositionedWidgetState extends State<PositionedWidget> {
int height = 400;
final bool _fillsParent;
var childWidgets = <PositionedWidget>[];
PositionedWidgetState(this.kddwView) : _fillsParent = kddwView.m_fillsParent {
x = kddwView.m_x;
y = kddwView.m_y;
width = kddwView.m_width;
height = kddwView.m_height;
childWidgets = kddwView.childWidgets;
// print("Creating PositionedWidgetState width=${width}");
}
@@ -52,9 +49,7 @@ class PositionedWidgetState extends State<PositionedWidget> {
}
void addChildView(View_mixin childView) {
setState(() {
childWidgets.add(childView.flutterWidget);
});
setState(() {});
}
void updatePosition(int kddwX, int kddwY) {
@@ -100,7 +95,7 @@ class PositionedWidgetState extends State<PositionedWidget> {
final container = Container(
color: kddwView.m_color,
child: Stack(
children: childWidgets,
children: kddwView.childWidgets,
));
if (_fillsParent) return container;

View File

@@ -18,7 +18,7 @@ import 'Group_flutter.dart';
import 'View_flutter.dart';
class View_mixin {
late final PositionedWidget flutterWidget;
late final StatefulWidget flutterWidget;
late final GlobalObjectKey<PositionedWidgetState> widgetKey;
late final KDDockWidgetBindings.View_flutter kddwView;
@@ -33,7 +33,7 @@ class View_mixin {
int m_maxHeight = 16777215;
int m_maxWidth = 16777215;
var childWidgets = <PositionedWidget>[];
var childWidgets = <StatefulWidget>[];
setSize_2(int width, int height) {
// print(