add documentation Mohammad Aljammal and Elham Rababah
parent
6d6c71655a
commit
198a1854a9
@ -1,73 +0,0 @@
|
||||
import 'package:eva_icons_flutter/eva_icons_flutter.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class ListItem extends StatelessWidget {
|
||||
final IconData icon;
|
||||
final Function onTap;
|
||||
final Color color;
|
||||
final Color iconColor;
|
||||
final bool disabled;
|
||||
final bool arrowIcon;
|
||||
final double arrowIconSize;
|
||||
final Color arrowIconColor;
|
||||
final EdgeInsets padding;
|
||||
final Widget itemContent;
|
||||
final BoxDecoration decoration;
|
||||
|
||||
ListItem(
|
||||
{Key key,
|
||||
this.icon,
|
||||
this.iconColor,
|
||||
this.disabled: false,
|
||||
this.onTap,
|
||||
this.color,
|
||||
this.arrowIcon = false,
|
||||
this.padding,
|
||||
this.itemContent,
|
||||
this.arrowIconColor,
|
||||
this.arrowIconSize = 20,
|
||||
this.decoration})
|
||||
: super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return IgnorePointer(
|
||||
ignoring: disabled,
|
||||
child: Container(
|
||||
decoration: decoration != null ? decoration : BoxDecoration(),
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
if (onTap != null) onTap();
|
||||
},
|
||||
child: Padding(
|
||||
padding: padding != null
|
||||
? padding
|
||||
: const EdgeInsets.symmetric(horizontal: 24.0, vertical: 16.0),
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
if (icon != null)
|
||||
Icon(
|
||||
icon,
|
||||
color:
|
||||
iconColor ?? (color ?? Theme.of(context).primaryColor),
|
||||
size: 19,
|
||||
),
|
||||
if (icon != null) SizedBox(width: 18.0),
|
||||
Opacity(opacity: 0.8, child: itemContent),
|
||||
if (arrowIcon) Expanded(child: Container()),
|
||||
if (arrowIcon)
|
||||
Icon(
|
||||
EvaIcons.chevronRight,
|
||||
color: arrowIconColor != null
|
||||
? arrowIconColor
|
||||
: Colors.grey[500],
|
||||
size: arrowIconSize,
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,93 @@
|
||||
import 'package:eva_icons_flutter/eva_icons_flutter.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
/// Custom Item widget
|
||||
/// [startIcon] icon at the start of the widget
|
||||
/// [startIconSize] icon size of start icon
|
||||
/// [startIconColor] icon color of start icon
|
||||
/// [endIcon] icon at the end of the widget
|
||||
/// [endIconSize] icon size of end icon
|
||||
/// [endIconColor] icon color of end icon
|
||||
/// [disabled] disabled on tap function
|
||||
/// [onTap] opTap function
|
||||
/// [padding] padding of the widget
|
||||
/// [child] child of the widget
|
||||
/// [decoration] decoration of the widget
|
||||
class CustomItem extends StatelessWidget {
|
||||
final IconData startIcon;
|
||||
final double startIconSize;
|
||||
final Color startIconColor;
|
||||
final IconData endIcon;
|
||||
final double endIconSize;
|
||||
final Color endIconColor;
|
||||
final bool disabled;
|
||||
final Function onTap;
|
||||
final EdgeInsets padding;
|
||||
final Widget child;
|
||||
final BoxDecoration decoration;
|
||||
|
||||
CustomItem(
|
||||
{Key key,
|
||||
this.startIcon,
|
||||
this.disabled: false,
|
||||
this.onTap,
|
||||
this.startIconColor,
|
||||
this.endIcon = EvaIcons.chevronRight,
|
||||
this.padding,
|
||||
this.child,
|
||||
this.endIconColor,
|
||||
this.endIconSize = 20,
|
||||
this.decoration,
|
||||
this.startIconSize = 19})
|
||||
: super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return IgnorePointer(
|
||||
ignoring: disabled,
|
||||
child: Container(
|
||||
decoration: decoration != null ? decoration : BoxDecoration(),
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
if (onTap != null) onTap();
|
||||
},
|
||||
child: Padding(
|
||||
padding: padding != null
|
||||
? padding
|
||||
: const EdgeInsets.symmetric(horizontal: 24.0, vertical: 16.0),
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
if (startIcon != null)
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: Icon(
|
||||
startIcon,
|
||||
color: startIconColor ?? Theme.of(context).primaryColor,
|
||||
size: startIconSize,
|
||||
),
|
||||
),
|
||||
if (startIcon != null) SizedBox(width: 18.0),
|
||||
Expanded(
|
||||
child: child,
|
||||
flex: 10,
|
||||
),
|
||||
endIcon == null
|
||||
? Expanded(child: Container())
|
||||
: Expanded(
|
||||
flex: 1,
|
||||
child: Icon(
|
||||
endIcon,
|
||||
color: endIconColor != null
|
||||
? endIconColor
|
||||
: Colors.grey[500],
|
||||
size: endIconSize,
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
@ -1,12 +1,23 @@
|
||||
import 'package:flutter/material.dart';
|
||||
/// Flexible container widget
|
||||
/// [widthFactor] If non-null, the fraction of the incoming width given to the child.
|
||||
/// If non-null, the child is given a tight width constraint that is the max
|
||||
/// incoming width constraint multiplied by this factor.
|
||||
/// If null, the incoming width constraints are passed to the child
|
||||
|
||||
class ListContainer extends StatelessWidget {
|
||||
/// [heightFactor]If non-null, the fraction of the incoming height given to the child.
|
||||
/// If non-null, the child is given a tight height constraint that is the max
|
||||
/// incoming height constraint multiplied by this factor.
|
||||
/// If null, the incoming height constraints are passed to the child
|
||||
/// [padding] add padding to the container
|
||||
/// [child] child widget inside the container
|
||||
class FlexibleContainer extends StatelessWidget {
|
||||
final double widthFactor;
|
||||
final double heightFactor;
|
||||
final EdgeInsets padding;
|
||||
final Widget child;
|
||||
|
||||
ListContainer({
|
||||
FlexibleContainer({
|
||||
Key key,
|
||||
this.widthFactor = 0.9,
|
||||
this.heightFactor = 1,
|
Loading…
Reference in New Issue