textStyle property
The textStyle used to sets the text style for the suggestion item based on their state, such as hovered or pressed.
Example:
List<AssistMessage> _messages = <AssistMessage>[
AssistMessage.response(
suggestionSettings: AssistSuggestionSettings(
textStyle: WidgetStateProperty.resolveWith(
(Set<WidgetState> state) {
if (state.contains(WidgetState.selected)) {
return const TextStyle(
color: Colors.blue,
fontSize: 16.0,
fontWeight: FontWeight.bold);
} else if (state.contains(WidgetState.focused)) {
return const TextStyle(
color: Colors.blueGrey,
fontSize: 16.0,
fontWeight: FontWeight.bold);
} else if (state.contains(WidgetState.hovered)) {
return const TextStyle(
color: Colors.lightBlueAccent,
fontSize: 16.0,
fontWeight: FontWeight.bold);
} else if (state.contains(WidgetState.disabled)) {
return const TextStyle(
color: Colors.grey,
fontSize: 16.0,
fontWeight: FontWeight.bold);
}
return const TextStyle(
color: Colors.black,
fontSize: 16.0,
fontWeight: FontWeight.bold);
},
),
)
),
];
Implementation
@override
final WidgetStateProperty<TextStyle?>? textStyle;