internal Work List screen 1.0
parent
88b86c66d5
commit
dcabb40811
@ -1,96 +0,0 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:mohem_flutter_app/theme/colors.dart';
|
||||
|
||||
class AppButton extends StatefulWidget {
|
||||
late AppButtonState _state;
|
||||
|
||||
final String? text;
|
||||
final double cornerRadius;
|
||||
final EdgeInsets? margin;
|
||||
final double? height;
|
||||
final double? minWidth;
|
||||
final VoidCallback? onClick;
|
||||
final Color? color;
|
||||
final Color? textColor;
|
||||
final double fontSize;
|
||||
final double elevation;
|
||||
final bool bold;
|
||||
|
||||
AppButton(
|
||||
{this.text,
|
||||
this.onClick,
|
||||
this.cornerRadius = 10,
|
||||
this.margin,
|
||||
this.height,
|
||||
this.color,
|
||||
this.textColor,
|
||||
this.minWidth,
|
||||
this.fontSize = 15,
|
||||
this.bold = true,
|
||||
this.elevation = 5});
|
||||
|
||||
@override
|
||||
State<StatefulWidget> createState() => _state = AppButtonState();
|
||||
|
||||
enable() {
|
||||
_state.setState(() {
|
||||
_state.enable = true;
|
||||
});
|
||||
}
|
||||
|
||||
disable() {
|
||||
_state.setState(() {
|
||||
_state.enable = false;
|
||||
});
|
||||
}
|
||||
|
||||
Color borderColor = Colors.transparent;
|
||||
double borderWidth = 0;
|
||||
BorderStyle borderStyle = BorderStyle.solid;
|
||||
|
||||
AppButton border(Color color, double width, {BorderStyle? style}) {
|
||||
borderColor = color;
|
||||
borderStyle = style ?? BorderStyle.solid;
|
||||
borderWidth = width;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
class AppButtonState extends State<AppButton> {
|
||||
bool enable = true;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
var disableColor =
|
||||
widget.color == null ? accentColor : widget.color!.withOpacity(0.2);
|
||||
|
||||
// if(widget.bold) text.bold();
|
||||
// if(widget.fontSize != null) text.customSize(widget.fontSize);
|
||||
|
||||
return Container(
|
||||
height: widget.height ?? 60,
|
||||
margin: widget.margin,
|
||||
child: MaterialButton(
|
||||
minWidth: widget.minWidth ?? 10,
|
||||
elevation: widget.elevation,
|
||||
onPressed: widget.onClick,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(widget.cornerRadius),
|
||||
side: BorderSide(
|
||||
style: widget.borderStyle,
|
||||
color: widget.borderColor,
|
||||
width: widget.borderWidth)),
|
||||
disabledColor: disableColor,
|
||||
color: widget.color ?? accentColor,
|
||||
child: Text(
|
||||
widget.text ?? "",
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue