renamed IconListTile to TextIconListTile and replaced the icon parameter with iconEnabled in both TextIconListTile and TextIconTile
This commit is contained in:
@@ -1,16 +1,16 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:game_tracker/core/custom_theme.dart';
|
||||
|
||||
class IconListTile extends StatelessWidget {
|
||||
class TextIconListTile extends StatelessWidget {
|
||||
final String text;
|
||||
final IconData icon;
|
||||
final VoidCallback onPressed;
|
||||
final bool iconEnabled;
|
||||
|
||||
const IconListTile({
|
||||
const TextIconListTile({
|
||||
super.key,
|
||||
required this.text,
|
||||
required this.icon,
|
||||
required this.onPressed,
|
||||
this.iconEnabled = true,
|
||||
});
|
||||
|
||||
@override
|
||||
@@ -28,13 +28,23 @@ class IconListTile extends StatelessWidget {
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
Flexible(
|
||||
child: Text(
|
||||
text,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: const TextStyle(fontSize: 16, fontWeight: FontWeight.w500),
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(vertical: 12.5),
|
||||
child: Text(
|
||||
text,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: const TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
IconButton(icon: Icon(icon, size: 20), onPressed: onPressed),
|
||||
if (iconEnabled)
|
||||
IconButton(
|
||||
icon: const Icon(Icons.add, size: 20),
|
||||
onPressed: onPressed,
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
@@ -3,14 +3,14 @@ import 'package:game_tracker/core/custom_theme.dart';
|
||||
|
||||
class TextIconTile extends StatelessWidget {
|
||||
final String text;
|
||||
final IconData? icon;
|
||||
final bool iconEnabled;
|
||||
final VoidCallback? onIconTap;
|
||||
|
||||
const TextIconTile({
|
||||
super.key,
|
||||
required this.text,
|
||||
this.icon,
|
||||
this.onIconTap,
|
||||
this.iconEnabled = true,
|
||||
});
|
||||
|
||||
@override
|
||||
@@ -25,7 +25,7 @@ class TextIconTile extends StatelessWidget {
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
if (icon != null) const SizedBox(width: 3),
|
||||
if (iconEnabled) const SizedBox(width: 3),
|
||||
Flexible(
|
||||
child: Text(
|
||||
text,
|
||||
@@ -33,9 +33,12 @@ class TextIconTile extends StatelessWidget {
|
||||
style: const TextStyle(fontSize: 14, fontWeight: FontWeight.w500),
|
||||
),
|
||||
),
|
||||
if (icon != null) ...<Widget>[
|
||||
if (iconEnabled) ...<Widget>[
|
||||
const SizedBox(width: 3),
|
||||
GestureDetector(onTap: onIconTap, child: Icon(icon, size: 20)),
|
||||
GestureDetector(
|
||||
onTap: onIconTap,
|
||||
child: const Icon(Icons.close, size: 20),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user