home_page.dart
1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import '../controllers/home_controller.dart';
import '../widgets/df_tab_bar.dart';
import '../../friends/views/friends_tab.dart';
import 'tabs/today_tab.dart';
import 'tabs/trend_tab.dart';
import 'tabs/my_tab.dart';
class HomePage extends GetView<HomeController> {
const HomePage({super.key});
static const _tabs = [
TodayTab(),
TrendTab(),
FriendsTab(),
MyTab(),
];
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: const Color(0xFFF5F2FF),
// 不使用系统 AppBar,Today 页自带状态栏适配
extendBody: true, // 让内容延伸到 bottomNavigationBar 下方
extendBodyBehindAppBar: true,
body: Obx(
() => IndexedStack(
index: controller.selectedIndex.value,
children: _tabs,
),
),
bottomNavigationBar: Obx(
() => DfTabBar(
selectedIndex: controller.selectedIndex.value,
onTap: controller.changeTab,
),
),
);
}
}