Changed style lists

This commit is contained in:
Juan Gilsanz Polo 2022-10-21 02:06:53 +02:00
parent 682e9d49f5
commit 979b8b0729
7 changed files with 114 additions and 184 deletions

View file

@ -3,15 +3,19 @@ import 'package:flutter/material.dart';
class CustomListTile extends StatelessWidget {
final String title;
final String? subtitle;
final void Function() onTap;
final void Function()? onTap;
final IconData? icon;
final Widget? trailing;
final EdgeInsets? padding;
const CustomListTile({
Key? key,
required this.title,
this.subtitle,
required this.onTap,
this.onTap,
this.icon,
this.trailing,
this.padding
}) : super(key: key);
@override
@ -21,44 +25,51 @@ class CustomListTile extends StatelessWidget {
child: InkWell(
onTap: onTap,
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 15),
padding: padding ?? const EdgeInsets.symmetric(horizontal: 20, vertical: 15),
child: Row(
children: [
if (icon != null) ...[
Icon(
icon,
color: const Color.fromRGBO(104, 104, 104, 1),
Flexible(
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
if (icon != null) ...[
Icon(
icon,
color: const Color.fromRGBO(104, 104, 104, 1),
),
const SizedBox(width: 20),
],
Flexible(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
title,
style: const TextStyle(
fontSize: 18,
fontWeight: FontWeight.normal
),
),
if (subtitle != null) ...[
const SizedBox(height: 5),
Text(
subtitle!,
style: const TextStyle(
color: Color.fromRGBO(104, 104, 104, 1),
fontSize: 14
),
),
]
],
),
)
],
),
const SizedBox(width: 20),
],
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(
width: MediaQuery.of(context).size.width-84,
child: Text(
title,
style: const TextStyle(
fontSize: 18,
fontWeight: FontWeight.normal
),
),
),
if (subtitle != null) ...[
const SizedBox(height: 5),
SizedBox(
width: MediaQuery.of(context).size.width-84,
child: Text(
subtitle!,
style: const TextStyle(
color: Color.fromRGBO(104, 104, 104, 1),
fontSize: 14
),
),
),
]
],
)
),
if (trailing != null) ...[
const SizedBox(width: 10),
trailing!
]
],
),
),