feat: update TextIconListTile to support custom icons
This commit is contained in:
@@ -240,7 +240,7 @@ class _MatchResultViewState extends State<MatchResultView> {
|
||||
return TextIconListTile(
|
||||
key: ValueKey(allPlayers[index].id),
|
||||
text: allPlayers[index].name,
|
||||
iconEnabled: false,
|
||||
icon: Icons.drag_handle,
|
||||
);
|
||||
},
|
||||
),
|
||||
|
||||
@@ -196,6 +196,7 @@ class _PlayerSelectionState extends State<PlayerSelection> {
|
||||
return TextIconListTile(
|
||||
text: suggestedPlayers[index].name,
|
||||
suffixText: getNameCountText(suggestedPlayers[index]),
|
||||
icon: Icons.add,
|
||||
onPressed: () {
|
||||
setState(() {
|
||||
// If the player is not already selected
|
||||
|
||||
@@ -11,7 +11,7 @@ class TextIconListTile extends StatelessWidget {
|
||||
required this.text,
|
||||
this.suffixText = '',
|
||||
this.prefixText = '',
|
||||
this.iconEnabled = true,
|
||||
this.icon,
|
||||
this.onPressed,
|
||||
});
|
||||
|
||||
@@ -24,8 +24,8 @@ class TextIconListTile extends StatelessWidget {
|
||||
/// An optional prefix text to display before the main text.
|
||||
final String prefixText;
|
||||
|
||||
/// A boolean to determine if the icon should be displayed.
|
||||
final bool iconEnabled;
|
||||
/// The icon to display in the tile.
|
||||
final IconData? icon;
|
||||
|
||||
/// The callback to be invoked when the icon is pressed.
|
||||
final VoidCallback? onPressed;
|
||||
@@ -76,11 +76,8 @@ class TextIconListTile extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
),
|
||||
if (iconEnabled)
|
||||
GestureDetector(
|
||||
onTap: onPressed,
|
||||
child: const Icon(Icons.add, size: 20),
|
||||
),
|
||||
if (icon != null)
|
||||
GestureDetector(onTap: onPressed, child: Icon(icon, size: 20)),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user