Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Flutter IconData class #4696

Open
wants to merge 23 commits into
base: main
Choose a base branch
from
Open

Added Flutter IconData class #4696

wants to merge 23 commits into from

Conversation

omamkaz
Copy link
Contributor

@omamkaz omamkaz commented Jan 11, 2025

Description

Added: Flutter IconData class to implement custom icons in each control supporting IconValue
IconData -> https://api.flutter.dev/flutter/widgets/IconData-class.html

Building

flutter build [platform] --no-tree-shake-icons

Test Code

import flet as ft


def main(page: ft.Page):
    page.horizontal_alignment = ft.CrossAxisAlignment.CENTER
    page.vertical_alignment = ft.MainAxisAlignment.CENTER

    page.fonts = {
        "codicon": "fonts/codicon.ttf"
    }

    page.add(
        ft.Container(
            content=ft.Icon(
                ft.IconData(
                    0xebd8,
                    "codicon"
                ),
                size=128,
                color=ft.Colors.AMBER
            )
        )
    )

ft.app(target=main)

Type of change

  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Checklist

  • I signed the CLA.
  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code

Screenshots

Additional details

Summary by Sourcery

Add support for custom icons using the new IconData class. This allows developers to specify icons from custom fonts by providing the code point, font family, and other relevant properties. Update all relevant controls and methods to support IconData.

New Features:

  • Introduce IconData class to define custom icons from arbitrary fonts.

Tests:

  • Updated test code to showcase the usage of IconData.

Added: `IconData` class support.
Changed: attr `name` into `icon` to support the `IconData` class.
Added: `IconData` to `IconValue`
Added: `_set_attr_icon` method to send icon data.
Changed: the `name` property into `icon` to send icon data.
Added: `IconData` support
Added: `IconData` support
Added: `IconData` support
Added: `IconData` support
Added: `IconData` support
Added: `IconData` support
Added: `IconData` support
Added: `IconData` support
Added: `IconData` support
Added: `IconData` support
Added: `IconData` support
Added: `IconData` support
Added: `IconData` support
Added: `IconData` support
Added: `IconData` support
Added: `IconData` support
Added: `IconData` support
Added: `IconData` support
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant