Skip to content

Commit 833c67c

Browse files
v1: Remove surface_tint_color, update Colors and add some more tests (#5582)
* Refactor checkbox integration tests and update golden images Renamed and replaced golden screenshot files for macOS checkbox tests to use a consistent naming scheme. Refactored test_checkbox.py to simplify screenshot assertions and update test logic to use new screenshot names and methods. * Add labelTextStyle support to PopupMenuButton Introduces labelTextStyle property for PopupMenuItem and updates PopupMenuButtonControl to apply labelTextStyle. Removes deprecated textStyle from PopupMenuTheme and updates documentation to reflect the new styling approach for menu item labels. * Remove default shape logic from PopupMenuButtonControl remove default value from shape for PopupMenuTheme.shape to have effect * Refactor popup menu button integration test assets Renamed and updated golden image files for the popup menu button tests to use 'basic' and 'basic_opened' naming. Updated the test to match new asset names and switched to function-scoped async fixtures for improved isolation. * Add theme test for PopupMenuButton on macOS Introduces a new integration test for PopupMenuButton with custom theme settings on macOS, including golden images for normal and opened states. This enhances coverage for themed appearance and behavior. * updated PopupMenuTheme test * SearchBar: removed default value for textCapitalization for theme to take effect * Remove surface_tint_color from Material controls and themes Eliminates the surface_tint_color property from various Material controls, styles, and theme classes in the Flet SDK. It is not recommended to use in Flutter: "This is not recommended for use. Material 3 spec introduced a set of tone-based surfaces and surface containers in its ColorScheme, which provide more flexibility. The intention is to eventually remove surface tint color from the framework." * Remove surfaceTintColor support from controls and themes Eliminated usage and parsing of the surfaceTintColor property from multiple controls and theme data files. This simplifies the codebase and removes support for a property that is no longer needed or relevant. * Update ColorScheme to use surface_container_highest Replaces usage of surface_variant with surface_container_highest in both Dart and Python implementations of ColorScheme. Removes background, on_background, and surface_variant properties from Python ColorScheme to align with updated theme structure. * Add new Material 3 color scheme properties Extended color handling in both Dart and Python to support new Material 3 color scheme properties such as primaryFixed, secondaryFixed, tertiaryFixed, and related variants. This improves theme compatibility and enables usage of the latest Material color system features. * Update colors.py --------- Co-authored-by: Feodor Fitsner <feodor@appveyor.com>
1 parent a43101f commit 833c67c

43 files changed

Lines changed: 321 additions & 351 deletions

Some content is hidden

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

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,6 @@ class _AlertDialogControlState extends State<AlertDialogControl> {
7575
iconPadding: widget.control.getPadding("icon_padding"),
7676
backgroundColor: widget.control.getColor("bgcolor", context),
7777
buttonPadding: widget.control.getPadding("action_button_padding"),
78-
surfaceTintColor:
79-
widget.control.getColor("surface_tint_color", context),
8078
shadowColor: widget.control.getColor("shadow_color", context),
8179
elevation: widget.control.getDouble("elevation"),
8280
clipBehavior:

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ class AppBarControl extends StatelessWidget implements PreferredSizeWidget {
3636
.extension<SystemUiOverlayStyleTheme>()
3737
?.systemUiOverlayStyle,
3838
shadowColor: control.getColor("shadow_color", context),
39-
surfaceTintColor: control.getColor("surface_tint_color", context),
4039
scrolledUnderElevation: control.getDouble("elevation_on_scroll"),
4140
forceMaterialTransparency:
4241
control.getBool("force_material_transparency", false)!,

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ class _BannerControlState extends State<BannerControl> {
5252
backgroundColor: widget.control.getColor("bgcolor", context),
5353
contentTextStyle:
5454
widget.control.getTextStyle("content_text_style", Theme.of(context)),
55-
surfaceTintColor: widget.control.getColor("surface_tint_color", context),
5655
shadowColor: widget.control.getColor("shadow_color", context),
5756
dividerColor: widget.control.getColor("divider_color", context),
5857
elevation: widget.control.getDouble("elevation"),

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ class BottomAppBarControl extends StatelessWidget {
1717
elevation: control.getDouble("elevation"),
1818
shape: control.getNotchedShape("shape", Theme.of(context)),
1919
shadowColor: control.getColor("shadow_color", context),
20-
surfaceTintColor: control.getColor("surface_tint_color", context),
2120
color: control.getColor("bgcolor", context),
2221
notchMargin: control.getDouble("notch_margin", 4.0)!,
2322
child: control.buildWidget("content"),

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

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ class CardControl extends StatelessWidget {
3636
control.getBool("show_border_on_foreground", true)!;
3737
var bgcolor = control.getColor("bgcolor", context);
3838
var shadowColor = control.getColor("shadow_color", context);
39-
var surfaceTintColor = control.getColor("surface_tint_color", context);
4039

4140
Widget? card;
4241

@@ -53,7 +52,6 @@ class CardControl extends StatelessWidget {
5352
clipBehavior: clipBehavior,
5453
color: bgcolor,
5554
shadowColor: shadowColor,
56-
surfaceTintColor: surfaceTintColor,
5755
child: contentWidget);
5856
} else if (variant == CardVariant.filled) {
5957
card = Card.filled(
@@ -65,7 +63,6 @@ class CardControl extends StatelessWidget {
6563
clipBehavior: clipBehavior,
6664
color: bgcolor,
6765
shadowColor: shadowColor,
68-
surfaceTintColor: surfaceTintColor,
6966
child: contentWidget);
7067
} else {
7168
card = Card(
@@ -77,7 +74,6 @@ class CardControl extends StatelessWidget {
7774
clipBehavior: clipBehavior,
7875
color: bgcolor,
7976
shadowColor: shadowColor,
80-
surfaceTintColor: surfaceTintColor,
8177
child: contentWidget);
8278
}
8379

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ import '../utils/box.dart';
88
import '../utils/colors.dart';
99
import '../utils/edge_insets.dart';
1010
import '../utils/misc.dart';
11+
import '../utils/mouse.dart';
1112
import '../utils/numbers.dart';
1213
import '../utils/text.dart';
1314
import '../utils/theme.dart';
14-
import '../utils/mouse.dart';
1515
import '../widgets/error.dart';
1616
import 'base_controls.dart';
1717

@@ -97,7 +97,6 @@ class _ChipControlState extends State<ChipControl> {
9797
shadowColor: widget.control.getColor("shadow_color", context),
9898
shape: widget.control.getShape("shape", Theme.of(context)),
9999
color: widget.control.getWidgetStateColor("color", Theme.of(context)),
100-
surfaceTintColor: widget.control.getColor("surface_tint_color", context),
101100
pressElevation: widget.control.getDouble("elevation_on_click"),
102101
side: widget.control.getBorderSide("border_side", Theme.of(context)),
103102
clipBehavior:

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,6 @@ class _NavigationBarControlState extends State<NavigationBarControl>
5757
elevation: widget.control.getDouble("elevation"),
5858
labelPadding: widget.control.getPadding("label_padding"),
5959
shadowColor: widget.control.getColor("shadow_color", context),
60-
surfaceTintColor:
61-
widget.control.getColor("surface_tint_color", context),
6260
overlayColor: widget.control
6361
.getWidgetStateColor("overlay_color", Theme.of(context)),
6462
indicatorColor: widget.control.getColor("indicator_color", context),

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ class _NavigationDrawerControlState extends State<NavigationDrawerControl> {
5151
backgroundColor: widget.control.getColor("bgcolor", context),
5252
selectedIndex: _selectedIndex,
5353
shadowColor: widget.control.getColor("shadow_color", context),
54-
surfaceTintColor: widget.control.getColor("surface_tint_color", context),
5554
tilePadding: parseEdgeInsets(widget.control.get("tile_padding"),
5655
const EdgeInsets.symmetric(horizontal: 12.0))!,
5756
onDestinationSelected: _destinationChanged,

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

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import 'package:flet/src/utils/text.dart';
12
import 'package:flutter/material.dart';
23

34
import '../extensions/control.dart';
@@ -31,18 +32,16 @@ class PopupMenuButtonControl extends StatelessWidget {
3132
iconSize: control.getDouble("icon_size"),
3233
splashRadius: control.getDouble("splash_radius"),
3334
shadowColor: control.getColor("shadow_color", context),
34-
surfaceTintColor: control.getColor("surface_tint_color", context),
3535
iconColor: control.getColor("icon_color", context),
3636
elevation: control.getDouble("elevation"),
3737
enableFeedback: control.getBool("enable_feedback"),
3838
padding: control.getPadding("padding", const EdgeInsets.all(8))!,
3939
color: control.getColor("bgcolor", context),
4040
clipBehavior: control.getClipBehavior("clip_behavior", Clip.none)!,
41-
shape: control.getShape("shape", Theme.of(context),
42-
defaultValue: (Theme.of(context).useMaterial3
43-
? RoundedRectangleBorder(
44-
borderRadius: BorderRadius.circular(10))
45-
: null))!,
41+
shape: control.getShape(
42+
"shape",
43+
Theme.of(context),
44+
),
4645
constraints: control.getBoxConstraints("size_constraints"),
4746
style: control.getButtonStyle("style", Theme.of(context)),
4847
popUpAnimationStyle: control.getAnimationStyle("popup_animation_style"),
@@ -62,6 +61,8 @@ class PopupMenuButtonControl extends StatelessWidget {
6261
var itemContent = item.buildTextOrWidget("content");
6362
var itemIcon = item.buildIconOrWidget("icon");
6463
var mouseCursor = item.getMouseCursor("mouse_cursor");
64+
var labelTextStyle = item.getWidgetStateTextStyle(
65+
"label_text_style", Theme.of(context));
6566

6667
Widget? child;
6768
if (itemContent != null && itemIcon == null) {
@@ -84,13 +85,15 @@ class PopupMenuButtonControl extends StatelessWidget {
8485
padding: padding,
8586
enabled: !item.disabled,
8687
mouseCursor: mouseCursor,
88+
labelTextStyle: labelTextStyle,
8789
onTap: () => item.triggerEvent("click", !checked),
8890
child: child,
8991
)
9092
: PopupMenuItem<String>(
9193
value: item.id.toString(),
9294
height: height,
9395
padding: padding,
96+
labelTextStyle: labelTextStyle,
9497
enabled: !item.disabled,
9598
mouseCursor: mouseCursor,
9699
onTap: () {

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

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,9 @@ class SearchBarControl extends StatefulWidget {
2323

2424
class _SearchBarControlState extends State<SearchBarControl> {
2525
late final SearchController _controller;
26+
2627
bool _focused = false;
27-
TextCapitalization _textCapitalization = TextCapitalization.none;
28+
TextCapitalization? _textCapitalization;
2829
late final FocusNode _focusNode;
2930
String? _lastFocusValue;
3031
String? _lastBlurValue;
@@ -57,8 +58,6 @@ class _SearchBarControlState extends State<SearchBarControl> {
5758
}
5859

5960
void _searchTextChanged() {
60-
_textCapitalization = parseTextCapitalization(
61-
widget.control.getString("capitalization"), TextCapitalization.none)!;
6261
_updateValue(_controller.text);
6362
}
6463

@@ -126,6 +125,8 @@ class _SearchBarControlState extends State<SearchBarControl> {
126125
/// No change.
127126
case TextCapitalization.none:
128127
return text;
128+
case null:
129+
return text;
129130
}
130131
}
131132

@@ -159,6 +160,10 @@ class _SearchBarControlState extends State<SearchBarControl> {
159160

160161
var theme = Theme.of(context);
161162

163+
_textCapitalization = parseTextCapitalization(
164+
widget.control.getString("capitalization"),
165+
theme.searchBarTheme.textCapitalization);
166+
162167
Widget anchor = SearchAnchor(
163168
searchController: _controller,
164169
headerHintStyle:
@@ -189,8 +194,6 @@ class _SearchBarControlState extends State<SearchBarControl> {
189194
widget.control.triggerEvent("change", value);
190195
}
191196
: null,
192-
viewSurfaceTintColor:
193-
widget.control.getColor("view_surface_tint_color", context),
194197
textCapitalization: _textCapitalization,
195198
keyboardType: keyboardType,
196199
builder: (BuildContext context, SearchController controller) {
@@ -211,8 +214,6 @@ class _SearchBarControlState extends State<SearchBarControl> {
211214
.getWidgetStateTextStyle("bar_hint_text_style", theme),
212215
shadowColor:
213216
widget.control.getWidgetStateColor("bar_shadow_color", theme),
214-
surfaceTintColor: widget.control
215-
.getWidgetStateColor("bar_surface_tint_color", theme),
216217
side: widget.control
217218
.getWidgetStateBorderSide("bar_border_side", theme),
218219
backgroundColor:

0 commit comments

Comments
 (0)