detail.dart 1.9 KB

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