home.dart 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. import 'package:flutter/material.dart';
  2. import 'package:hengyi/home/about_us.dart';
  3. import 'package:hengyi/home/contact_us.dart';
  4. import 'package:hengyi/home/country_list.dart';
  5. import 'package:hengyi/widget/common_footer.dart';
  6. import 'package:hengyi/widget/common_title.dart';
  7. class HomePage extends StatefulWidget {
  8. HomePage({super.key});
  9. @override
  10. State<HomePage> createState() => _HomePageState();
  11. }
  12. class _HomePageState extends State<HomePage>
  13. with SingleTickerProviderStateMixin {
  14. late TabController _tabController;
  15. List tabs = ["了解目的地", "联系我们", "关于我们"];
  16. @override
  17. void initState() {
  18. super.initState();
  19. _tabController = TabController(length: tabs.length, vsync: this);
  20. }
  21. @override
  22. Widget build(BuildContext context) {
  23. return Scaffold(
  24. body: Column(
  25. children: [
  26. const CommonTitleWidget(),
  27. TabBar(
  28. labelColor: Colors.black,
  29. unselectedLabelColor: Colors.grey,
  30. controller: _tabController,
  31. tabs: tabs
  32. .map((e) => Tab(
  33. text: e,
  34. ))
  35. .toList()),
  36. Expanded(
  37. child: TabBarView(
  38. controller: _tabController,
  39. children: [
  40. CountryListWidget(),
  41. ContactUSWidget(),
  42. AboutUSWidget(),
  43. ],
  44. )),
  45. CommonFooterWidget(),
  46. ],
  47. ),
  48. );
  49. }
  50. @override
  51. void dispose() {
  52. _tabController.dispose();
  53. super.dispose();
  54. }
  55. }