You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
cloudsolutions-atoms/lib/new_views/common_widgets/tab_button.dart

46 lines
1.6 KiB
Dart

import 'package:flutter/material.dart';
import 'package:test_sa/extensions/text_extensions.dart';
import 'package:test_sa/extensions/widget_extensions.dart';
import 'package:test_sa/new_views/app_style/app_color.dart';
import 'package:test_sa/new_views/common_widgets/custom_badge.dart';
class TabButton extends StatelessWidget {
final String label;
final bool isSelected;
final int count;
final bool loading;
final VoidCallback onPressed;
const TabButton({Key? key, required this.label, this.isSelected = false, required this.count, this.loading = false, required this.onPressed}) : super(key: key);
@override
Widget build(BuildContext context) {
return InkWell(
onTap: onPressed,
child: CustomBadge(
value: loading
? 0
: !isSelected
? 0
: count,
child: Container(
padding: const EdgeInsets.symmetric(horizontal: 15, vertical: 8),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(7),
color: isSelected ? AppColor.primary10 : AppColor.background(context),
border: !isSelected ? Border.all(color: AppColor.white936.withOpacity(.03), width: 1) : null,
),
alignment: Alignment.center,
child: Text(
label,
style: AppTextStyles.bodyText2.copyWith(
//AppColor.background(context)
color: isSelected ? Colors.white :AppColor.textColor(context) ,
),
),
),
),
).toShimmer(isShow: loading && isSelected, radius: 7,context: context);
}
}