Merge branch 'design-fixes' into 'development'
working on buttons widgets See merge request Cloud_Solution/doctor_app_flutter!520merge-requests/522/merge
commit
1fd7a2a394
@ -1,262 +0,0 @@
|
|||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:hexcolor/hexcolor.dart';
|
|
||||||
|
|
||||||
class Texts extends StatefulWidget {
|
|
||||||
final String text;
|
|
||||||
final String variant;
|
|
||||||
final Color color;
|
|
||||||
final bool bold;
|
|
||||||
final bool regular;
|
|
||||||
final bool medium;
|
|
||||||
final int maxLength;
|
|
||||||
final bool italic;
|
|
||||||
final TextAlign textAlign;
|
|
||||||
final int maxLines;
|
|
||||||
final bool readMore;
|
|
||||||
final String style;
|
|
||||||
final bool allowExpand;
|
|
||||||
final double fontSize;
|
|
||||||
final FontWeight fontWeight;
|
|
||||||
final TextDecoration textDecoration;
|
|
||||||
|
|
||||||
Texts(this.text,
|
|
||||||
{Key key,
|
|
||||||
this.variant,
|
|
||||||
this.color,
|
|
||||||
this.bold,
|
|
||||||
this.regular,
|
|
||||||
this.medium,
|
|
||||||
this.allowExpand = true,
|
|
||||||
this.italic: false,
|
|
||||||
this.textAlign,
|
|
||||||
this.maxLength = 60,
|
|
||||||
this.maxLines,
|
|
||||||
this.readMore = false,
|
|
||||||
this.style,
|
|
||||||
this.textDecoration, this.fontSize, this.fontWeight})
|
|
||||||
: super(key: key);
|
|
||||||
|
|
||||||
@override
|
|
||||||
_TextsState createState() => _TextsState();
|
|
||||||
}
|
|
||||||
|
|
||||||
class _TextsState extends State<Texts> {
|
|
||||||
bool hidden = false;
|
|
||||||
String text = "";
|
|
||||||
|
|
||||||
@override
|
|
||||||
void didUpdateWidget(Texts oldWidget) {
|
|
||||||
setState(() {
|
|
||||||
if (widget.style == "overline")
|
|
||||||
text = widget.text.toUpperCase();
|
|
||||||
else {
|
|
||||||
text = widget.text;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
super.didUpdateWidget(oldWidget);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
void initState() {
|
|
||||||
hidden = widget.readMore;
|
|
||||||
if (widget.style == "overline")
|
|
||||||
text = widget.text.toUpperCase();
|
|
||||||
else {
|
|
||||||
text = widget.text;
|
|
||||||
}
|
|
||||||
super.initState();
|
|
||||||
}
|
|
||||||
|
|
||||||
double _getFontSize() {
|
|
||||||
switch (widget.variant) {
|
|
||||||
case "heading0":
|
|
||||||
return 40.0;
|
|
||||||
case "heading":
|
|
||||||
return 32.0;
|
|
||||||
case "heading2":
|
|
||||||
return 28.0;
|
|
||||||
case "heading3":
|
|
||||||
return 18.0;
|
|
||||||
case "body1":
|
|
||||||
return 18.0;
|
|
||||||
case "body2":
|
|
||||||
return 20.0;
|
|
||||||
case "body2Link":
|
|
||||||
return 16.0;
|
|
||||||
case "caption":
|
|
||||||
return 16.0;
|
|
||||||
case "caption2":
|
|
||||||
return 14.0;
|
|
||||||
case "bodyText":
|
|
||||||
return 15.0;
|
|
||||||
case "bodyText2":
|
|
||||||
return 17.0;
|
|
||||||
case "caption3":
|
|
||||||
return 12.0;
|
|
||||||
case "caption4":
|
|
||||||
return 9.0;
|
|
||||||
case "overline":
|
|
||||||
return 11.0;
|
|
||||||
case "date":
|
|
||||||
return 24.0;
|
|
||||||
default:
|
|
||||||
return 16.0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
FontWeight _getFontWeight() {
|
|
||||||
if (widget.bold ?? false) {
|
|
||||||
return FontWeight.w900;
|
|
||||||
} else if (widget.regular ?? false) {
|
|
||||||
return FontWeight.w500;
|
|
||||||
} else if (widget.medium ?? false) {
|
|
||||||
return FontWeight.w800;
|
|
||||||
} else {
|
|
||||||
if (widget.style == null) {
|
|
||||||
switch (widget.variant) {
|
|
||||||
case "heading":
|
|
||||||
return FontWeight.w900;
|
|
||||||
case "heading2":
|
|
||||||
return FontWeight.w900;
|
|
||||||
case "heading3":
|
|
||||||
return FontWeight.w900;
|
|
||||||
case "body1":
|
|
||||||
return FontWeight.w800;
|
|
||||||
case "body2":
|
|
||||||
return FontWeight.w900;
|
|
||||||
case "body2Link":
|
|
||||||
return FontWeight.w800;
|
|
||||||
case "caption":
|
|
||||||
return FontWeight.w700;
|
|
||||||
case "caption2":
|
|
||||||
return FontWeight.w700;
|
|
||||||
case "bodyText":
|
|
||||||
return FontWeight.w500;
|
|
||||||
case "bodyText2":
|
|
||||||
return FontWeight.w500;
|
|
||||||
case "caption3":
|
|
||||||
return FontWeight.w600;
|
|
||||||
case "caption4":
|
|
||||||
return FontWeight.w600;
|
|
||||||
case "overline":
|
|
||||||
return FontWeight.w800;
|
|
||||||
case "date":
|
|
||||||
return FontWeight.w900;
|
|
||||||
default:
|
|
||||||
return FontWeight.w500;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
TextStyle _getFontStyle() {
|
|
||||||
switch (widget.style) {
|
|
||||||
case "headline2":
|
|
||||||
return Theme.of(context).textTheme.headline2;
|
|
||||||
case "headline3":
|
|
||||||
return Theme.of(context).textTheme.headline3;
|
|
||||||
case "headline4":
|
|
||||||
return Theme.of(context).textTheme.headline4;
|
|
||||||
case "headline5":
|
|
||||||
return Theme.of(context).textTheme.headline5;
|
|
||||||
case "headline6":
|
|
||||||
return Theme.of(context).textTheme.headline6;
|
|
||||||
case "bodyText2":
|
|
||||||
return Theme.of(context).textTheme.bodyText2;
|
|
||||||
case "bodyText_15":
|
|
||||||
return Theme.of(context).textTheme.bodyText2.copyWith(fontSize: 15.0);
|
|
||||||
case "bodyText1":
|
|
||||||
return Theme.of(context).textTheme.bodyText1;
|
|
||||||
case "caption":
|
|
||||||
return Theme.of(context).textTheme.caption;
|
|
||||||
case "overline":
|
|
||||||
return Theme.of(context).textTheme.overline;
|
|
||||||
case "button":
|
|
||||||
return Theme.of(context).textTheme.button;
|
|
||||||
default:
|
|
||||||
return TextStyle();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return Column(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: <Widget>[
|
|
||||||
Stack(
|
|
||||||
children: <Widget>[
|
|
||||||
Text(
|
|
||||||
!hidden
|
|
||||||
? text
|
|
||||||
: (text.substring(
|
|
||||||
0,
|
|
||||||
text.length > widget.maxLength
|
|
||||||
? widget.maxLength
|
|
||||||
: text.length)),
|
|
||||||
textAlign: widget.textAlign,
|
|
||||||
overflow: widget.maxLines != null
|
|
||||||
? ((widget.maxLines > 1)
|
|
||||||
? TextOverflow.fade
|
|
||||||
: TextOverflow.ellipsis)
|
|
||||||
: null,
|
|
||||||
maxLines: widget.maxLines ?? null,
|
|
||||||
style: widget.style != null
|
|
||||||
? _getFontStyle().copyWith(
|
|
||||||
fontStyle: widget.italic ? FontStyle.italic : null,
|
|
||||||
color: widget.color != null ? widget.color : null,
|
|
||||||
fontWeight: widget.fontWeight ?? _getFontWeight(),
|
|
||||||
)
|
|
||||||
: TextStyle(
|
|
||||||
fontStyle: widget.italic ? FontStyle.italic : null,
|
|
||||||
color:
|
|
||||||
widget.color != null ? widget.color : Colors.black,
|
|
||||||
fontSize:widget.fontSize?? _getFontSize(),
|
|
||||||
letterSpacing:
|
|
||||||
widget.variant == "overline" ? 1.5 : null,
|
|
||||||
fontWeight: widget.fontWeight ?? _getFontWeight(),
|
|
||||||
fontFamily: 'Poppins',
|
|
||||||
decoration:
|
|
||||||
widget.textDecoration //TextDecoration.lineThrough
|
|
||||||
)),
|
|
||||||
if (widget.readMore && text.length > widget.maxLength && hidden)
|
|
||||||
Positioned(
|
|
||||||
bottom: 0,
|
|
||||||
left: 0,
|
|
||||||
right: 0,
|
|
||||||
child: Container(
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
gradient: LinearGradient(colors: [
|
|
||||||
Theme.of(context).backgroundColor,
|
|
||||||
Theme.of(context).backgroundColor.withOpacity(0),
|
|
||||||
], begin: Alignment.bottomCenter, end: Alignment.topCenter)),
|
|
||||||
height: 30,
|
|
||||||
),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
if (widget.allowExpand &&
|
|
||||||
widget.readMore &&
|
|
||||||
text.length > widget.maxLength)
|
|
||||||
Padding(
|
|
||||||
padding: EdgeInsets.only(top: 8.0, right: 8.0, bottom: 8.0),
|
|
||||||
child: InkWell(
|
|
||||||
onTap: () {
|
|
||||||
setState(() {
|
|
||||||
hidden = !hidden;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
child: Text(hidden ? "Read More" : "Read less",
|
|
||||||
style: _getFontStyle().copyWith(
|
|
||||||
color: HexColor('#FF0000'),
|
|
||||||
fontWeight: FontWeight.w800,
|
|
||||||
fontFamily: "Poppins",
|
|
||||||
)),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,150 +0,0 @@
|
|||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:hexcolor/hexcolor.dart';
|
|
||||||
|
|
||||||
class Button extends StatefulWidget {
|
|
||||||
final String title;
|
|
||||||
final Widget icon;
|
|
||||||
final VoidCallback onTap;
|
|
||||||
final bool loading;
|
|
||||||
final Color color;
|
|
||||||
|
|
||||||
Button({
|
|
||||||
Key key,
|
|
||||||
this.title = "",
|
|
||||||
this.icon,
|
|
||||||
this.onTap,
|
|
||||||
this.loading= false,
|
|
||||||
this.color,
|
|
||||||
}) : super(key: key);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@override
|
|
||||||
_ButtonState createState() => _ButtonState();
|
|
||||||
}
|
|
||||||
|
|
||||||
class _ButtonState extends State<Button> with TickerProviderStateMixin {
|
|
||||||
double _buttonSize = 1.0;
|
|
||||||
AnimationController _animationController;
|
|
||||||
Animation _animation;
|
|
||||||
|
|
||||||
@override
|
|
||||||
void initState() {
|
|
||||||
_animationController = AnimationController(
|
|
||||||
vsync: this,
|
|
||||||
lowerBound: 0.7,
|
|
||||||
upperBound: 1.0,
|
|
||||||
duration: Duration(milliseconds: 120));
|
|
||||||
_animation = CurvedAnimation(
|
|
||||||
parent: _animationController,
|
|
||||||
curve: Curves.easeOutQuad,
|
|
||||||
reverseCurve: Curves.easeOutQuad);
|
|
||||||
_animation.addListener(() {
|
|
||||||
setState(() {
|
|
||||||
_buttonSize = _animation.value;
|
|
||||||
});
|
|
||||||
});
|
|
||||||
super.initState();
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
void dispose() {
|
|
||||||
_animationController.dispose();
|
|
||||||
super.dispose();
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget _buildIcon() {
|
|
||||||
if (widget.icon != null && (widget.title != null && widget.title != "")) {
|
|
||||||
return Container(
|
|
||||||
margin: EdgeInsets.only(right: 12.0),
|
|
||||||
height: 24.0,
|
|
||||||
child: widget.icon);
|
|
||||||
} else if (widget.icon != null) {
|
|
||||||
return Container(
|
|
||||||
height: 18.0,
|
|
||||||
width: 18.0,
|
|
||||||
child: widget.icon,
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
return Container();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return IgnorePointer(
|
|
||||||
ignoring: widget.loading,
|
|
||||||
child: GestureDetector(
|
|
||||||
onTapDown: (TapDownDetails tap) {
|
|
||||||
_animationController.reverse(from: 1.0);
|
|
||||||
},
|
|
||||||
onTapUp: (TapUpDetails tap) {
|
|
||||||
_animationController.forward();
|
|
||||||
},
|
|
||||||
onTapCancel: () {
|
|
||||||
_animationController.forward();
|
|
||||||
},
|
|
||||||
onTap: Feedback.wrapForTap(widget.onTap, context),
|
|
||||||
behavior: HitTestBehavior.opaque,
|
|
||||||
child: Transform.scale(
|
|
||||||
scale: _buttonSize,
|
|
||||||
child: AnimatedContainer(
|
|
||||||
duration: Duration(milliseconds: 150),
|
|
||||||
margin:
|
|
||||||
EdgeInsets.only(bottom: widget.title.isNotEmpty ? 14.0 : 0.0),
|
|
||||||
padding: EdgeInsets.symmetric(
|
|
||||||
vertical: widget.title != null && widget.title.isNotEmpty
|
|
||||||
? 12.0
|
|
||||||
: 15.0,
|
|
||||||
horizontal: widget.title != null && widget.title.isNotEmpty
|
|
||||||
? 22.0
|
|
||||||
: 19),
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: widget.color ?? HexColor('#515b5d'),
|
|
||||||
borderRadius: BorderRadius.all(Radius.circular(10.0)),
|
|
||||||
boxShadow: [
|
|
||||||
BoxShadow(
|
|
||||||
color: Color.fromRGBO(70, 70, 70, 0.28),
|
|
||||||
spreadRadius:
|
|
||||||
_buttonSize < 1.0 ? -(1 - _buttonSize) * 50 : 0.0,
|
|
||||||
offset: Offset(0, 7.0),
|
|
||||||
blurRadius: 24.0)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
child: Row(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
mainAxisSize: MainAxisSize.min,
|
|
||||||
children: <Widget>[
|
|
||||||
_buildIcon(),
|
|
||||||
widget.loading
|
|
||||||
? Padding(
|
|
||||||
padding: const EdgeInsets.all(2.7),
|
|
||||||
child: SizedBox(
|
|
||||||
height: 19.0,
|
|
||||||
width: 19.0,
|
|
||||||
child: CircularProgressIndicator(
|
|
||||||
backgroundColor: Colors.white,
|
|
||||||
valueColor: AlwaysStoppedAnimation<Color>(
|
|
||||||
HexColor('#FFDDD9'),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
: Padding(
|
|
||||||
padding: EdgeInsets.only(bottom: 3.0),
|
|
||||||
child: Text(widget.title,
|
|
||||||
style: TextStyle(
|
|
||||||
color: Colors.white,
|
|
||||||
fontSize: 17.0,
|
|
||||||
fontWeight: FontWeight.w700,
|
|
||||||
fontFamily: "Poppins")),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,92 +0,0 @@
|
|||||||
import 'package:doctor_app_flutter/config/size_config.dart';
|
|
||||||
import 'package:flutter/foundation.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:hexcolor/hexcolor.dart';
|
|
||||||
|
|
||||||
import 'app_texts_widget.dart';
|
|
||||||
|
|
||||||
class AppButton extends StatefulWidget {
|
|
||||||
final GestureTapCallback onPressed;
|
|
||||||
final String title;
|
|
||||||
final IconData icon;
|
|
||||||
final Color color;
|
|
||||||
final double fontSize;
|
|
||||||
final double padding;
|
|
||||||
final Color fontColor;
|
|
||||||
final bool loading;
|
|
||||||
final bool disabled;
|
|
||||||
final FontWeight fontWeight;
|
|
||||||
|
|
||||||
AppButton(
|
|
||||||
{@required this.onPressed,
|
|
||||||
this.title,
|
|
||||||
this.icon,
|
|
||||||
this.color,
|
|
||||||
this.fontSize = 2,
|
|
||||||
this.padding = 13,
|
|
||||||
this.loading = false,
|
|
||||||
this.disabled = false,
|
|
||||||
this.fontColor = Colors.white,
|
|
||||||
this.fontWeight});
|
|
||||||
|
|
||||||
_AppButtonState createState() => _AppButtonState();
|
|
||||||
}
|
|
||||||
|
|
||||||
class _AppButtonState extends State<AppButton> {
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return IgnorePointer(
|
|
||||||
ignoring: widget.loading,
|
|
||||||
child: RawMaterialButton(
|
|
||||||
fillColor: widget.color != null ? widget.color : HexColor("#B8382C"),
|
|
||||||
splashColor: widget.color,
|
|
||||||
child: Padding(
|
|
||||||
padding: EdgeInsets.only(
|
|
||||||
top: widget.padding,
|
|
||||||
bottom: widget.padding,
|
|
||||||
//right: SizeConfig.widthMultiplier * widget.padding,
|
|
||||||
//left: SizeConfig.widthMultiplier * widget.padding
|
|
||||||
),
|
|
||||||
child: Row(
|
|
||||||
mainAxisSize: MainAxisSize.max,
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
children: <Widget>[
|
|
||||||
if (widget.icon != null)
|
|
||||||
Icon(
|
|
||||||
widget.icon,
|
|
||||||
color: Colors.white,
|
|
||||||
),
|
|
||||||
if (widget.icon != null)
|
|
||||||
SizedBox(
|
|
||||||
width: 5.0,
|
|
||||||
),
|
|
||||||
widget.loading
|
|
||||||
? Padding(
|
|
||||||
padding: EdgeInsets.all(2.6),
|
|
||||||
child: SizedBox(
|
|
||||||
height: 19.0,
|
|
||||||
width: 19.0,
|
|
||||||
child: CircularProgressIndicator(
|
|
||||||
backgroundColor: Colors.white,
|
|
||||||
valueColor: AlwaysStoppedAnimation<Color>(
|
|
||||||
Colors.grey[300],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
: AppText(
|
|
||||||
widget.title,
|
|
||||||
color: widget.fontColor,
|
|
||||||
fontSize: SizeConfig.textMultiplier * widget.fontSize,
|
|
||||||
fontWeight: widget.fontWeight,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
onPressed: widget.onPressed,
|
|
||||||
shape: const RoundedRectangleBorder(
|
|
||||||
borderRadius: BorderRadius.all(Radius.circular(6))),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,87 +0,0 @@
|
|||||||
import 'package:doctor_app_flutter/config/size_config.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
|
|
||||||
class BorderedButton extends StatelessWidget {
|
|
||||||
final String text;
|
|
||||||
final Function handler;
|
|
||||||
final Color textColor;
|
|
||||||
final bool hasBorder;
|
|
||||||
final Color borderColor;
|
|
||||||
final Color backgroundColor;
|
|
||||||
final double vPadding;
|
|
||||||
final double hPadding;
|
|
||||||
final double radius;
|
|
||||||
final double lPadding;
|
|
||||||
final double tPadding;
|
|
||||||
final double rPadding;
|
|
||||||
final double bPadding;
|
|
||||||
final double fontSize;
|
|
||||||
final String fontFamily;
|
|
||||||
final Widget icon;
|
|
||||||
final FontWeight fontWeight;
|
|
||||||
|
|
||||||
BorderedButton(
|
|
||||||
this.text, {
|
|
||||||
this.handler,
|
|
||||||
this.textColor,
|
|
||||||
this.hasBorder = false,
|
|
||||||
this.borderColor,
|
|
||||||
this.backgroundColor,
|
|
||||||
this.vPadding = 0,
|
|
||||||
this.hPadding = 0,
|
|
||||||
this.radius = 4.0,
|
|
||||||
this.lPadding = 4.0,
|
|
||||||
this.tPadding = 0.0,
|
|
||||||
this.rPadding = 4.0,
|
|
||||||
this.bPadding = 0.0,
|
|
||||||
this.fontSize = 0,
|
|
||||||
this.fontFamily = 'WorkSans',
|
|
||||||
this.icon,
|
|
||||||
this.fontWeight,
|
|
||||||
});
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return GestureDetector(
|
|
||||||
onTap: () {
|
|
||||||
handler();
|
|
||||||
},
|
|
||||||
child: Container(
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
shape: BoxShape.rectangle,
|
|
||||||
color: backgroundColor ?? Colors.white,
|
|
||||||
borderRadius: BorderRadius.circular(radius),
|
|
||||||
border: Border.fromBorderSide(BorderSide(
|
|
||||||
color: hasBorder ? borderColor : Colors.white,
|
|
||||||
width: 0.8,
|
|
||||||
)),
|
|
||||||
),
|
|
||||||
child: Container(
|
|
||||||
padding: (hPadding > 0 || vPadding > 0)
|
|
||||||
? EdgeInsets.symmetric(
|
|
||||||
vertical: vPadding, horizontal: hPadding)
|
|
||||||
: EdgeInsets.fromLTRB(
|
|
||||||
lPadding, tPadding, rPadding, bPadding),
|
|
||||||
child: Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
children: [
|
|
||||||
icon != null ? icon : Container(),
|
|
||||||
Container(
|
|
||||||
margin: EdgeInsets.symmetric(horizontal: 2),
|
|
||||||
child: Text(
|
|
||||||
text,
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: fontSize == 0 ? SizeConfig.textMultiplier * 1.6 : fontSize,
|
|
||||||
fontWeight: fontWeight != null ? fontWeight : FontWeight.normal,
|
|
||||||
fontFamily: fontFamily,
|
|
||||||
color: textColor ?? Color(0xffc4aa54)),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -0,0 +1,117 @@
|
|||||||
|
import 'package:doctor_app_flutter/config/size_config.dart';
|
||||||
|
import 'package:flutter/foundation.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:hexcolor/hexcolor.dart';
|
||||||
|
|
||||||
|
import '../app_texts_widget.dart';
|
||||||
|
|
||||||
|
class AppButton extends StatefulWidget {
|
||||||
|
final GestureTapCallback onPressed;
|
||||||
|
final String title;
|
||||||
|
final IconData iconData;
|
||||||
|
final Widget icon;
|
||||||
|
final Color color;
|
||||||
|
final double fontSize;
|
||||||
|
final double padding;
|
||||||
|
final Color fontColor;
|
||||||
|
final bool loading;
|
||||||
|
final bool disabled;
|
||||||
|
final FontWeight fontWeight;
|
||||||
|
final bool hasBorder;
|
||||||
|
final Color borderColor;
|
||||||
|
final double radius;
|
||||||
|
final double vPadding;
|
||||||
|
final double hPadding;
|
||||||
|
|
||||||
|
AppButton({
|
||||||
|
@required this.onPressed,
|
||||||
|
this.title,
|
||||||
|
this.iconData,
|
||||||
|
this.icon,
|
||||||
|
this.color,
|
||||||
|
this.fontSize = 2,
|
||||||
|
this.padding = 13,
|
||||||
|
this.loading = false,
|
||||||
|
this.disabled = false,
|
||||||
|
this.fontColor = Colors.white,
|
||||||
|
this.fontWeight = FontWeight.normal,
|
||||||
|
this.vPadding = 0,
|
||||||
|
this.hPadding = 0,
|
||||||
|
this.radius = 8.0,
|
||||||
|
this.hasBorder = false,
|
||||||
|
this.borderColor,
|
||||||
|
});
|
||||||
|
|
||||||
|
_AppButtonState createState() => _AppButtonState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _AppButtonState extends State<AppButton> {
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return IgnorePointer(
|
||||||
|
ignoring: widget.loading,
|
||||||
|
child: RawMaterialButton(
|
||||||
|
fillColor: widget.color != null ? widget.color : HexColor("#B8382C"),
|
||||||
|
splashColor: widget.color,
|
||||||
|
child: Padding(
|
||||||
|
padding: (widget.hPadding > 0 || widget.vPadding > 0)
|
||||||
|
? EdgeInsets.symmetric(
|
||||||
|
vertical: widget.vPadding, horizontal: widget.hPadding)
|
||||||
|
: EdgeInsets.only(
|
||||||
|
top: widget.padding,
|
||||||
|
bottom: widget.padding,
|
||||||
|
//right: SizeConfig.widthMultiplier * widget.padding,
|
||||||
|
//left: SizeConfig.widthMultiplier * widget.padding
|
||||||
|
),
|
||||||
|
child: Row(
|
||||||
|
mainAxisSize: MainAxisSize.max,
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: <Widget>[
|
||||||
|
if (widget.icon != null)
|
||||||
|
Container(width: 25, height: 25, child: widget.icon),
|
||||||
|
if (widget.iconData != null)
|
||||||
|
Icon(
|
||||||
|
widget.iconData,
|
||||||
|
color: Colors.white,
|
||||||
|
),
|
||||||
|
if (widget.icon != null || widget.iconData != null)
|
||||||
|
SizedBox(
|
||||||
|
width: 5.0,
|
||||||
|
),
|
||||||
|
widget.loading
|
||||||
|
? Padding(
|
||||||
|
padding: EdgeInsets.all(2.6),
|
||||||
|
child: SizedBox(
|
||||||
|
height: 19.0,
|
||||||
|
width: 19.0,
|
||||||
|
child: CircularProgressIndicator(
|
||||||
|
backgroundColor: Colors.white,
|
||||||
|
valueColor: AlwaysStoppedAnimation<Color>(
|
||||||
|
Colors.grey[300],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: Container(
|
||||||
|
child: AppText(
|
||||||
|
widget.title,
|
||||||
|
color: widget.fontColor,
|
||||||
|
fontSize: SizeConfig.textMultiplier * widget.fontSize,
|
||||||
|
fontWeight: widget.fontWeight,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
onPressed: widget.onPressed,
|
||||||
|
shape: RoundedRectangleBorder(
|
||||||
|
side: BorderSide(
|
||||||
|
color:
|
||||||
|
widget.hasBorder ? widget.borderColor : widget.color,
|
||||||
|
width: 0.8,
|
||||||
|
),
|
||||||
|
borderRadius: BorderRadius.all(Radius.circular(widget.radius))),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,24 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
import 'app_buttons_widget.dart';
|
||||||
|
|
||||||
|
class ButtonBottomSheet extends StatelessWidget {
|
||||||
|
|
||||||
|
final double height;
|
||||||
|
final String buttonTitle;
|
||||||
|
final Function onPressed;
|
||||||
|
|
||||||
|
ButtonBottomSheet({@required this.height, @required this.buttonTitle, @required this.onPressed});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Container(
|
||||||
|
height: height ?? null,
|
||||||
|
margin: EdgeInsets.symmetric(horizontal: 16, vertical: 16),
|
||||||
|
child: AppButton(
|
||||||
|
title: buttonTitle,
|
||||||
|
onPressed: onPressed,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,10 +1,10 @@
|
|||||||
import 'package:doctor_app_flutter/config/size_config.dart';
|
import 'package:doctor_app_flutter/config/size_config.dart';
|
||||||
import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart';
|
import 'package:doctor_app_flutter/widgets/shared/text_fields/text_field_error.dart';
|
||||||
import 'package:doctor_app_flutter/widgets/shared/user-guid/text_fields/text_field_error.dart';
|
import 'package:doctor_app_flutter/widgets/shared/text_fields/text_fields_utils.dart';
|
||||||
import 'package:doctor_app_flutter/widgets/shared/user-guid/text_fields/text_fields_utils.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import '../../app_texts_widget.dart';
|
|
||||||
|
import '../app_texts_widget.dart';
|
||||||
|
|
||||||
class AppTextFieldCustom extends StatefulWidget {
|
class AppTextFieldCustom extends StatefulWidget {
|
||||||
final double height;
|
final double height;
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue