-
Notifications
You must be signed in to change notification settings - Fork 130
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
fix: use container to fix expansion of tab #101
Conversation
lib/scaffolds/tab.dart
Outdated
width: 100, | ||
child: Center( | ||
child: Text(text), | ||
), | ||
))), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about adding Row > Expanded
as CupertinoSlidingSegmentedControl
's parent? Then it would expand to the full width.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The magic number 100 would break again if the word becomes long enough at next time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried using Row > Expanded
as I mentioned in the issue. Didn't work
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if I made it clear. The following code seems work fine.
Widget _buildTitle(BuildContext context) {
switch (Provider.of<ThemeModel>(context).theme) {
case AppThemeType.cupertino:
return DefaultTextStyle(
style: DefaultTextStyle.of(context).style.copyWith(fontSize: 14),
child: Row(
children: [
Expanded(
child: CupertinoSlidingSegmentedControl(
groupValue: activeTab,
onValueChanged: onTabSwitch,
children: tabs.asMap().map((key, text) => MapEntry(
key,
Padding(
padding: const EdgeInsets.symmetric(horizontal: 8),
child: Text(text),
))),
),
),
],
),
);
default:
return title;
}
}
Hi, @shreyas1599 , I've pushed an extra commit to make it ready to merge. Feel free to ping me if there are other problems. |
Hi, @pd4d10 sorry for the late reply. I understood my mistake. My mistake was that I put |
Fixes #95
I initially made the suggestion to change the padding to 12 from 10, but that didn't work when I tried it on the iPad. Changing to a container with a fixed width did the trick.