Skip to content

Commit 6c04a5f

Browse files
committed
Use 24 bit to encode icon
1 parent d53230a commit 6c04a5f

File tree

5 files changed

+9929
-9929
lines changed

5 files changed

+9929
-9929
lines changed

ci/generate_icons.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,15 @@ def parse_dart_icons(dart_content: str, set_id: int):
3030
for match in ICON_ENTRY_PATTERN.finditer(dart_content):
3131
var_name = match.group("var_name")
3232
codepoint = int(match.group("codepoint"), 16)
33-
packed_value = (set_id << 16) | codepoint
33+
packed_value = (set_id << 24) | codepoint
3434
icons.append((normalize_enum_name(var_name), hex(packed_value)))
3535
print(f"🔍 Found {len(icons)} icons for set ID {set_id}.")
3636
return icons
3737

3838

3939
def generate_python_enum(icons, output_file: str, class_name: str):
4040
with open(output_file, "w", encoding="utf-8") as f:
41-
f.write(f"class {class_name}(BaseIcon):\n")
41+
f.write(f"class {class_name}(IconData):\n")
4242
for name, code in icons:
4343
f.write(f" {name} = {code}\n")
4444
print(f"✅ Enum written to {output_file}")

packages/flet/lib/src/flet_core_extension.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -372,8 +372,8 @@ class FletCoreExtension extends FletExtension {
372372

373373
@override
374374
IconData? createIconData(iconCode) {
375-
int setId = (iconCode >> 16) & 0xFF;
376-
int codePoint = iconCode & 0xFFFF;
375+
int setId = (iconCode >> 24) & 0xFF;
376+
int codePoint = iconCode & 0xFFFFFF;
377377
String? fontFamily;
378378
String? fontPackage;
379379

0 commit comments

Comments
 (0)