iconoir icon indicating copy to clipboard operation
iconoir copied to clipboard

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

Open ceopaludetto opened this issue 8 months ago • 0 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

ceopaludetto avatar Jun 09 '24 22:06 ceopaludetto