Skip to content

Commit 7b38442

Browse files
v1: Rename ConstrainedControl to LayoutControl, swap Button and ElevatedButton (#5592)
* Replace ConstrainedControl with LayoutControl Refactored all usages of ConstrainedControl to LayoutControl across control implementations. Introduced LayoutControl as the new wrapper for layout constraints, with ConstrainedControl now extending LayoutControl for backward compatibility. Updated documentation and example paths to reflect the new naming and organization. * Refactor ElevatedButton to Button and update references Replaces the ElevatedButton control with Button throughout the codebase, consolidating button logic into a single Button class. ElevatedButton is now a deprecated alias for Button. Updates all usages, tests, and control registration to use Button, simplifying the API and improving maintainability. * Replace ElevatedButton with Button in examples Updated all Python example files to use ft.Button instead of ft.ElevatedButton for consistency with the latest Flet API. This affects authentication, controls-gallery, routing-navigation, studio-gallery, desktop-window-manager, and other sample apps. * Refactor calculator UI to use Colors and content Replaces deprecated 'colors' import with 'Colors' and updates Button controls to use 'content' instead of 'text'. Also changes alignment to use MainAxisAlignment.END and updates class inheritance from UserControl to Container for improved compatibility with Flet API.
1 parent 3c01a4a commit 7b38442

File tree

328 files changed

+1521
-1517
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

328 files changed

+1521
-1517
lines changed

packages/flet/lib/src/controls/animated_switcher.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,6 @@ class AnimatedSwitcherControl extends StatelessWidget {
4747
},
4848
child: content,
4949
);
50-
return ConstrainedControl(control: control, child: animatedSwitcher);
50+
return LayoutControl(control: control, child: animatedSwitcher);
5151
}
5252
}

packages/flet/lib/src/controls/base_controls.dart

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,20 @@ class BaseControl extends StatelessWidget {
2929
}
3030
}
3131

32-
class ConstrainedControl extends StatelessWidget {
32+
// TODO - remove when extensions migrated to LayoutControl
33+
class ConstrainedControl extends LayoutControl {
34+
const ConstrainedControl({
35+
super.key,
36+
required super.control,
37+
required super.child,
38+
});
39+
}
40+
41+
class LayoutControl extends StatelessWidget {
3342
final Control control;
3443
final Widget child;
3544

36-
const ConstrainedControl({
45+
const LayoutControl({
3746
super.key,
3847
required this.control,
3948
required this.child,

packages/flet/lib/src/controls/bottom_app_bar.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,6 @@ class BottomAppBarControl extends StatelessWidget {
2222
child: control.buildWidget("content"),
2323
);
2424

25-
return ConstrainedControl(control: control, child: bottomAppBar);
25+
return LayoutControl(control: control, child: bottomAppBar);
2626
}
2727
}

packages/flet/lib/src/controls/button.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,6 @@ class _ButtonControlState extends State<ButtonControl> with FletStoreMixin {
218218
}
219219
}
220220

221-
return ConstrainedControl(control: widget.control, child: button);
221+
return LayoutControl(control: widget.control, child: button);
222222
}
223223
}

packages/flet/lib/src/controls/canvas.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ class _CanvasControlState extends State<CanvasControl> {
167167
child: widget.control.buildWidget("content"),
168168
);
169169

170-
return ConstrainedControl(control: widget.control, child: paint);
170+
return LayoutControl(control: widget.control, child: paint);
171171
}
172172
}
173173

packages/flet/lib/src/controls/card.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,6 @@ class CardControl extends StatelessWidget {
7777
child: contentWidget);
7878
}
7979

80-
return ConstrainedControl(control: control, child: card);
80+
return LayoutControl(control: control, child: card);
8181
}
8282
}

packages/flet/lib/src/controls/checkbox.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,6 @@ class _CheckboxControlState extends State<CheckboxControl> {
136136
child: FittedBox(fit: BoxFit.fill, child: result));
137137
}
138138

139-
return ConstrainedControl(control: widget.control, child: result);
139+
return LayoutControl(control: widget.control, child: result);
140140
}
141141
}

packages/flet/lib/src/controls/chip.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,6 @@ class _ChipControlState extends State<ChipControl> {
136136
: null,
137137
);
138138

139-
return ConstrainedControl(control: widget.control, child: chip);
139+
return LayoutControl(control: widget.control, child: chip);
140140
}
141141
}

packages/flet/lib/src/controls/circle_avatar.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,6 @@ class CircleAvatarControl extends StatelessWidget {
7272
: null,
7373
child: content);
7474

75-
return ConstrainedControl(control: control, child: avatar);
75+
return LayoutControl(control: control, child: avatar);
7676
}
7777
}

packages/flet/lib/src/controls/column.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,6 @@ class ColumnControl extends StatelessWidget {
5959
child = ScrollNotificationControl(control: control, child: child);
6060
}
6161

62-
return ConstrainedControl(control: control, child: child);
62+
return LayoutControl(control: control, child: child);
6363
}
6464
}

0 commit comments

Comments
 (0)