forked from eatvio/eatvio_app
refactor(diary): More refactoring
This commit is contained in:
@@ -10,22 +10,14 @@ class CustomIconButton extends StatelessWidget {
|
||||
this.decoration,
|
||||
this.child,
|
||||
this.onTap,
|
||||
}) : super(
|
||||
key: key,
|
||||
);
|
||||
}) : super(key: key);
|
||||
|
||||
final Alignment? alignment;
|
||||
|
||||
final double? height;
|
||||
|
||||
final double? width;
|
||||
|
||||
final EdgeInsetsGeometry? padding;
|
||||
|
||||
final BoxDecoration? decoration;
|
||||
|
||||
final Widget? child;
|
||||
|
||||
final VoidCallback? onTap;
|
||||
|
||||
@override
|
||||
@@ -33,40 +25,40 @@ class CustomIconButton extends StatelessWidget {
|
||||
return alignment != null
|
||||
? Align(
|
||||
alignment: alignment ?? Alignment.center,
|
||||
child: iconButtonWidget,
|
||||
child: _buildIconButtonWidget(),
|
||||
)
|
||||
: iconButtonWidget;
|
||||
: _buildIconButtonWidget();
|
||||
}
|
||||
|
||||
Widget get iconButtonWidget => SizedBox(
|
||||
height: height ?? 0,
|
||||
width: width ?? 0,
|
||||
child: IconButton(
|
||||
padding: EdgeInsets.zero,
|
||||
icon: Container(
|
||||
height: height ?? 0,
|
||||
width: width ?? 0,
|
||||
padding: padding ?? EdgeInsets.zero,
|
||||
decoration: decoration ??
|
||||
BoxDecoration(
|
||||
color: Colors.black,
|
||||
borderRadius: BorderRadius.circular(9),
|
||||
border: Border.all(
|
||||
color: Colors.blueGrey,
|
||||
width: 1,
|
||||
),
|
||||
),
|
||||
child: child,
|
||||
),
|
||||
onPressed: onTap,
|
||||
_buildIconButtonWidget() {
|
||||
return SizedBox(
|
||||
height: height ?? 0,
|
||||
width: width ?? 0,
|
||||
child: IconButton(
|
||||
padding: EdgeInsets.zero,
|
||||
icon: Container(
|
||||
height: height ?? 0,
|
||||
width: width ?? 0,
|
||||
padding: padding ?? EdgeInsets.zero,
|
||||
decoration: decoration ??
|
||||
BoxDecoration(
|
||||
color: Colors.black,
|
||||
borderRadius: const BorderRadius.all(Radius.circular(9)),
|
||||
border: const Border.fromBorderSide(
|
||||
BorderSide(color: Colors.blueGrey, width: 1)),
|
||||
),
|
||||
child: child,
|
||||
),
|
||||
);
|
||||
onPressed: onTap,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// Extension on [CustomIconButton] to facilitate inclusion of all types of border style etc
|
||||
extension IconButtonStyleHelper on CustomIconButton {
|
||||
static BoxDecoration get fillBlueA => BoxDecoration(
|
||||
color: Colors.blue,
|
||||
borderRadius: BorderRadius.circular(14),
|
||||
borderRadius: const BorderRadius.all(Radius.circular(14)),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user