feat : button , outlined button
fab button , fab outlined button , input , pagination widget's
This commit is contained in:
101
lib/presentation/widget/buttons/outline_elevated.dart
Normal file
101
lib/presentation/widget/buttons/outline_elevated.dart
Normal file
@@ -0,0 +1,101 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:rasadyar_app/presentation/common/app_color.dart';
|
||||
import 'package:rasadyar_app/presentation/common/app_fonts.dart';
|
||||
import 'package:rasadyar_app/presentation/utils/color_utils.dart';
|
||||
|
||||
class ROutlinedElevated extends StatefulWidget {
|
||||
ROutlinedElevated({
|
||||
super.key,
|
||||
required this.text,
|
||||
required this.onPressed,
|
||||
this.foregroundColor,
|
||||
this.backgroundColor,
|
||||
this.borderColor,
|
||||
this.disabledBackgroundColor,
|
||||
this.pressedBackgroundColor,
|
||||
this.radius,
|
||||
this.textStyle,
|
||||
this.width = 150.0,
|
||||
this.height = 56.0,
|
||||
});
|
||||
|
||||
final String text;
|
||||
final VoidCallback? onPressed;
|
||||
final double width;
|
||||
final double height;
|
||||
Color? foregroundColor;
|
||||
Color? backgroundColor;
|
||||
|
||||
Color? borderColor;
|
||||
|
||||
Color? disabledBackgroundColor;
|
||||
Color? pressedBackgroundColor;
|
||||
double? radius;
|
||||
TextStyle? textStyle;
|
||||
|
||||
@override
|
||||
State<ROutlinedElevated> createState() => _ROutlinedElevatedState();
|
||||
}
|
||||
|
||||
class _ROutlinedElevatedState extends State<ROutlinedElevated> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return OutlinedButton(
|
||||
onPressed: widget.onPressed,
|
||||
style: ButtonStyle(
|
||||
side: WidgetStateProperty.resolveWith<BorderSide?>((states) {
|
||||
if (states.contains(WidgetState.pressed)) {
|
||||
return BorderSide(
|
||||
color: widget.borderColor ?? AppColor.blueNormal,
|
||||
width: 2,
|
||||
);
|
||||
} else if (states.contains(WidgetState.disabled)) {
|
||||
return BorderSide(
|
||||
color: widget.borderColor ?? AppColor.blueNormal.withAlpha(38),
|
||||
width: 2,
|
||||
);
|
||||
}
|
||||
return BorderSide(
|
||||
color: widget.borderColor ?? AppColor.blueNormal,
|
||||
width: 2,
|
||||
);
|
||||
}),
|
||||
backgroundColor: WidgetStateProperty.resolveWith<Color?>((states) {
|
||||
if (states.contains(WidgetState.pressed)) {
|
||||
if (widget.pressedBackgroundColor != null) {
|
||||
return widget.pressedBackgroundColor;
|
||||
}
|
||||
return widget.backgroundColor?.pressedColor ?? AppColor.blueNormal;
|
||||
} else if (states.contains(WidgetState.hovered)) {
|
||||
return widget.backgroundColor?.hoverColor ??
|
||||
AppColor.blueNormal.hoverColor;
|
||||
} else if (states.contains(WidgetState.disabled)) {
|
||||
return widget.backgroundColor?.disabledColor ?? Colors.transparent;
|
||||
}
|
||||
return widget.backgroundColor;
|
||||
}),
|
||||
foregroundColor: WidgetStateProperty.resolveWith<Color?>((states) {
|
||||
if (states.contains(WidgetState.pressed)) {
|
||||
return Colors.white;
|
||||
} else if (states.contains(WidgetState.disabled)) {
|
||||
return AppColor.blueNormal.withAlpha(38);
|
||||
}
|
||||
return AppColor.blueNormal;
|
||||
}),
|
||||
|
||||
shape: WidgetStatePropertyAll(
|
||||
RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(widget.radius ?? 8),
|
||||
),
|
||||
),
|
||||
fixedSize: WidgetStatePropertyAll(Size(widget.width, widget.height)),
|
||||
padding: WidgetStatePropertyAll(EdgeInsets.zero),
|
||||
textStyle: WidgetStatePropertyAll(
|
||||
widget.textStyle ??
|
||||
AppFonts.yekan24Regular.copyWith(color: AppColor.blueNormal),
|
||||
),
|
||||
),
|
||||
child: Text(widget.text),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user