75 lines
1.9 KiB
Dart
75 lines
1.9 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:food_hub_app/widgets/recipe/recipe_calendar.dart';
|
|
import 'package:food_hub_app/widgets/recipe/recipe_list.dart';
|
|
import 'package:food_hub_app/widgets/recipe/recipe_timeline.dart';
|
|
import 'package:tdesign_flutter/tdesign_flutter.dart';
|
|
|
|
import '../models/recipe.dart';
|
|
|
|
class RecordPage extends StatefulWidget {
|
|
const RecordPage({super.key});
|
|
|
|
@override
|
|
State<StatefulWidget> createState() => _RecordPageState();
|
|
}
|
|
|
|
class _RecordPageState extends State<RecordPage>
|
|
with SingleTickerProviderStateMixin {
|
|
final List<Recipe> recipeList = [];
|
|
|
|
final List<Record> recordList = [];
|
|
|
|
late final TabController _tabController = TabController(
|
|
length: 3,
|
|
vsync: this,
|
|
);
|
|
|
|
@override
|
|
void initState() {
|
|
super.initState();
|
|
}
|
|
|
|
@override
|
|
void dispose() {
|
|
_tabController.dispose();
|
|
super.dispose();
|
|
}
|
|
|
|
// 定义标签列表
|
|
final List<TDTab> tabs = [
|
|
const TDTab(text: '菜谱', icon: Icon(Icons.book)),
|
|
const TDTab(text: '日历', icon: Icon(Icons.calendar_month)),
|
|
const TDTab(text: '时间轴', icon: Icon(Icons.timeline)),
|
|
];
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Padding(
|
|
padding: EdgeInsets.all(0),
|
|
child: Column(
|
|
children: [
|
|
TDTabBar(
|
|
tabs: tabs,
|
|
controller: _tabController,
|
|
backgroundColor: Colors.white,
|
|
showIndicator: true,
|
|
),
|
|
Expanded(
|
|
child: Padding(
|
|
padding: EdgeInsets.all(5),
|
|
child: TabBarView(
|
|
controller: _tabController,
|
|
children: [
|
|
RecipeList(recipeList: recipeList),
|
|
RecipeCalendar(),
|
|
RecipeTimeline(recordList: recordList),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|