forked from eatvio/eatvio_app
44 lines
1.5 KiB
Dart
44 lines
1.5 KiB
Dart
import 'package:eatvio_app/core/theme/theme_helper.dart';
|
|
import 'package:eatvio_app/core/widgets/animated_option_button.dart';
|
|
import 'package:eatvio_app/features/plans/presentation/cubit/about_plan_cubit.dart';
|
|
import 'package:eatvio_app/features/plans/presentation/cubit/about_plan_state.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
|
|
|
class OptionsTab extends StatelessWidget {
|
|
const OptionsTab({super.key, required this.cost});
|
|
final List<num> cost;
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return BlocBuilder<AboutPlanCubit, AboutPlanState>(
|
|
builder: (context, state) {
|
|
final selectedOption = state.chosenOptionIndex;
|
|
return Container(
|
|
margin: EdgeInsets.symmetric(horizontal: 4),
|
|
decoration: BoxDecoration(
|
|
color: appTheme.whiteA700,
|
|
borderRadius: BorderRadius.circular(100),
|
|
),
|
|
padding: const EdgeInsets.all(4),
|
|
child: Row(
|
|
children: [
|
|
...List.generate(
|
|
3,
|
|
(index) => Expanded(
|
|
child: AnimatedOptionButton(
|
|
isSelected: selectedOption == index,
|
|
text: '${cost[index]}₽',
|
|
onTap: () {
|
|
context.read<AboutPlanCubit>().choseOption(index);
|
|
},
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
},
|
|
);
|
|
}
|
|
}
|