feat : button , outlined button
fab button , fab outlined button , input , pagination widget's
This commit is contained in:
58
lib/presentation/widget/buttons/elevated.dart
Normal file
58
lib/presentation/widget/buttons/elevated.dart
Normal file
@@ -0,0 +1,58 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:rasadyar_app/presentation/common/app_color.dart';
|
||||
import 'package:rasadyar_app/presentation/common/app_fonts.dart';
|
||||
|
||||
class RElevated extends StatefulWidget {
|
||||
RElevated({
|
||||
super.key,
|
||||
required this.text,
|
||||
required this.onPressed,
|
||||
foregroundColor,
|
||||
backgroundColor,
|
||||
disabledBackgroundColor,
|
||||
disabledForegroundColor,
|
||||
radius,
|
||||
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? disabledForegroundColor;
|
||||
Color? disabledBackgroundColor;
|
||||
double? radius;
|
||||
TextStyle? textStyle;
|
||||
|
||||
@override
|
||||
State<RElevated> createState() => _RElevatedState();
|
||||
}
|
||||
|
||||
class _RElevatedState extends State<RElevated> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ElevatedButton(
|
||||
onPressed: () {
|
||||
setState(() {});
|
||||
},
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: widget.backgroundColor ?? AppColor.blueNormal,
|
||||
foregroundColor: widget.foregroundColor ?? Colors.white,
|
||||
disabledBackgroundColor:
|
||||
widget.disabledBackgroundColor ?? AppColor.blueNormal.withAlpha(38),
|
||||
disabledForegroundColor: widget.disabledForegroundColor ?? Colors.white,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(widget.radius ?? 8),
|
||||
),
|
||||
fixedSize: Size(widget.width, widget.height),
|
||||
padding: EdgeInsets.zero,
|
||||
textStyle: widget.textStyle ?? AppFonts.yekan24Regular,
|
||||
),
|
||||
child: Text(widget.text),
|
||||
);
|
||||
}
|
||||
}
|
||||
232
lib/presentation/widget/buttons/fab.dart
Normal file
232
lib/presentation/widget/buttons/fab.dart
Normal file
@@ -0,0 +1,232 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:rasadyar_app/presentation/common/app_color.dart';
|
||||
import 'package:rasadyar_app/presentation/common/assets.dart';
|
||||
import 'package:rasadyar_app/presentation/utils/color_utils.dart';
|
||||
import 'package:rasadyar_app/presentation/widget/vec_widget.dart';
|
||||
|
||||
class RFab extends StatefulWidget {
|
||||
|
||||
|
||||
final VoidCallback? onPressed;
|
||||
Color? foregroundColor;
|
||||
Color? backgroundColor;
|
||||
Color? disabledForegroundColor;
|
||||
Color? disabledBackgroundColor;
|
||||
double? radius;
|
||||
ShapeBorder? shapeBorder;
|
||||
Widget? icon;
|
||||
|
||||
@override
|
||||
State<RFab> createState() => _RFabState();
|
||||
|
||||
//region Add
|
||||
RFab.smallAdd({required VoidCallback? onPressed, Key? key})
|
||||
: this.small(
|
||||
onPressed: onPressed,
|
||||
icon: vecWidget(Assets.vecAddSvg),
|
||||
backgroundColor: AppColor.greenNormal,
|
||||
key: key,
|
||||
);
|
||||
|
||||
RFab.add({required VoidCallback? onPressed, Key? key})
|
||||
: this(
|
||||
onPressed: onPressed,
|
||||
icon: vecWidget(Assets.vecAddSvg),
|
||||
backgroundColor: AppColor.greenNormal,
|
||||
key: key,
|
||||
);
|
||||
|
||||
//endregion
|
||||
|
||||
//region Edit
|
||||
RFab.smallEdit({required VoidCallback? onPressed, Key? key})
|
||||
: this.small(
|
||||
onPressed: onPressed,
|
||||
icon: vecWidget(Assets.vecEditSvg),
|
||||
backgroundColor: AppColor.blueNormal,
|
||||
key: key,
|
||||
);
|
||||
|
||||
RFab.edit({required VoidCallback? onPressed, Key? key})
|
||||
: this(
|
||||
onPressed: onPressed,
|
||||
icon: vecWidget(Assets.vecEditSvg),
|
||||
backgroundColor: AppColor.blueNormal,
|
||||
key: key,
|
||||
);
|
||||
|
||||
//endregion
|
||||
|
||||
//region delete
|
||||
RFab.smallDelete({required VoidCallback? onPressed, Key? key})
|
||||
: this.small(
|
||||
onPressed: onPressed,
|
||||
icon: vecWidget(Assets.vecTrashSvg),
|
||||
backgroundColor: AppColor.redNormal,
|
||||
key: key,
|
||||
);
|
||||
|
||||
RFab.delete({required VoidCallback? onPressed, Key? key})
|
||||
: this(
|
||||
onPressed: onPressed,
|
||||
icon: vecWidget(Assets.vecTrashSvg),
|
||||
backgroundColor: AppColor.redNormal,
|
||||
key: key,
|
||||
);
|
||||
|
||||
//endregion
|
||||
|
||||
//region action
|
||||
RFab.smallAction({required VoidCallback? onPressed, Key? key})
|
||||
: this.small(
|
||||
onPressed: onPressed,
|
||||
icon: vecWidget(Assets.vecScanSvg),
|
||||
backgroundColor: AppColor.blueNormal,
|
||||
key: key,
|
||||
);
|
||||
|
||||
RFab.action({required VoidCallback? onPressed, Key? key})
|
||||
: this(
|
||||
onPressed: onPressed,
|
||||
icon: vecWidget(Assets.vecScanSvg),
|
||||
backgroundColor: AppColor.blueNormal,
|
||||
key: key,
|
||||
);
|
||||
|
||||
//endregion
|
||||
|
||||
//region filter
|
||||
RFab.smallFilter({required VoidCallback? onPressed, Key? key})
|
||||
: this.small(
|
||||
onPressed: onPressed,
|
||||
icon: vecWidget(Assets.vecFilterSvg),
|
||||
backgroundColor: AppColor.blueNormal,
|
||||
key: key,
|
||||
);
|
||||
|
||||
RFab.filter({required VoidCallback? onPressed, Key? key})
|
||||
: this(
|
||||
onPressed: onPressed,
|
||||
icon: vecWidget(Assets.vecFilterSvg),
|
||||
backgroundColor: AppColor.blueNormal,
|
||||
key: key,
|
||||
);
|
||||
|
||||
//endregion
|
||||
|
||||
//region download
|
||||
RFab.smallDownload({required VoidCallback? onPressed, Key? key})
|
||||
: this.small(
|
||||
onPressed: onPressed,
|
||||
icon: vecWidget(Assets.vecDownloadSvg),
|
||||
backgroundColor: AppColor.blueNormal,
|
||||
key: key,
|
||||
);
|
||||
|
||||
RFab.download({required VoidCallback? onPressed, Key? key})
|
||||
: this(
|
||||
onPressed: onPressed,
|
||||
icon: vecWidget(Assets.vecDownloadSvg),
|
||||
backgroundColor: AppColor.blueNormal,
|
||||
key: key,
|
||||
);
|
||||
|
||||
//endregion
|
||||
|
||||
//region Excel
|
||||
RFab.smallExcel({required VoidCallback? onPressed, Key? key})
|
||||
: this.small(
|
||||
onPressed: onPressed,
|
||||
icon: vecWidget(Assets.vecDownloadSvg),
|
||||
backgroundColor: AppColor.greenDark,
|
||||
key: key,
|
||||
);
|
||||
|
||||
RFab.excel({required VoidCallback? onPressed, Key? key})
|
||||
: this(
|
||||
onPressed: onPressed,
|
||||
icon: vecWidget(Assets.vecDownloadSvg),
|
||||
backgroundColor: AppColor.greenDark,
|
||||
key: key,
|
||||
);
|
||||
|
||||
//endregion
|
||||
|
||||
//region Back
|
||||
RFab.smallBack({required VoidCallback? onPressed, Key? key})
|
||||
: this.small(
|
||||
onPressed: onPressed,
|
||||
icon: vecWidget(Assets.vecArrowLeftSvg),
|
||||
backgroundColor: AppColor.blueNormal,
|
||||
key: key,
|
||||
);
|
||||
|
||||
RFab.back({required VoidCallback? onPressed, Key? key})
|
||||
: this(
|
||||
onPressed: onPressed,
|
||||
icon: vecWidget(Assets.vecArrowLeftSvg),
|
||||
backgroundColor: AppColor.blueNormal,
|
||||
key: key,
|
||||
);
|
||||
|
||||
//endregion
|
||||
|
||||
//region General
|
||||
RFab.small({
|
||||
required this.onPressed,
|
||||
required this.icon,
|
||||
required this.backgroundColor,
|
||||
super.key,
|
||||
}) : radius = 40.0,
|
||||
foregroundColor = Colors.white;
|
||||
|
||||
RFab({
|
||||
required this.onPressed,
|
||||
required this.icon,
|
||||
required this.backgroundColor,
|
||||
super.key,
|
||||
}) : radius = 56.0,
|
||||
foregroundColor = Colors.white;
|
||||
|
||||
//endregion
|
||||
}
|
||||
|
||||
class _RFabState extends State<RFab> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ElevatedButton(
|
||||
onPressed: widget.onPressed,
|
||||
style: ButtonStyle(
|
||||
side: WidgetStateProperty.all(BorderSide.none),
|
||||
backgroundColor: WidgetStateProperty.resolveWith<Color?>((states) {
|
||||
if (states.contains(WidgetState.pressed)) {
|
||||
return widget.backgroundColor?.pressedColor ??
|
||||
AppColor.blueNormalActive;
|
||||
} else if (states.contains(WidgetState.hovered)) {
|
||||
return widget.backgroundColor?.hoverColor ??
|
||||
AppColor.blueNormalHover;
|
||||
} else if (states.contains(WidgetState.disabled)) {
|
||||
return widget.backgroundColor?.disabledColor ??
|
||||
AppColor.blueNormal.disabledColor;
|
||||
}
|
||||
return widget.backgroundColor ?? AppColor.blueNormal;
|
||||
}),
|
||||
foregroundColor: WidgetStateProperty.resolveWith<Color?>((states) {
|
||||
if (states.contains(WidgetState.disabled)) {
|
||||
return widget.foregroundColor?.disabledColor;
|
||||
}
|
||||
return widget.foregroundColor;
|
||||
}),
|
||||
|
||||
shape: WidgetStatePropertyAll(
|
||||
CircleBorder(side: BorderSide(width: 1, color: Colors.transparent)),
|
||||
),
|
||||
fixedSize: WidgetStatePropertyAll(
|
||||
Size(widget.radius ?? 56, widget.radius ?? 56),
|
||||
),
|
||||
padding: WidgetStatePropertyAll(EdgeInsets.zero),
|
||||
),
|
||||
child: widget.icon,
|
||||
);
|
||||
}
|
||||
}
|
||||
605
lib/presentation/widget/buttons/fab_outlined.dart
Normal file
605
lib/presentation/widget/buttons/fab_outlined.dart
Normal file
@@ -0,0 +1,605 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:rasadyar_app/presentation/common/app_color.dart';
|
||||
import 'package:rasadyar_app/presentation/common/assets.dart';
|
||||
import 'package:rasadyar_app/presentation/utils/color_utils.dart';
|
||||
import 'package:rasadyar_app/presentation/widget/vec_widget.dart';
|
||||
|
||||
class RFabOutlined extends StatefulWidget {
|
||||
final Widget icon;
|
||||
VoidCallback? onPressed;
|
||||
final Color backgroundColor;
|
||||
final Color? borderColor;
|
||||
final double? radius;
|
||||
OutlinedBorder? shapeBorder;
|
||||
|
||||
@override
|
||||
State<RFabOutlined> createState() => _RFabOutlinedState();
|
||||
|
||||
//region General
|
||||
RFabOutlined({
|
||||
required this.icon,
|
||||
required this.onPressed,
|
||||
required this.backgroundColor,
|
||||
required this.borderColor,
|
||||
this.radius = 56.0,
|
||||
super.key,
|
||||
}) : shapeBorder = CircleBorder(
|
||||
side: BorderSide(color: borderColor ?? Colors.transparent),
|
||||
);
|
||||
|
||||
RFabOutlined.noBorder({
|
||||
required this.icon,
|
||||
required this.onPressed,
|
||||
required this.backgroundColor,
|
||||
super.key,
|
||||
}) : borderColor = Colors.transparent,
|
||||
radius = 56.0,
|
||||
shapeBorder = CircleBorder(
|
||||
side: BorderSide(color: Colors.transparent, width: 1),
|
||||
);
|
||||
|
||||
RFabOutlined.small({
|
||||
required this.icon,
|
||||
required this.onPressed,
|
||||
required this.backgroundColor,
|
||||
required this.borderColor,
|
||||
super.key,
|
||||
}) : radius = 40.0,
|
||||
shapeBorder = CircleBorder(
|
||||
side: BorderSide(color: borderColor ?? Colors.transparent, width: 1),
|
||||
);
|
||||
|
||||
RFabOutlined.smallNoBorder({
|
||||
required this.icon,
|
||||
required this.onPressed,
|
||||
required this.backgroundColor,
|
||||
super.key,
|
||||
}) : borderColor = Colors.transparent,
|
||||
radius = 40.0,
|
||||
shapeBorder = CircleBorder(
|
||||
side: BorderSide(color: Colors.transparent, width: 1),
|
||||
);
|
||||
|
||||
//endregion
|
||||
|
||||
//region Add
|
||||
RFabOutlined.smallAdd({VoidCallback? onPressed, Key? key})
|
||||
: this.small(
|
||||
key: key,
|
||||
onPressed: onPressed,
|
||||
backgroundColor: AppColor.greenNormal,
|
||||
borderColor: AppColor.greenNormal,
|
||||
icon: vecWidget2(
|
||||
Assets.vecAddSvg,
|
||||
|
||||
color: AppColor.greenNormal,
|
||||
),
|
||||
);
|
||||
|
||||
RFabOutlined.smallAddNoBorder({VoidCallback? onPressed, Key? key})
|
||||
: this.smallNoBorder(
|
||||
key: key,
|
||||
onPressed: onPressed,
|
||||
backgroundColor: AppColor.greenNormal,
|
||||
icon: vecWidget(
|
||||
Assets.vecAddSvg,
|
||||
color:
|
||||
onPressed != null
|
||||
? AppColor.greenNormal
|
||||
: AppColor.greenNormal.disabledColor,
|
||||
),
|
||||
);
|
||||
|
||||
RFabOutlined.add({VoidCallback? onPressed, Key? key})
|
||||
: this(
|
||||
key: key,
|
||||
onPressed: onPressed,
|
||||
backgroundColor: AppColor.greenNormal,
|
||||
borderColor: AppColor.greenNormal,
|
||||
icon: vecWidget(
|
||||
Assets.vecAddSvg,
|
||||
color:
|
||||
onPressed != null
|
||||
? AppColor.greenNormal
|
||||
: AppColor.greenNormal.disabledColor,
|
||||
),
|
||||
);
|
||||
|
||||
RFabOutlined.addNoBorder({VoidCallback? onPressed, Key? key})
|
||||
: this.noBorder(
|
||||
key: key,
|
||||
onPressed: onPressed,
|
||||
backgroundColor: AppColor.greenNormal,
|
||||
icon: vecWidget(
|
||||
Assets.vecAddSvg,
|
||||
color:
|
||||
onPressed != null
|
||||
? AppColor.greenNormal
|
||||
: AppColor.greenNormal.disabledColor,
|
||||
),
|
||||
);
|
||||
|
||||
//endregion
|
||||
|
||||
//region Edit
|
||||
RFabOutlined.smallEdit({VoidCallback? onPressed, Key? key})
|
||||
: this.small(
|
||||
key: key,
|
||||
onPressed: onPressed,
|
||||
backgroundColor: AppColor.blueNormal,
|
||||
borderColor: AppColor.blueNormal,
|
||||
icon: vecWidget(
|
||||
Assets.vecEditSvg,
|
||||
color:
|
||||
onPressed != null
|
||||
? AppColor.blueNormal
|
||||
: AppColor.blueNormal.disabledColor,
|
||||
),
|
||||
);
|
||||
|
||||
RFabOutlined.smallEditNoBorder({VoidCallback? onPressed, Key? key})
|
||||
: this.smallNoBorder(
|
||||
key: key,
|
||||
onPressed: onPressed,
|
||||
backgroundColor: AppColor.blueNormal,
|
||||
icon: vecWidget(
|
||||
Assets.vecEditSvg,
|
||||
color:
|
||||
onPressed != null
|
||||
? AppColor.blueNormal
|
||||
: AppColor.blueNormal.disabledColor,
|
||||
),
|
||||
);
|
||||
|
||||
RFabOutlined.edit({VoidCallback? onPressed, Key? key})
|
||||
: this(
|
||||
key: key,
|
||||
onPressed: onPressed,
|
||||
backgroundColor: AppColor.blueNormal,
|
||||
borderColor: AppColor.blueNormal,
|
||||
icon: vecWidget(
|
||||
Assets.vecEditSvg,
|
||||
color:
|
||||
onPressed != null
|
||||
? AppColor.blueNormal
|
||||
: AppColor.blueNormal.disabledColor,
|
||||
),
|
||||
);
|
||||
|
||||
RFabOutlined.editNoBorder({VoidCallback? onPressed, Key? key})
|
||||
: this.noBorder(
|
||||
key: key,
|
||||
onPressed: onPressed,
|
||||
backgroundColor: AppColor.blueNormal,
|
||||
icon: vecWidget(
|
||||
Assets.vecEditSvg,
|
||||
color:
|
||||
onPressed != null
|
||||
? AppColor.blueNormal
|
||||
: AppColor.blueNormal.disabledColor,
|
||||
),
|
||||
);
|
||||
|
||||
//endregion
|
||||
|
||||
//region Delete
|
||||
RFabOutlined.smallDelete({VoidCallback? onPressed, Key? key})
|
||||
: this.small(
|
||||
key: key,
|
||||
onPressed: onPressed,
|
||||
backgroundColor: AppColor.redNormal,
|
||||
borderColor: AppColor.redNormal,
|
||||
icon: vecWidget(
|
||||
Assets.vecTrashSvg,
|
||||
color:
|
||||
onPressed != null
|
||||
? AppColor.redNormal
|
||||
: AppColor.redNormal.disabledColor,
|
||||
),
|
||||
);
|
||||
|
||||
RFabOutlined.smallDeleteNoBorder({VoidCallback? onPressed, Key? key})
|
||||
: this.smallNoBorder(
|
||||
key: key,
|
||||
onPressed: onPressed,
|
||||
backgroundColor: AppColor.redNormal,
|
||||
icon: vecWidget(
|
||||
Assets.vecTrashSvg,
|
||||
color:
|
||||
onPressed != null
|
||||
? AppColor.redNormal
|
||||
: AppColor.redNormal.disabledColor,
|
||||
),
|
||||
);
|
||||
|
||||
RFabOutlined.delete({VoidCallback? onPressed, Key? key})
|
||||
: this(
|
||||
key: key,
|
||||
onPressed: onPressed,
|
||||
backgroundColor: AppColor.redNormal,
|
||||
borderColor: AppColor.redNormal,
|
||||
icon: vecWidget(
|
||||
Assets.vecTrashSvg,
|
||||
color:
|
||||
onPressed != null
|
||||
? AppColor.redNormal
|
||||
: AppColor.redNormal.disabledColor,
|
||||
),
|
||||
);
|
||||
|
||||
RFabOutlined.deleteNoBorder({VoidCallback? onPressed, Key? key})
|
||||
: this.noBorder(
|
||||
key: key,
|
||||
onPressed: onPressed,
|
||||
backgroundColor: AppColor.redNormal,
|
||||
icon: vecWidget(
|
||||
Assets.vecTrashSvg,
|
||||
color:
|
||||
onPressed != null
|
||||
? AppColor.redNormal
|
||||
: AppColor.redNormal.disabledColor,
|
||||
),
|
||||
);
|
||||
|
||||
//endregion
|
||||
|
||||
//region Action
|
||||
RFabOutlined.smallAction({VoidCallback? onPressed, Key? key})
|
||||
: this.small(
|
||||
key: key,
|
||||
onPressed: onPressed,
|
||||
backgroundColor: AppColor.blueNormal,
|
||||
borderColor: AppColor.blueNormal,
|
||||
icon: vecWidget(
|
||||
Assets.vecScanSvg,
|
||||
color:
|
||||
onPressed != null
|
||||
? AppColor.blueNormal
|
||||
: AppColor.blueNormal.disabledColor,
|
||||
),
|
||||
);
|
||||
|
||||
RFabOutlined.smallActionNoBorder({VoidCallback? onPressed, Key? key})
|
||||
: this.smallNoBorder(
|
||||
key: key,
|
||||
onPressed: onPressed,
|
||||
backgroundColor: AppColor.blueNormal,
|
||||
icon: vecWidget(
|
||||
Assets.vecScanSvg,
|
||||
color:
|
||||
onPressed != null
|
||||
? AppColor.blueNormal
|
||||
: AppColor.blueNormal.disabledColor,
|
||||
),
|
||||
);
|
||||
|
||||
RFabOutlined.action({VoidCallback? onPressed, Key? key})
|
||||
: this(
|
||||
key: key,
|
||||
onPressed: onPressed,
|
||||
backgroundColor: AppColor.blueNormal,
|
||||
borderColor: AppColor.blueNormal,
|
||||
icon: vecWidget(
|
||||
Assets.vecScanSvg,
|
||||
color:
|
||||
onPressed != null
|
||||
? AppColor.blueNormal
|
||||
: AppColor.blueNormal.disabledColor,
|
||||
),
|
||||
);
|
||||
|
||||
RFabOutlined.actionNoBorder({VoidCallback? onPressed, Key? key})
|
||||
: this.noBorder(
|
||||
key: key,
|
||||
onPressed: onPressed,
|
||||
backgroundColor: AppColor.blueNormal,
|
||||
icon: vecWidget(
|
||||
Assets.vecScanSvg,
|
||||
color:
|
||||
onPressed != null
|
||||
? AppColor.blueNormal
|
||||
: AppColor.blueNormal.disabledColor,
|
||||
),
|
||||
);
|
||||
|
||||
//endregion
|
||||
|
||||
//region Filter
|
||||
RFabOutlined.smallFilter({VoidCallback? onPressed, Key? key})
|
||||
: this.small(
|
||||
key: key,
|
||||
onPressed: onPressed,
|
||||
backgroundColor: AppColor.blueNormal,
|
||||
borderColor: AppColor.blueNormal,
|
||||
icon: vecWidget(
|
||||
Assets.vecFilterSvg,
|
||||
color:
|
||||
onPressed != null
|
||||
? AppColor.blueNormal
|
||||
: AppColor.blueNormal.disabledColor,
|
||||
),
|
||||
);
|
||||
|
||||
RFabOutlined.smallFilterNoBorder({VoidCallback? onPressed, Key? key})
|
||||
: this.smallNoBorder(
|
||||
key: key,
|
||||
onPressed: onPressed,
|
||||
backgroundColor: AppColor.blueNormal,
|
||||
icon: vecWidget(
|
||||
Assets.vecFilterSvg,
|
||||
color:
|
||||
onPressed != null
|
||||
? AppColor.blueNormal
|
||||
: AppColor.blueNormal.disabledColor,
|
||||
),
|
||||
);
|
||||
|
||||
RFabOutlined.filter({VoidCallback? onPressed, Key? key})
|
||||
: this(
|
||||
key: key,
|
||||
onPressed: onPressed,
|
||||
backgroundColor: AppColor.blueNormal,
|
||||
borderColor: AppColor.blueNormal,
|
||||
icon: vecWidget(
|
||||
Assets.vecFilterSvg,
|
||||
color:
|
||||
onPressed != null
|
||||
? AppColor.blueNormal
|
||||
: AppColor.blueNormal.disabledColor,
|
||||
),
|
||||
);
|
||||
|
||||
RFabOutlined.filterNoBorder({VoidCallback? onPressed, Key? key})
|
||||
: this.noBorder(
|
||||
key: key,
|
||||
onPressed: onPressed,
|
||||
backgroundColor: AppColor.blueNormal,
|
||||
icon: vecWidget(
|
||||
Assets.vecFilterSvg,
|
||||
color:
|
||||
onPressed != null
|
||||
? AppColor.blueNormal
|
||||
: AppColor.blueNormal.disabledColor,
|
||||
),
|
||||
);
|
||||
|
||||
//endregion
|
||||
|
||||
//region Download
|
||||
RFabOutlined.smallDownload({VoidCallback? onPressed, Key? key})
|
||||
: this.small(
|
||||
key: key,
|
||||
onPressed: onPressed,
|
||||
backgroundColor: AppColor.blueNormal,
|
||||
borderColor: AppColor.blueNormal,
|
||||
icon: vecWidget(
|
||||
Assets.vecDownloadSvg,
|
||||
color:
|
||||
onPressed != null
|
||||
? AppColor.greenDark
|
||||
: AppColor.greenDark.disabledColor,
|
||||
),
|
||||
);
|
||||
|
||||
RFabOutlined.smallDownloadNoBorder({VoidCallback? onPressed, Key? key})
|
||||
: this.smallNoBorder(
|
||||
key: key,
|
||||
onPressed: onPressed,
|
||||
backgroundColor: AppColor.blueNormal,
|
||||
icon: vecWidget(
|
||||
Assets.vecDownloadSvg,
|
||||
color:
|
||||
onPressed != null
|
||||
? AppColor.greenDark
|
||||
: AppColor.greenDark.disabledColor,
|
||||
),
|
||||
);
|
||||
|
||||
RFabOutlined.download({VoidCallback? onPressed, Key? key})
|
||||
: this(
|
||||
key: key,
|
||||
onPressed: onPressed,
|
||||
backgroundColor: AppColor.blueNormal,
|
||||
borderColor: AppColor.blueNormal,
|
||||
icon: vecWidget(
|
||||
Assets.vecDownloadSvg,
|
||||
color:
|
||||
onPressed != null
|
||||
? AppColor.greenDark
|
||||
: AppColor.greenDark.disabledColor,
|
||||
),
|
||||
);
|
||||
|
||||
RFabOutlined.downloadNoBorder({VoidCallback? onPressed, Key? key})
|
||||
: this.noBorder(
|
||||
key: key,
|
||||
onPressed: onPressed,
|
||||
backgroundColor: AppColor.blueNormal,
|
||||
icon: vecWidget(
|
||||
Assets.vecDownloadSvg,
|
||||
color:
|
||||
onPressed != null
|
||||
? AppColor.greenDark
|
||||
: AppColor.greenDark.disabledColor,
|
||||
),
|
||||
);
|
||||
|
||||
//endregion
|
||||
|
||||
//region Excel
|
||||
RFabOutlined.smallExcel({VoidCallback? onPressed, Key? key})
|
||||
: this.small(
|
||||
key: key,
|
||||
onPressed: onPressed,
|
||||
backgroundColor: AppColor.greenDark,
|
||||
borderColor: AppColor.greenDark,
|
||||
icon: vecWidget(
|
||||
Assets.vecDownloadSvg,
|
||||
color:
|
||||
onPressed != null
|
||||
? AppColor.greenDark
|
||||
: AppColor.greenDark.disabledColor,
|
||||
),
|
||||
);
|
||||
|
||||
RFabOutlined.smallExcelNoBorder({VoidCallback? onPressed, Key? key})
|
||||
: this.noBorder(
|
||||
key: key,
|
||||
onPressed: onPressed,
|
||||
backgroundColor: AppColor.greenDark,
|
||||
icon: vecWidget(
|
||||
Assets.vecDownloadSvg,
|
||||
color:
|
||||
onPressed != null
|
||||
? AppColor.greenDark
|
||||
: AppColor.greenDark.disabledColor,
|
||||
),
|
||||
);
|
||||
|
||||
RFabOutlined.excel({VoidCallback? onPressed, Key? key})
|
||||
: this(
|
||||
key: key,
|
||||
onPressed: onPressed,
|
||||
backgroundColor: AppColor.greenDark,
|
||||
borderColor: AppColor.greenDark,
|
||||
icon: vecWidget(
|
||||
Assets.vecDownloadSvg,
|
||||
color:
|
||||
onPressed != null
|
||||
? AppColor.greenDark
|
||||
: AppColor.greenDark.disabledColor,
|
||||
),
|
||||
);
|
||||
|
||||
RFabOutlined.excelNoBorder({VoidCallback? onPressed, Key? key})
|
||||
: this.noBorder(
|
||||
key: key,
|
||||
onPressed: onPressed,
|
||||
backgroundColor: AppColor.greenDark,
|
||||
icon: vecWidget(
|
||||
Assets.vecDownloadSvg,
|
||||
color:
|
||||
onPressed != null
|
||||
? AppColor.greenDark
|
||||
: AppColor.greenDark.disabledColor,
|
||||
),
|
||||
);
|
||||
|
||||
//endregion
|
||||
|
||||
//region Back
|
||||
RFabOutlined.smallBack({VoidCallback? onPressed, Key? key})
|
||||
: this.small(
|
||||
key: key,
|
||||
onPressed: onPressed,
|
||||
backgroundColor: AppColor.blueNormal,
|
||||
borderColor: AppColor.blueNormal,
|
||||
icon: vecWidget(
|
||||
Assets.vecArrowLeftSvg,
|
||||
color:
|
||||
onPressed != null
|
||||
? AppColor.blueNormal
|
||||
: AppColor.blueNormal.disabledColor,
|
||||
),
|
||||
);
|
||||
|
||||
RFabOutlined.smallBackNoBorder({VoidCallback? onPressed, Key? key})
|
||||
: this.smallNoBorder(
|
||||
key: key,
|
||||
onPressed: onPressed,
|
||||
backgroundColor: AppColor.blueNormal,
|
||||
icon: vecWidget(
|
||||
Assets.vecArrowLeftSvg,
|
||||
color:
|
||||
onPressed != null
|
||||
? AppColor.blueNormal
|
||||
: AppColor.blueNormal.disabledColor,
|
||||
),
|
||||
);
|
||||
|
||||
RFabOutlined.back({VoidCallback? onPressed, Key? key})
|
||||
: this(
|
||||
key: key,
|
||||
onPressed: onPressed,
|
||||
backgroundColor: AppColor.blueNormal,
|
||||
borderColor: AppColor.blueNormal,
|
||||
icon: vecWidget(
|
||||
Assets.vecArrowLeftSvg,
|
||||
color:
|
||||
onPressed != null
|
||||
? AppColor.blueNormal
|
||||
: AppColor.blueNormal.disabledColor,
|
||||
),
|
||||
);
|
||||
|
||||
RFabOutlined.backNoBorder({VoidCallback? onPressed, Key? key})
|
||||
: this.noBorder(
|
||||
key: key,
|
||||
onPressed: onPressed,
|
||||
backgroundColor: AppColor.blueNormal,
|
||||
icon: vecWidget(
|
||||
Assets.vecArrowLeftSvg,
|
||||
color:
|
||||
onPressed != null
|
||||
? AppColor.blueNormal
|
||||
: AppColor.blueNormal.disabledColor,
|
||||
),
|
||||
);
|
||||
|
||||
//endregion
|
||||
}
|
||||
|
||||
class _RFabOutlinedState extends State<RFabOutlined> {
|
||||
bool isOnPressed =false;
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return OutlinedButton(
|
||||
onPressed:widget.onPressed ,
|
||||
style: ButtonStyle(
|
||||
side: WidgetStateProperty.resolveWith<BorderSide?>((states) {
|
||||
if (states.contains(WidgetState.disabled)) {
|
||||
return BorderSide(
|
||||
color:
|
||||
widget.borderColor?.disabledColor ??
|
||||
AppColor.blueNormal.disabledColor,
|
||||
width: 2,
|
||||
);
|
||||
}
|
||||
return BorderSide(
|
||||
color: widget.borderColor ?? AppColor.blueNormal,
|
||||
width: 2,
|
||||
);
|
||||
}),
|
||||
backgroundColor: WidgetStateProperty.resolveWith<Color?>((states) {
|
||||
if (states.contains(WidgetState.pressed)) {
|
||||
return widget.backgroundColor;
|
||||
} else if (states.contains(WidgetState.hovered)) {
|
||||
return widget.backgroundColor.hoverColor ??
|
||||
AppColor.blueNormal.hoverColor;
|
||||
} else if (states.contains(WidgetState.disabled)) {
|
||||
return widget.backgroundColor.disabledColor ??
|
||||
AppColor.blueNormal.disabledColor;
|
||||
}
|
||||
return Colors.transparent;
|
||||
}),
|
||||
foregroundColor: WidgetStateProperty.resolveWith<Color?>((states) {
|
||||
if (states.contains(WidgetState.pressed)) {
|
||||
return Colors.white;
|
||||
} else if (states.contains(WidgetState.disabled)) {
|
||||
return widget.backgroundColor.disabledColor ??
|
||||
AppColor.blueNormal.disabledColor;
|
||||
}
|
||||
return widget.backgroundColor;
|
||||
}),
|
||||
|
||||
shape: WidgetStatePropertyAll(widget.shapeBorder),
|
||||
fixedSize: WidgetStatePropertyAll(
|
||||
Size(widget.radius ?? 56, widget.radius ?? 56),
|
||||
),
|
||||
padding: WidgetStatePropertyAll(EdgeInsets.zero),
|
||||
),
|
||||
child: widget.icon
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
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),
|
||||
);
|
||||
}
|
||||
}
|
||||
77
lib/presentation/widget/buttons/text_button.dart
Normal file
77
lib/presentation/widget/buttons/text_button.dart
Normal file
@@ -0,0 +1,77 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:rasadyar_app/presentation/common/app_color.dart';
|
||||
import 'package:rasadyar_app/presentation/common/app_fonts.dart';
|
||||
|
||||
class RTextButton extends StatefulWidget {
|
||||
RTextButton({
|
||||
super.key,
|
||||
required this.text,
|
||||
required this.onPressed,
|
||||
foregroundColor,
|
||||
backgroundColor,
|
||||
borderColor,
|
||||
disabledBackgroundColor,
|
||||
radius,
|
||||
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;
|
||||
double? radius;
|
||||
TextStyle? textStyle;
|
||||
|
||||
@override
|
||||
State<RTextButton> createState() => _RTextButtonState();
|
||||
}
|
||||
|
||||
class _RTextButtonState extends State<RTextButton> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return TextButton(
|
||||
style: ButtonStyle(
|
||||
side: WidgetStatePropertyAll(BorderSide.none),
|
||||
backgroundColor: WidgetStateProperty.resolveWith<Color?>((states) {
|
||||
if (states.contains(WidgetState.pressed)) {
|
||||
return widget.backgroundColor ?? AppColor.blueNormal;
|
||||
} else if (states.contains(WidgetState.hovered)) {
|
||||
return widget.backgroundColor?.withAlpha(38) ?? AppColor.blueNormal.withAlpha(38);
|
||||
} else if (states.contains(WidgetState.disabled)) {
|
||||
return widget.disabledBackgroundColor ?? Colors.transparent;
|
||||
}
|
||||
return Colors.transparent;
|
||||
}),
|
||||
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),
|
||||
),
|
||||
),
|
||||
onPressed:widget.onPressed,
|
||||
child: Text(widget.text),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user