feat:更新记录页面模块
This commit is contained in:
45
lib/widgets/recipe/recipe_segment.dart
Normal file
45
lib/widgets/recipe/recipe_segment.dart
Normal file
@@ -0,0 +1,45 @@
|
||||
import 'package:custom_sliding_segmented_control/custom_sliding_segmented_control.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:food_hub_app/models/recipe.dart';
|
||||
|
||||
class RecipeSegment extends StatelessWidget {
|
||||
final ViewType selectedViewType;
|
||||
final Function(ViewType) onViewTypeChanged;
|
||||
|
||||
const RecipeSegment({super.key, required this.selectedViewType, required this.onViewTypeChanged});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return CustomSlidingSegmentedControl<int>(
|
||||
initialValue: 1,
|
||||
children: {
|
||||
1: SizedBox(
|
||||
width: 50,
|
||||
child: Text('菜谱', textAlign: TextAlign.center),
|
||||
),
|
||||
2: SizedBox(
|
||||
width: 50,
|
||||
child: Text('日历', textAlign: TextAlign.center),
|
||||
),
|
||||
3: SizedBox(
|
||||
width: 50,
|
||||
child: Text('时间轴', textAlign: TextAlign.center),
|
||||
),
|
||||
},
|
||||
decoration: BoxDecoration(
|
||||
color: CupertinoColors.lightBackgroundGray,
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
thumbDecoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
duration: Duration(milliseconds: 300),
|
||||
curve: Curves.easeInToLinear,
|
||||
onValueChanged: (value) {
|
||||
onViewTypeChanged(ViewType.values[value - 1]);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user