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

NeumorphicToggle doesn't support transparent foreground #267

Open
robnorr opened this issue Oct 28, 2022 · 0 comments
Open

NeumorphicToggle doesn't support transparent foreground #267

robnorr opened this issue Oct 28, 2022 · 0 comments

Comments

@robnorr
Copy link

robnorr commented Oct 28, 2022

I'm using a NeumorphicToggle to control tabs. It looks great, however when I set color of the thumb's style to Colors.transparent, I get a pale blue foreground toggle element, not a transparent one. The background element works perfectly.

image

Setting the thumb style color to anything else works fine (e.g. Colors.red):

image

NeumorphicToggle(
  style: NeumorphicToggleStyle(
    backgroundColor: Colors.transparent,
  ),
  height: 50,
  selectedIndex: _tabController.index,
  displayForegroundOnlyIfSelected: true,
  children: [
    ToggleElement(
      background: const Center(
          child: Text(
        "Tab 1",
        style: TextStyle(fontWeight: FontWeight.w500),
      )),
      foreground: const Center(
          child: Text(
        "Tab 1",
        style: TextStyle(fontWeight: FontWeight.w700),
      )),
    ),
    ToggleElement(
      background: const Center(
          child: Text(
        "Tab 2",
        style: TextStyle(fontWeight: FontWeight.w500),
      )),
      foreground: const Center(
          child: Text(
        "Tab 2",
        style: TextStyle(fontWeight: FontWeight.w700),
      )),
    ),
  ],
  thumb: Neumorphic(
    style: NeumorphicStyle(
        boxShape: NeumorphicBoxShape.roundRect(
          BorderRadius.all(Radius.circular(12)),
        ),
        color: Colors.transparent),
  ),
  onChanged: (value) {
    setState(() {
      _tabController.animateTo(value);
    });
  },
)

platform is MacOs

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

No branches or pull requests

1 participant