Merge branch 'master' of https://gitlab.com/Cloud_Solution/diplomatic-quarter
commit
d897463b42
@ -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,
|
@ -1,38 +1,43 @@
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
|
||||
///Slide Up Page Route
|
||||
/// [widget] widget we need to slide up
|
||||
/// [fullscreenDialog] show the widget as full screen dialog
|
||||
/// [opaque] When an opaque route's entrance transition is complete, the routes behind the opaque route will not be built to save resources.
|
||||
class SlideUpPageRoute extends PageRouteBuilder {
|
||||
final Widget widget;
|
||||
final bool fullscreenDialog;
|
||||
final bool opaque;
|
||||
|
||||
SlideUpPageRoute({this.widget, this.fullscreenDialog=false, this.opaque=true})
|
||||
: super(pageBuilder: (
|
||||
BuildContext context,
|
||||
Animation<double> animation,
|
||||
Animation<double> secondaryAnimation,
|
||||
) {
|
||||
return widget;
|
||||
},
|
||||
fullscreenDialog: fullscreenDialog,
|
||||
opaque: opaque,
|
||||
barrierColor: Color.fromRGBO(0, 0, 0, 0.5),
|
||||
barrierDismissible: true,
|
||||
transitionDuration: Duration(milliseconds: 800),
|
||||
transitionsBuilder: ((BuildContext context,
|
||||
Animation<double> animation,
|
||||
Animation<double> secondaryAnimation,
|
||||
Widget child) {
|
||||
var begin = Offset(0.0, 1.0);
|
||||
var end = Offset.zero;
|
||||
var curve = Curves.easeInOutQuint;
|
||||
SlideUpPageRoute(
|
||||
{this.widget, this.fullscreenDialog = false, this.opaque = true})
|
||||
: super(
|
||||
pageBuilder: (
|
||||
BuildContext context,
|
||||
Animation<double> animation,
|
||||
Animation<double> secondaryAnimation,
|
||||
) {
|
||||
return widget;
|
||||
},
|
||||
fullscreenDialog: fullscreenDialog,
|
||||
opaque: opaque,
|
||||
barrierColor: Color.fromRGBO(0, 0, 0, 0.5),
|
||||
barrierDismissible: true,
|
||||
transitionDuration: Duration(milliseconds: 800),
|
||||
transitionsBuilder: ((BuildContext context,
|
||||
Animation<double> animation,
|
||||
Animation<double> secondaryAnimation,
|
||||
Widget child) {
|
||||
var begin = Offset(0.0, 1.0);
|
||||
var end = Offset.zero;
|
||||
var curve = Curves.easeInOutQuint;
|
||||
|
||||
var tween = Tween(begin: begin, end: end).chain(CurveTween(curve: curve));
|
||||
var tween =
|
||||
Tween(begin: begin, end: end).chain(CurveTween(curve: curve));
|
||||
|
||||
return SlideTransition(
|
||||
position: animation.drive(tween),
|
||||
child: child
|
||||
);
|
||||
}));
|
||||
}
|
||||
return SlideTransition(
|
||||
position: animation.drive(tween), child: child);
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
Loading…
Reference in New Issue