feat: update TextIconListTile to support custom icons
Some checks failed
Pull Request Pipeline / test (pull_request) Successful in 47s
Pull Request Pipeline / lint (pull_request) Failing after 49s

This commit is contained in:
2026-05-09 11:50:49 +02:00
parent bc997633eb
commit 868460b023
3 changed files with 7 additions and 9 deletions

View File

@@ -240,7 +240,7 @@ class _MatchResultViewState extends State<MatchResultView> {
return TextIconListTile( return TextIconListTile(
key: ValueKey(allPlayers[index].id), key: ValueKey(allPlayers[index].id),
text: allPlayers[index].name, text: allPlayers[index].name,
iconEnabled: false, icon: Icons.drag_handle,
); );
}, },
), ),

View File

@@ -196,6 +196,7 @@ class _PlayerSelectionState extends State<PlayerSelection> {
return TextIconListTile( return TextIconListTile(
text: suggestedPlayers[index].name, text: suggestedPlayers[index].name,
suffixText: getNameCountText(suggestedPlayers[index]), suffixText: getNameCountText(suggestedPlayers[index]),
icon: Icons.add,
onPressed: () { onPressed: () {
setState(() { setState(() {
// If the player is not already selected // If the player is not already selected

View File

@@ -11,7 +11,7 @@ class TextIconListTile extends StatelessWidget {
required this.text, required this.text,
this.suffixText = '', this.suffixText = '',
this.prefixText = '', this.prefixText = '',
this.iconEnabled = true, this.icon,
this.onPressed, this.onPressed,
}); });
@@ -24,8 +24,8 @@ class TextIconListTile extends StatelessWidget {
/// An optional prefix text to display before the main text. /// An optional prefix text to display before the main text.
final String prefixText; final String prefixText;
/// A boolean to determine if the icon should be displayed. /// The icon to display in the tile.
final bool iconEnabled; final IconData? icon;
/// The callback to be invoked when the icon is pressed. /// The callback to be invoked when the icon is pressed.
final VoidCallback? onPressed; final VoidCallback? onPressed;
@@ -76,11 +76,8 @@ class TextIconListTile extends StatelessWidget {
), ),
), ),
), ),
if (iconEnabled) if (icon != null)
GestureDetector( GestureDetector(onTap: onPressed, child: Icon(icon, size: 20)),
onTap: onPressed,
child: const Icon(Icons.add, size: 20),
),
], ],
), ),
); );