iconoir-icons / iconoir

An open source icons library with 1500+ icons, supporting React, React Native, Flutter, Vue, Figma, and Framer.

Home Page:https://iconoir.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[FEAT] On flutter, try to get color from IconTheme closest context

ceopaludetto opened this issue · comments

Is your feature request related to a problem? Please describe.
Right now you need to manually change the icon color when using the flutter package

Describe the solution you'd like
The template should use the following order:

final colorToUse = color ?? IconTheme.of(context).color

Describe alternatives you've considered
Right now I'm using a really simple builder to get the current color in the context and send to the icon

import 'package:flutter/material.dart';

class WithContextColor extends StatelessWidget {
  const WithContextColor({super.key, required this.builder});

  final Widget Function(Color?) builder;

  @override
  Widget build(BuildContext context) {
    final color = IconTheme.of(context).color;
    return builder(color);
  }
}

Usage

NavigationDestination(
  label: "Home",
  icon: WithContextColor(builder: (color) => HomeSimple(color: color)),
),

Upvote & Fund

  • We're using Polar.sh so you can upvote and help fund this issue.
  • We receive the funding once the issue is completed & confirmed by you.
  • Thank you in advance for helping prioritize & fund our backlog.
Fund with Polar