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:flutter/material.dart';
|
||||||
import 'package:game_tracker/core/custom_theme.dart';
|
import 'package:game_tracker/core/custom_theme.dart';
|
||||||
|
|
||||||
class IconListTile extends StatelessWidget {
|
class TextIconListTile extends StatelessWidget {
|
||||||
final String text;
|
final String text;
|
||||||
final IconData icon;
|
|
||||||
final VoidCallback onPressed;
|
final VoidCallback onPressed;
|
||||||
|
final bool iconEnabled;
|
||||||
|
|
||||||
const IconListTile({
|
const TextIconListTile({
|
||||||
super.key,
|
super.key,
|
||||||
required this.text,
|
required this.text,
|
||||||
required this.icon,
|
|
||||||
required this.onPressed,
|
required this.onPressed,
|
||||||
|
this.iconEnabled = true,
|
||||||
});
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -28,13 +28,23 @@ class IconListTile extends StatelessWidget {
|
|||||||
mainAxisSize: MainAxisSize.max,
|
mainAxisSize: MainAxisSize.max,
|
||||||
children: [
|
children: [
|
||||||
Flexible(
|
Flexible(
|
||||||
child: Text(
|
child: Container(
|
||||||
text,
|
padding: const EdgeInsets.symmetric(vertical: 12.5),
|
||||||
overflow: TextOverflow.ellipsis,
|
child: Text(
|
||||||
style: const TextStyle(fontSize: 16, fontWeight: FontWeight.w500),
|
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 {
|
class TextIconTile extends StatelessWidget {
|
||||||
final String text;
|
final String text;
|
||||||
final IconData? icon;
|
final bool iconEnabled;
|
||||||
final VoidCallback? onIconTap;
|
final VoidCallback? onIconTap;
|
||||||
|
|
||||||
const TextIconTile({
|
const TextIconTile({
|
||||||
super.key,
|
super.key,
|
||||||
required this.text,
|
required this.text,
|
||||||
this.icon,
|
|
||||||
this.onIconTap,
|
this.onIconTap,
|
||||||
|
this.iconEnabled = true,
|
||||||
});
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -25,7 +25,7 @@ class TextIconTile extends StatelessWidget {
|
|||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
if (icon != null) const SizedBox(width: 3),
|
if (iconEnabled) const SizedBox(width: 3),
|
||||||
Flexible(
|
Flexible(
|
||||||
child: Text(
|
child: Text(
|
||||||
text,
|
text,
|
||||||
@@ -33,9 +33,12 @@ class TextIconTile extends StatelessWidget {
|
|||||||
style: const TextStyle(fontSize: 14, fontWeight: FontWeight.w500),
|
style: const TextStyle(fontSize: 14, fontWeight: FontWeight.w500),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
if (icon != null) ...<Widget>[
|
if (iconEnabled) ...<Widget>[
|
||||||
const SizedBox(width: 3),
|
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