import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:get/get_utils/get_utils.dart';
import 'package:nb_utils/nb_utils.dart';
import 'package:toptongpin/app/common/widgets/image/local_image.dart';
import 'package:toptongpin/app/pages/MyAccount/views/widgets/EmptyCard.dart';
import 'package:toptongpin/app/pages/makeMoneryCenter/views/page_view_scroll_utils.dart';
import 'package:toptongpin/app/utils/config_util.dart';
import 'package:toptongpin/app/utils/extensions/size_fit.dart';
import 'package:toptongpin/app/utils/object_util.dart';
import 'package:toptongpin/app/utils/screen_util.dart';
import '../../../common/widgets/button/gradient_button.dart';
import '../../../common/widgets/tab/round_indicator.dart';
import '../../../res/colors.dart';
import '../../../res/styles.dart';
import '../controllers/my_earnings_controller.dart';
import '../model/myEarning.dart';
import '../model/tab.dart';
import '../widget/indicator.dart';
class ProfitPage extends StatefulWidget {
@override
_ProfitPageState createState() => _ProfitPageState();
}
class _ProfitPageState extends State<ProfitPage>
with SingleTickerProviderStateMixin {
late TabController _tabController;
PageViewScrollUtils? _pageViewScrollUtils;
PageController _pageController = PageController();
MyEarningsController controller = Get.find();
List<Tabs> listTabs = [];
@override
void initState() {
listTabs = [];
listTabs.add(Tabs(
tabName: '动态', moneyNum: controller.myProfit?.dycProfitNum ?? 0.0));
listTabs.add(Tabs(
tabName: '聊天', moneyNum: controller.myProfit?.msgProfitNum ?? 0.0));
listTabs.add(Tabs(
tabName: '赚钱', moneyNum: controller.myProfit?.makeProfitNum ?? 0.0));
super.initState();
_tabController =
TabController(initialIndex: controller.i, length: 3, vsync: this)
..addListener(() {
if (!_tabController.indexIsChanging) {
controller.setType(_tabController.index);
}
});
_pageViewScrollUtils = PageViewScrollUtils(_pageController, _tabController);
}
//height: (200.w * _.taskTyroList.length) + 172.w,
@override
Widget build(BuildContext context) {
return GetBuilder<MyEarningsController>(builder: (_) {
return EmptyCard(Container(
height: _.tabIcon.length == 0
? 650.w
: ((_.tabIcon.length) * 160.w + 350.w),
child: Column(
mainAxi
flutter 页面中间tab切换
最新推荐文章于 2024-08-24 08:27:22 发布
本文探讨了在Flutter中处理页面中间Tab切换时遇到的问题,特别是面对页面高度不一致的场景,目前尚无理想解决方案,当前采取的是隐藏后再显示的临时对策。
摘要由CSDN通过智能技术生成