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.
55 lines
1.9 KiB
Dart
55 lines
1.9 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:mc_common_app/extensions/int_extensions.dart';
|
|
import 'package:mc_common_app/theme/colors.dart';
|
|
import 'package:mc_common_app/widgets/dropdown/dropdow_field.dart';
|
|
|
|
class MenuTabs extends StatelessWidget {
|
|
List<DropValue> dropList;
|
|
Function(DropValue value, int index ) onSelected;
|
|
Color? selectedColor;
|
|
|
|
MenuTabs(this.dropList, {required this.onSelected, this.selectedColor});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return SizedBox(
|
|
width: double.infinity,
|
|
height: 35,
|
|
child: ListView.separated(
|
|
itemBuilder: (context, index) {
|
|
return InkWell(
|
|
onTap: () {
|
|
onSelected(dropList[index], index);
|
|
},
|
|
child: Container(
|
|
height: 45,
|
|
decoration: BoxDecoration(
|
|
color: dropList[index].isEnabled! ? selectedColor ?? MyColors.darkIconColor : Colors.white,
|
|
border: Border.all(color: dropList[index].isEnabled! ? selectedColor ?? MyColors.darkIconColor : MyColors.darkPrimaryColor, width: 1.5),
|
|
borderRadius: const BorderRadius.all(Radius.circular(0)),
|
|
),
|
|
padding: const EdgeInsets.symmetric(horizontal: 20),
|
|
child: Center(
|
|
child: Text(
|
|
dropList[index].value,
|
|
style: TextStyle(
|
|
color: dropList[index].isEnabled! ? MyColors.white : Colors.black,
|
|
fontSize: 12,
|
|
fontWeight: FontWeight.w600,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
},
|
|
separatorBuilder: (context, index) {
|
|
return 12.width;
|
|
},
|
|
padding: const EdgeInsets.symmetric(horizontal: 21),
|
|
itemCount: dropList.length,
|
|
scrollDirection: Axis.horizontal,
|
|
),
|
|
);
|
|
}
|
|
}
|