feat: update TextIconListTile to support custom icons
This commit is contained in:
@@ -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,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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),
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user