Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
## 1.0.0

### Breaking changes

* **`InputBorder` is a class hierarchy instead of an enum**, so enum-shaped usage no longer works: `InputBorder` is not iterable, its members have no `.value` or `.name`, and `InputBorder.OUTLINE is InputBorder.OUTLINE` is now `False` because each access returns a new instance — compare with `==`. Assigning a border is unaffected; see the deprecations below. Rendering changes as well: a border with no explicit `side` now takes its color and weight from the Material theme per state instead of always painting black, so dark mode and custom themes work; an underline finally honors its `border_radius`; `DropdownM2`'s open menu is shaped by the new `menu_border_radius` rather than by the field's radius; and on `CupertinoTextField`, `InputBorder.none()` now actually removes the border while an outline without a `side` keeps the native iOS one. See the [InputBorder class hierarchy](/docs/updates/breaking-changes/v1-0-0/inputborder-class-hierarchy) guide ([#6773](https://github.com/flet-dev/flet/pull/6773)) by @ndonkoHenri.
* Properties whose Flutter default is a fixed constant now declare that constant rather than `Optional[...] = None`, so reading one returns the value the control actually applies instead of `None`: the eight `Paint` style properties, `RoundedRectangleBorder.radius`, `Button.autofocus`, `Text.no_wrap`, `GridView.clip_behavior`, `Semantics.container`, `ExpansionPanelList.spacing`, `TextField.fit_parent_size`, `Page.show_semantics_debugger`, the three `CupertinoAppBar.automatic*` flags, `Path.Rect.border_radius` and `canvas.Text.max_width`. Rendering is unchanged, and properties a widget resolves at runtime from the theme, the platform or its own state keep `None` ([#6773](https://github.com/flet-dev/flet/pull/6773)) by @ndonkoHenri.

### Deprecations

* `InputBorder.OUTLINE`, `InputBorder.UNDERLINE` and `InputBorder.NONE` are deprecated in favor of `OutlineInputBorder()`, `UnderlineInputBorder()` and `InputBorder.none()`. Each still resolves, returning the equivalent instance, and they are scheduled for removal in `1.3.0`. See the [InputBorder class hierarchy](/docs/updates/breaking-changes/v1-0-0/inputborder-class-hierarchy) guide ([#6773](https://github.com/flet-dev/flet/pull/6773)) by @ndonkoHenri.
* The `border_radius`, `border_width`, `border_color`, `focused_border_width` and `focused_border_color` properties of `TextField`, `Dropdown`, `DropdownM2` and `CupertinoTextField` are deprecated in favor of `border`, which accepts an `InputBorder` or a `ControlState` dictionary. They keep working and are scheduled for removal in `1.3.0`; where both are set, `border` wins. See the [InputBorder class hierarchy](/docs/updates/breaking-changes/v1-0-0/inputborder-class-hierarchy) guide ([#6773](https://github.com/flet-dev/flet/pull/6773)) by @ndonkoHenri.
* `DropdownM2.border_radius` is deprecated in favor of `menu_border_radius` for the open menu, or `border` for the input field. It is scheduled for removal in `1.3.0`. See the [InputBorder class hierarchy](/docs/updates/breaking-changes/v1-0-0/inputborder-class-hierarchy) guide ([#6773](https://github.com/flet-dev/flet/pull/6773)) by @ndonkoHenri.

## 0.86.7

### Bug fixes
Expand Down
4 changes: 4 additions & 0 deletions packages/flet/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 1.0.0

* Replace the `FormFieldInputBorder` enum and its `parseFormFieldInputBorder()` / `Control.getFormFieldInputBorder()` helpers with `parseInputBorder()`, which builds an `InputBorder` from a serialized border object. `parseFormFieldBorders()` maps a control's `border` property — a single border or a map of control states — onto the `InputDecoration` border slots, including `errorBorder`, `focusedErrorBorder` and `disabledBorder`, and `parseFormFieldBoxBorder()` translates the same property for controls decorated with a `BoxDecoration` instead ([#6773](https://github.com/flet-dev/flet/pull/6773)) by @ndonkoHenri.

## 0.86.7

* `FletJS.canvasKitBaseUrl` is now `String?`. `flutter_bootstrap.js` applies `flet.canvasKitBaseUrl` and `flet.fontFallbackBaseUrl` whenever they are set rather than only when `flet.noCdn` is true, and both default to `null` in CDN mode — so a host serving its own copy of the runtime can point them anywhere without also claiming a no-CDN build. The getter has no readers in this package; the annotation now matches the value it can carry.
Expand Down
30 changes: 4 additions & 26 deletions packages/flet/lib/src/controls/cupertino_textfield.dart
Original file line number Diff line number Diff line change
Expand Up @@ -217,30 +217,8 @@ class _CupertinoTextFieldControlState extends State<CupertinoTextFieldControl> {
_selection = selection;
}

var borderRadius = widget.control.getBorderRadius("border_radius");

BoxBorder? border;
var borderWidth = widget.control.getDouble("border_width", 1.0)!;
var borderColor = widget.control.getColor("border_color", context) ??
const Color(0xFF000000);

try {
border = widget.control.getBorder("border", Theme.of(context));
// adaptive TextField is being created
} catch (e) {
FormFieldInputBorder inputBorder = parseFormFieldInputBorder(
widget.control.getString("border"),
FormFieldInputBorder.outline,
)!;

if (inputBorder == FormFieldInputBorder.outline) {
border = Border.all(color: borderColor, width: borderWidth);
} else if (inputBorder == FormFieldInputBorder.underline) {
border =
Border(bottom: BorderSide(color: borderColor, width: borderWidth));
borderRadius = BorderRadius.zero;
}
}
var boxBorder = parseFormFieldBoxBorder(widget.control, Theme.of(context),
focused: _focused);

var canRevealPassword =
widget.control.getBool("can_reveal_password", false)!;
Expand Down Expand Up @@ -294,8 +272,8 @@ class _CupertinoTextFieldControlState extends State<CupertinoTextFieldControl> {
image: widget.control.getDecorationImage("image", context),
backgroundBlendMode:
bgcolor != null || gradient != null ? blendMode : null,
border: border,
borderRadius: borderRadius,
border: boxBorder.border,
borderRadius: boxBorder.borderRadius,
boxShadow:
widget.control.getBoxShadows("shadows", Theme.of(context))),
cursorHeight: widget.control.getDouble("cursor_height"),
Expand Down
67 changes: 7 additions & 60 deletions packages/flet/lib/src/controls/dropdown.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import 'package:flutter/services.dart';

import '../extensions/control.dart';
import '../models/control.dart';
import '../utils/borders.dart';
import '../utils/buttons.dart';
import '../utils/colors.dart';
import '../utils/edge_insets.dart';
Expand Down Expand Up @@ -104,76 +103,24 @@ class _DropdownControlState extends State<DropdownControl> {
var textAlign = widget.control.getTextAlign("text_align", TextAlign.start)!;

var fillColor = widget.control.getColor("fill_color", context);
var borderColor = widget.control.getColor("border_color", context);

var borderRadius = widget.control.getBorderRadius("border_radius");
var focusedBorderColor =
widget.control.getColor("focused_border_color", context);
var borderWidth = widget.control.getDouble("border_width");
var focusedBorderWidth = widget.control.getDouble("focused_border_width");
var menuWidth = widget.control.getDouble("menu_width");
var bgColor = widget.control.getWidgetStateColor("bgcolor", theme);
var elevation = widget.control.getWidgetStateDouble("elevation");

var inputBorder = widget.control
.getFormFieldInputBorder("border", FormFieldInputBorder.outline)!;

InputBorder? border;

if (inputBorder == FormFieldInputBorder.underline) {
border = UnderlineInputBorder(
borderSide: BorderSide(
color: borderColor ?? const Color(0xFF000000),
width: borderWidth ?? 1.0));
} else if (inputBorder == FormFieldInputBorder.none) {
border = InputBorder.none;
} else if (inputBorder == FormFieldInputBorder.outline ||
borderRadius != null ||
borderColor != null ||
borderWidth != null) {
border = OutlineInputBorder(
borderSide: BorderSide(
color: borderColor ?? const Color(0xFF000000),
width: borderWidth ?? 1.0));
if (borderRadius != null) {
border =
(border as OutlineInputBorder).copyWith(borderRadius: borderRadius);
}
if (borderColor != null || borderWidth != null) {
border = (border as OutlineInputBorder).copyWith(
borderSide: borderWidth == 0
? BorderSide.none
: BorderSide(
color: borderColor ??
theme.colorScheme.onSurface.withValues(alpha: 0.38),
width: borderWidth ?? 1.0));
}
}

InputBorder? focusedBorder;
if (borderColor != null ||
borderWidth != null ||
focusedBorderColor != null ||
focusedBorderWidth != null) {
focusedBorder = border?.copyWith(
borderSide: borderWidth == 0
? BorderSide.none
: BorderSide(
color: focusedBorderColor ??
borderColor ??
theme.colorScheme.primary,
width: focusedBorderWidth ?? borderWidth ?? 2.0));
}
var borders = parseFormFieldBorders(widget.control, theme);

InputDecorationTheme inputDecorationTheme = InputDecorationTheme(
filled: widget.control.getBool("filled", false)!,
fillColor: fillColor,
hintStyle: widget.control.getTextStyle("hint_style", theme),
errorStyle: widget.control.getTextStyle("error_style", theme),
helperStyle: widget.control.getTextStyle("helper_style", theme),
border: border,
enabledBorder: border,
focusedBorder: focusedBorder,
border: borders.border,
enabledBorder: borders.enabledBorder,
focusedBorder: borders.focusedBorder,
errorBorder: borders.errorBorder,
focusedErrorBorder: borders.focusedErrorBorder,
disabledBorder: borders.disabledBorder,
isDense: widget.control.getBool("dense", false)!,
contentPadding: widget.control.getPadding("content_padding"),
);
Expand Down
4 changes: 3 additions & 1 deletion packages/flet/lib/src/controls/dropdownm2.dart
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,9 @@ class _DropdownM2ControlState extends State<DropdownM2Control> {
iconDisabledColor:
widget.control.getColor("select_icon_disabled_color", context),
iconSize: widget.control.getDouble("select_icon_size", 24.0)!,
borderRadius: widget.control.getBorderRadius("border_radius"),
// border_radius is deprecated in 1.0.0 and removed in 1.3.0.
borderRadius: widget.control.getBorderRadius("menu_border_radius") ??
widget.control.getBorderRadius("border_radius"),
alignment: widget.control.getAlignment("alignment") ??
AlignmentDirectional.centerStart,
isExpanded: widget.control.getBool("options_fill_horizontally", true)!,
Expand Down
Loading
Loading