65 lines
1.5 KiB
Dart
65 lines
1.5 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:food_hub_app/widgets/recipe/calendar.dart';
|
|
import 'package:food_hub_app/widgets/recipe/list.dart';
|
|
import 'package:food_hub_app/widgets/recipe/timeline.dart';
|
|
import 'package:tdesign_flutter/tdesign_flutter.dart';
|
|
|
|
|
|
class RecordPage extends StatefulWidget {
|
|
const RecordPage({super.key});
|
|
|
|
@override
|
|
State<StatefulWidget> createState() => _RecordPageState();
|
|
}
|
|
|
|
class _RecordPageState extends State<RecordPage>
|
|
with SingleTickerProviderStateMixin {
|
|
|
|
late final TabController _tabController = TabController(
|
|
length: 3,
|
|
vsync: this,
|
|
);
|
|
|
|
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
|
|
void initState() {
|
|
super.initState();
|
|
}
|
|
|
|
@override
|
|
void dispose() {
|
|
_tabController.dispose();
|
|
super.dispose();
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Column(
|
|
children: [
|
|
TDTabBar(
|
|
tabs: tabs,
|
|
controller: _tabController,
|
|
backgroundColor: Colors.white,
|
|
showIndicator: true,
|
|
),
|
|
SizedBox(height: 8),
|
|
Expanded(
|
|
child: TabBarView(
|
|
controller: _tabController,
|
|
children: [
|
|
RecipeList(),
|
|
RecipeCalendar(),
|
|
RecipeTimeline(),
|
|
],
|
|
),
|
|
),
|
|
],
|
|
);
|
|
}
|
|
}
|