Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
145 changes: 52 additions & 93 deletions lib/components/list_tile/gf_list_tile.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ import 'package:getflutter/colors/gf_color.dart';
import 'package:getflutter/components/avatar/gf_avatar.dart';

class GFListTile extends StatelessWidget {
///type of [String] used to pass text, alternative to title property and gets higher priority than title
final String titleText;

///type of [String] used to pass text, alternative to subtitle property and gets higher priority than subtitle
final String subtitleText;

/// The GFListTile's background color. Can be given [Colors] or [GFColor]
final dynamic color;

Expand All @@ -19,110 +25,63 @@ class GFListTile extends StatelessWidget {
/// The description to display inside the [GFListTile]. see [Text]
final Widget description;

/// The description to display inside the [GFListTile]. see [Text]
final Widget trailing;

/// The icon to display inside the [GFListTile]. see [Icon]
final Widget icon;

///type of [bool] corresponds to true or false to show or hide the divider
final bool showDivider;

/// The empty space that surrounds the card. Defines the card's outer [Container.padding]..
final EdgeInsetsGeometry padding;

/// The divider's height extent.
///
/// The divider itself is always drawn as a horizontal line that is centered
/// within the height specified by this value.
///
/// If this is null, then the [DividerThemeData.space] is used. If that is
/// also null, then this defaults to 16.0.
final double dividerHeight;

/// The thickness of the line drawn within the divider.
///
/// A divider with a [thickness] of 0.0 is always drawn as a line with a
/// height of exactly one device pixel.
///
/// If this is null, then the [DividerThemeData.dividerThickness] is used. If
/// that is also null, then this defaults to 0.0.
final double dividerThickness;

/// The amount of empty space to the leading edge of the divider.
///
/// If this is null, then the [DividerThemeData.indent] is used. If that is
/// also null, then this defaults to 0.0.
final double dividerIndent;

/// The amount of empty space to the trailing edge of the divider.
///
/// If this is null, then the [DividerThemeData.endIndent] is used. If that is
/// also null, then this defaults to 0.0.
final double dividerEndIndent;

/// The color to use when painting the line.
///
/// If this is null, then the [DividerThemeData.color] is used. If that is
/// also null, then [ThemeData.dividerColor] is used.
final Color dividerColor;

/// Creates ListTile with leading, title, trailing, image widget for almost every type of ListTile design.
const GFListTile(
{Key key,
this.color,
this.avatar,
this.title,
this.subTitle,
this.description,
this.icon,
this.showDivider = true,
this.padding,
this.trailing,
this.dividerEndIndent,
this.dividerHeight,
this.dividerIndent,
this.dividerThickness,
this.dividerColor})
: super(key: key);
const GFListTile({
Key key,
this.titleText,
this.subtitleText,
this.color,
this.avatar,
this.title,
this.subTitle,
this.description,
this.icon,
}) : super(key: key);

@override
Widget build(BuildContext context) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Container(
margin: padding,
color: color,
child: ListTile(
leading: avatar,
title: title,
subtitle: subTitle != null || description != null
? Column(
return Container(
constraints: BoxConstraints(minHeight: 50),
padding: EdgeInsets.all(8),
decoration: BoxDecoration(
color: color,
borderRadius: BorderRadius.all(Radius.circular(5)),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
avatar != null ? avatar : Container(),
Expanded(
child: Padding(
padding: EdgeInsets.only(left: 10, right: 10),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
subTitle ?? Container(),
titleText != null
? Text(
titleText,
style: TextStyle(
fontSize: 17,
fontWeight: FontWeight.w500,
color: getGFColor(GFColor.dark)),
)
: title ?? Container(),
subtitleText != null
? Text(
subtitleText,
style: TextStyle(
fontSize: 14.5, color: Colors.black54),
)
: subTitle ?? Container(),
description ?? Container()
],
)
: Container(),
trailing: Padding(padding: EdgeInsets.only(top: 16.0), child: icon),
),
),
showDivider == true
? Divider(
height: dividerHeight == null ? 16.0 : dividerHeight,
thickness: dividerThickness == null ? 1.0 : dividerThickness,
color: dividerColor == null
? Theme.of(context).dividerColor
: dividerColor,
indent: dividerIndent == null ? 0.0 : dividerIndent,
endIndent: dividerEndIndent == null ? 0.0 : dividerEndIndent,
)
: Container(
height: 10.0,
)
],
))),
icon != null ? icon : Container(),
],
),
);
}
}