test base project
This commit is contained in:
@@ -0,0 +1,92 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import '../Utils/color_constants.dart';
|
||||
import '../Utils/size_utils.dart';
|
||||
|
||||
class CustomFloatingButton extends StatelessWidget {
|
||||
CustomFloatingButton(
|
||||
{this.shape,
|
||||
this.variant,
|
||||
this.alignment,
|
||||
this.margin,
|
||||
this.onTap,
|
||||
this.width,
|
||||
this.height,
|
||||
this.child});
|
||||
|
||||
FloatingButtonShape? shape;
|
||||
|
||||
FloatingButtonVariant? variant;
|
||||
|
||||
Alignment? alignment;
|
||||
|
||||
EdgeInsetsGeometry? margin;
|
||||
|
||||
VoidCallback? onTap;
|
||||
|
||||
double? width;
|
||||
|
||||
double? height;
|
||||
|
||||
Widget? child;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return alignment != null
|
||||
? Align(
|
||||
alignment: alignment ?? Alignment.center,
|
||||
child: _buildFabWidget(),
|
||||
)
|
||||
: _buildFabWidget();
|
||||
}
|
||||
|
||||
_buildFabWidget() {
|
||||
return Padding(
|
||||
padding: margin ?? EdgeInsets.zero,
|
||||
child: FloatingActionButton(
|
||||
backgroundColor: _setColor(),
|
||||
onPressed: onTap,
|
||||
child: Container(
|
||||
alignment: Alignment.center,
|
||||
width: getSize(width ?? 0),
|
||||
height: getSize(height ?? 0),
|
||||
decoration: _buildDecoration(),
|
||||
child: child,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
_buildDecoration() {
|
||||
return BoxDecoration(
|
||||
color: _setColor(),
|
||||
borderRadius: _setBorderRadius(),
|
||||
);
|
||||
}
|
||||
|
||||
_setColor() {
|
||||
switch (variant) {
|
||||
default:
|
||||
return ColorConstant.blueA700;
|
||||
}
|
||||
}
|
||||
|
||||
_setBorderRadius() {
|
||||
switch (shape) {
|
||||
default:
|
||||
return BorderRadius.circular(
|
||||
getHorizontalSize(
|
||||
6.00,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
enum FloatingButtonShape {
|
||||
RoundedBorder6,
|
||||
}
|
||||
|
||||
enum FloatingButtonVariant {
|
||||
FillBlueA700,
|
||||
}
|
||||
Reference in New Issue
Block a user