caduandrade / tabbed_view

Widget inspired by the classic Desktop-style tab component.
MIT License
51 stars 16 forks source link

Update button in tab #9

Closed garthawaters closed 2 years ago

garthawaters commented 2 years ago

Hi, Thanks for a great product.

I have added a button to the tab via TabButton. However, I wish to change the color of the Icon when it is clicked. Is this possible please?

Many Thanks Garth

caduandrade commented 2 years ago

Unfortunately, the only way is to remove the tab and insert a new one. It's not good. I'm looking at how to make it easier ok?

caduandrade commented 2 years ago

I'm thinking of adding an optional id to the tab class. In addition, it also makes the attributes editable and notifiable. So, the button onPressed could get a tab from the controller using the id and change any attribute from it. What do you think?

garthawaters commented 2 years ago

Thank you so much for your quick response.

That idea sounds perfect - Thank you.

Another request please.

Is it possible to delimit the values on the hierarchy method in docking_layout.dart?

Something like:

String hierarchy( {bool indexInfo = false, bool levelInfo = false, bool hasParentInfo = false, bool nameInfo = false}) { String str = typeAcronym; if (indexInfo) { str += index.toString() + '|'; } if (levelInfo) { str += level.toString(); } if (hasParentInfo) { if (_parent == null) { str += 'F'; } else { str += 'T'; } } return str; } }

You will see the values are delimited by a '|'.

I use this a lot to serialize the panes to Json.

Many Thanks

Garth

On 2022-03-18 15:38, Carlos Eduardo Leite de Andrade wrote:

I'm thinking of adding an optional id to the tab class. In addition, it also makes the attributes editable and notifiable. So, the button onPressed could get a tab from the controller using the id and change any attribute from it. What do you think?

-- Reply to this email directly, view it on GitHub [1], or unsubscribe [2]. Triage notifications on the go with GitHub Mobile for iOS [3] or Android [4]. You are receiving this because you authored the thread.Message ID: @.***>

Links:

[1] https://github.com/caduandrade/tabbed_view/issues/9#issuecomment-1072419717 [2] https://github.com/notifications/unsubscribe-auth/AYJIKZ627IO6RER4KOU4SIDVASBMVANCNFSM5RBZ47XQ [3] https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 [4] https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub

caduandrade commented 2 years ago

DockingLayout is my other package. I can see it as well but first, let me change the TabbedView ok?

caduandrade commented 2 years ago

@garthawaters ,

Example of a State changing the color by recreating the buttons:

  late TabbedViewController _controller;

  TabButton _buildTabButton(Color color) {
    return TabButton(
        icon: IconProvider.data(Icons.star),
        color: color,
        hoverColor: color,
        onPressed: _onTabButtonPressed);
  }

  void _onTabButtonPressed() {
    TabData tab = _controller.getTabByIndex(0);
    tab.text = 'hello';
    tab.closable = false;
    tab.buttons = [_buildTabButton(Colors.red)];
  }

  @override
  void initState() {
    super.initState();
    _controller = TabbedViewController([
      TabData(
          buttons: [_buildTabButton(Colors.black)],
          text: 'Tab 1',
          content: Padding(child: Text('Hello'), padding: EdgeInsets.all(8)))
    ]);
  }

This works for you, right? Can I release a version?

garthawaters commented 2 years ago

Perfect, thank you

On 2022-03-18 16:04, Carlos Eduardo Leite de Andrade wrote:

DockingLayout is my other package. I can see it as well but first, let me change the TabbedView ok?

-- Reply to this email directly, view it on GitHub [1], or unsubscribe [2]. Triage notifications on the go with GitHub Mobile for iOS [3] or Android [4]. You are receiving this because you authored the thread.Message ID: @.***>

Links:

[1] https://github.com/caduandrade/tabbed_view/issues/9#issuecomment-1072443018 [2] https://github.com/notifications/unsubscribe-auth/AYJIKZ7NQFDVNXHUXZF6S43VASENPANCNFSM5RBZ47XQ [3] https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 [4] https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub

garthawaters commented 2 years ago

That certainly works for me - Thank you

On 2022-03-18 16:47, Carlos Eduardo Leite de Andrade wrote:

@garthawaters [1] ,

Example of a State changing the color by recreating the buttons:

late TabbedViewController _controller;

TabButton _buildTabButton(Color color) { return TabButton( icon: IconProvider.data(Icons.star), color: color, hoverColor: color, onPressed: _onTabButtonPressed); }

void _onTabButtonPressed() { TabData tab = _controller.getTabByIndex(0); tab.text = 'hello'; tab.closable = false; tab.buttons = [_buildTabButton(Colors.red)]; }

@override void initState() { super.initState(); _controller = TabbedViewController([ TabData( buttons: [_buildTabButton(Colors.black)], text: 'Tab 1', content: Padding(child: Text('Hello'), padding: EdgeInsets.all(8))) ]); }

This works for you, right? Can I release a version?

-- Reply to this email directly, view it on GitHub [2], or unsubscribe [3]. Triage notifications on the go with GitHub Mobile for iOS [4] or Android [5]. You are receiving this because you were mentioned.Message ID: @.***>

Links:

[1] https://github.com/garthawaters [2] https://github.com/caduandrade/tabbed_view/issues/9#issuecomment-1072481797 [3] https://github.com/notifications/unsubscribe-auth/AYJIKZ6OBMVEGTGT4HS7UTDVASJPLANCNFSM5RBZ47XQ [4] https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 [5] https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub

caduandrade commented 2 years ago

Done. 1.12.0 released. If anything else is missing, let me know. If you can register a :thumbsup: on pub.dev or a :star: here on Github, I'd appreciate it!

About the docking issue, can you open a new issue on https://github.com/caduandrade/docking_flutter/issues ?

Thanks

garthawaters commented 2 years ago

Wow, your response is amazing, much appreciated

I will install and try the new version - Thanks again

On 2022-03-18 21:13, Carlos Eduardo Leite de Andrade wrote:

Done. 1.12.0 released. If anything else is missing, let me know. If you can register a 👍 on pub.dev or a ⭐ here on Github, I'd appreciate it!

About the docking issue, can you open a new issue on https://github.com/caduandrade/docking_flutter/issues ?

Thanks

-- Reply to this email directly, view it on GitHub [1], or unsubscribe [2]. Triage notifications on the go with GitHub Mobile for iOS [3] or Android [4]. You are receiving this because you were mentioned.Message ID: @.***>

Links:

[1] https://github.com/caduandrade/tabbed_view/issues/9#issuecomment-1072727285 [2] https://github.com/notifications/unsubscribe-auth/AYJIKZ7B6KZJDHXIO25ENPDVATIULANCNFSM5RBZ47XQ [3] https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 [4] https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub