We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
How should I set the text color of the selected item?
The text was updated successfully, but these errors were encountered:
@martijndierckx hi, one way to do this
int current = 0; @override Widget build(BuildContext context) { return CustomSlidingSegmentedControl<int>( isStretch: true, initialValue: 2, height: 24, children: { 0: Text( 'News daily portal', style: TextStyle(color: current == 0 ? Colors.red : Colors.black), ), 1: Text( 'Map', style: TextStyle(color: current == 1 ? Colors.red : Colors.black), ), 2: Text( 'Paper', style: TextStyle(color: current == 2 ? Colors.red : Colors.black), ), }, decoration: BoxDecoration( color: CupertinoColors.lightBackgroundGray, borderRadius: BorderRadius.circular(8), ), thumbDecoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.circular(6), boxShadow: [ BoxShadow( color: Colors.black.withOpacity(.3), blurRadius: 4.0, spreadRadius: 1.0, offset: const Offset( 0.0, 2.0, ), ), ], ), duration: const Duration(milliseconds: 300), curve: Curves.easeInToLinear, onValueChanged: (v) { setState(() { current = v; }); }, ); }
Sorry, something went wrong.
No branches or pull requests
How should I set the text color of the selected item?
The text was updated successfully, but these errors were encountered: