You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
84 lines
2.3 KiB
Dart
84 lines
2.3 KiB
Dart
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 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.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(
|
|
child: Row(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
icon != null ? icon : Container(),
|
|
Container(
|
|
padding: (hPadding > 0 || vPadding > 0)
|
|
? EdgeInsets.symmetric(
|
|
vertical: vPadding, horizontal: hPadding)
|
|
: EdgeInsets.fromLTRB(
|
|
lPadding, tPadding, rPadding, bPadding),
|
|
child: Text(
|
|
text,
|
|
textAlign: TextAlign.center,
|
|
style: TextStyle(
|
|
fontSize: fontSize == 0 ? SizeConfig.textMultiplier * 1.6 : fontSize,
|
|
fontWeight: fontWeight != null ? fontWeight : FontWeight.normal,
|
|
color: textColor ?? Color(0xffc4aa54)),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|