DiscoverModule/lib/contacts_module/custom_widget/custom_floatingbutton.dart

79 lines
2.3 KiB
Dart
Raw Normal View History

2024-11-22 10:38:43 +00:00
import 'package:discover_module/contacts_module/ui_screen/newformlist.dart';
import 'package:flutter/material.dart';
class CustomFloatingBtn extends StatefulWidget {
final double? height;
final double? width;
final Color? color;
final double? borderWidth;
final double? borderRadius;
final IconData? icon;
final Color? iconColor;
final double? iconsize;
final VoidCallbackAction? ontap;
const CustomFloatingBtn(
{super.key,
this.height,
this.width,
this.color,
this.borderRadius,
this.borderWidth,
this.ontap,
this.icon,
this.iconColor,
this.iconsize});
@override
State<CustomFloatingBtn> createState() => _CustomFloatingBtnState();
}
class _CustomFloatingBtnState extends State<CustomFloatingBtn> {
@override
Widget build(BuildContext context) {
return Container(
width: widget.width,
height: widget.height,
decoration: BoxDecoration(
border: Border.all(
color: widget.color!, // Outer border color
width: 1.8,
),
borderRadius:
BorderRadius.circular(widget.borderRadius!), // Rounded border
boxShadow: [
BoxShadow(
color: widget.color!.withOpacity(0.2), // Shadow color with opacity
blurRadius: 5, // Shadow blur radius
spreadRadius: 2, // Spread of the shadow
offset: Offset(2, 2), // Shadow offset
),
],
),
child: FloatingActionButton(
// shape: CircleBorder(),
shape: RoundedRectangleBorder(
side: BorderSide(width: 7, color: widget.iconColor!),
borderRadius: BorderRadius.circular(widget.borderRadius!)),
onPressed: () async {
Navigator.push(
context, MaterialPageRoute(builder: (context) => FormList()));
},
foregroundColor: widget.iconColor,
backgroundColor: widget.color,
child: Text(
String.fromCharCode(widget.icon!.codePoint),
style: TextStyle(
color: widget.iconColor,
inherit: false,
fontSize: widget.iconsize,
fontWeight: FontWeight.w800,
fontFamily: Icons.space_dashboard_outlined.fontFamily,
),
),
),
);
}
}