import 'package:flutter/gestures.dart'; import 'package:flutter/rendering.dart'; TextSpan trainIdSpan({ required String rank, required String number, Locale? locale, MouseCursor? mouseCursor, void Function(PointerEnterEvent)? onEnter, void Function(PointerExitEvent)? onExit, GestureRecognizer? recognizer, String? semanticsLabel, bool? spellOut, TextStyle? style, }) => TextSpan( children: [ TextSpan( text: rank, style: TextStyle( inherit: true, color: rank.startsWith('IC') ? const Color.fromARGB(255, 0, 255, 0) : rank.startsWith('IR') ? const Color.fromARGB(255, 255, 0, 0) : null, ), ), const TextSpan(text: ' '), TextSpan(text: number), ], locale: locale, mouseCursor: mouseCursor, onEnter: onEnter, onExit: onExit, recognizer: recognizer, semanticsLabel: semanticsLabel, spellOut: spellOut, style: style, );