sapaly_store/lib/features/widgets/sapaly_icon.dart

94 lines
3.1 KiB
Dart

import 'package:adaptix/adaptix.dart';
import 'package:flutter/material.dart';
import '../../themes/app_theme.dart';
class SapalyIcon extends StatelessWidget {
const SapalyIcon({
super.key,
required this.child,
required this.onTap,
required this.width,
required this.height,
required this.hasBadge,
this.badge,
});
final Widget child;
final bool hasBadge;
final String? badge;
final VoidCallback onTap;
final double width, height;
@override
Widget build(BuildContext context) {
return Builder(
builder: (context) {
return hasBadge
? Badge(
textStyle:
Theme.of(context).primaryTextTheme.bodyMedium?.copyWith(
color: AppTheme.whiteColor,
),
largeSize: 16.adaptedPx(),
alignment: AlignmentDirectional(30.adaptedPx(), 0),
label: Text(
badge!,
),
child: SizedBox(
width: width,
height: height,
child: RawMaterialButton(
elevation: 0,
focusElevation: 0,
hoverElevation: 0,
highlightElevation: 0,
highlightColor: AppTheme.lightPrimaryColor.withOpacity(0.3),
splashColor: AppTheme.lightPrimaryColor.withOpacity(0.4),
shape: const CircleBorder(),
fillColor: AppTheme.whiteColor,
onPressed: onTap,
child: child,
),
),
)
: SizedBox(
width: width,
height: height,
child: RawMaterialButton(
elevation: 0,
focusElevation: 0,
hoverElevation: 0,
highlightElevation: 0,
focusColor: AppTheme.lightPrimaryColor,
highlightColor: AppTheme.lightPrimaryColor.withOpacity(0.3),
splashColor: AppTheme.lightPrimaryColor.withOpacity(0.4),
shape: const CircleBorder(),
fillColor: AppTheme.whiteColor,
onPressed: onTap,
child: child,
),
);
// Container(
// width: width,
// height: height,
// decoration: BoxDecoration(
// color: AppTheme.whiteColor,
// borderRadius: BorderRadius.circular(50.adaptedPx()),
// ),
// child: TextButton(
// onPressed: onTap,
// child: child,
// style: ButtonStyle(
// shape: MaterialStateProperty.all<RoundedRectangleBorder>(
// RoundedRectangleBorder(
// borderRadius: BorderRadius.circular(50),
// ),
// ),
// ),
// ),
// );
},
);
}
}