forked from eatvio/eatvio_app
69 lines
2.0 KiB
Dart
69 lines
2.0 KiB
Dart
import 'package:eatvio_app/core/theme/custom_text_style.dart';
|
|
import 'package:eatvio_app/core/theme/theme_helper.dart';
|
|
import 'package:eatvio_app/core/widgets/animated_option_button.dart';
|
|
import 'package:eatvio_app/generated/l10n.dart';
|
|
import 'package:flutter/widgets.dart';
|
|
|
|
class MyRecipesTab extends StatefulWidget {
|
|
const MyRecipesTab({super.key, this.additionalOnTap});
|
|
|
|
final void Function()? additionalOnTap;
|
|
|
|
@override
|
|
State<MyRecipesTab> createState() => _MyRecipesTabState();
|
|
}
|
|
|
|
class _MyRecipesTabState extends State<MyRecipesTab> {
|
|
final List<String> tabTitles = [];
|
|
|
|
@override
|
|
void didChangeDependencies() {
|
|
final s = S.of(context);
|
|
if (tabTitles.isEmpty) {
|
|
tabTitles.add(s.published);
|
|
tabTitles.add(s.drafted);
|
|
}
|
|
super.didChangeDependencies();
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Align(
|
|
alignment: Alignment.centerLeft,
|
|
child: Row(
|
|
children: [
|
|
Expanded(
|
|
child: Container(
|
|
height: 48,
|
|
decoration: BoxDecoration(
|
|
color: appTheme.whiteA700,
|
|
borderRadius: BorderRadius.circular(100),
|
|
),
|
|
padding: const EdgeInsets.all(4),
|
|
child: Row(
|
|
children: [
|
|
...List.generate(
|
|
2,
|
|
(index) =>
|
|
Expanded(
|
|
child: AnimatedOptionButton(
|
|
textStyle: TextStyles.textSMedium,
|
|
isSelected: false, // state.selectedStateIndex == index,
|
|
text: tabTitles[index],
|
|
onTap: () {
|
|
widget.additionalOnTap?.call();
|
|
// context.read<MyPlansCubit>().changeSelectedStateIndex(index);
|
|
},
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|