|
@@ -2,14 +2,11 @@ import 'package:cpt_payment/modules/payment/payment_view_model.dart';
|
|
|
import 'package:cs_resources/generated/assets.dart';
|
|
|
import 'package:cs_resources/generated/l10n.dart';
|
|
|
import 'package:cs_resources/theme/app_colors_theme.dart';
|
|
|
-import 'package:cs_resources/theme/theme_config.dart';
|
|
|
import 'package:flutter/material.dart';
|
|
|
import 'package:auto_route/auto_route.dart';
|
|
|
import 'package:flutter/services.dart';
|
|
|
-import 'package:flutter_hooks/flutter_hooks.dart';
|
|
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
|
|
import 'package:router/ext/auto_router_extensions.dart';
|
|
|
-import 'package:shared/utils/log_utils.dart';
|
|
|
import 'package:widgets/ext/ex_widget.dart';
|
|
|
import 'package:widgets/my_appbar.dart';
|
|
|
import 'package:widgets/my_load_image.dart';
|
|
@@ -33,7 +30,6 @@ class PaymentPage extends HookConsumerWidget {
|
|
|
@override
|
|
|
Widget build(BuildContext context, WidgetRef ref) {
|
|
|
final viewModel = ref.watch(paymentViewModelProvider.notifier);
|
|
|
- int selectedInnerIndex = 1; // 1-3索引记录当前的值
|
|
|
|
|
|
return Scaffold(
|
|
|
appBar: MyAppBar.appBar(
|
|
@@ -45,21 +41,13 @@ class PaymentPage extends HookConsumerWidget {
|
|
|
body: AutoTabsRouter.pageView(
|
|
|
routes: const [
|
|
|
InfoPageRoute(),
|
|
|
- CondoPaymentPageRoute(),
|
|
|
- CondoActivePageRoute(),
|
|
|
- CondoHistoryPageRoute(),
|
|
|
+ PaymentListPageRoute(),
|
|
|
+ HistoryListPageRoute(),
|
|
|
ManagePageRoute(),
|
|
|
],
|
|
|
builder: (context, child, pageController) {
|
|
|
final tabsRouter = AutoTabsRouter.of(context);
|
|
|
|
|
|
- pageController.addListener(() {
|
|
|
- //监听赋值内部的选中索引
|
|
|
- if (tabsRouter.activeIndex >= 1 && tabsRouter.activeIndex <= 3) {
|
|
|
- selectedInnerIndex = tabsRouter.activeIndex;
|
|
|
- }
|
|
|
- });
|
|
|
-
|
|
|
return Column(
|
|
|
children: [
|
|
|
Container(
|
|
@@ -71,9 +59,9 @@ class PaymentPage extends HookConsumerWidget {
|
|
|
_buildTopCategory(
|
|
|
context,
|
|
|
Assets.paymentInfoIcon,
|
|
|
- 34,
|
|
|
- 41,
|
|
|
- "Info",
|
|
|
+ 41.0,
|
|
|
+ 41.0,
|
|
|
+ S.current.info,
|
|
|
tabsRouter.activeIndex == 0,
|
|
|
).onTap(
|
|
|
() {
|
|
@@ -82,69 +70,45 @@ class PaymentPage extends HookConsumerWidget {
|
|
|
),
|
|
|
_buildTopCategory(
|
|
|
context,
|
|
|
- Assets.paymentCondoIcon,
|
|
|
- 48,
|
|
|
- 43,
|
|
|
- "Condo",
|
|
|
- tabsRouter.activeIndex == 1 || tabsRouter.activeIndex == 2 || tabsRouter.activeIndex == 3,
|
|
|
+ Assets.paymentPaymentIcon,
|
|
|
+ 37.5,
|
|
|
+ 38.0,
|
|
|
+ S.current.payment,
|
|
|
+ tabsRouter.activeIndex == 1,
|
|
|
).onTap(
|
|
|
() {
|
|
|
- tabsRouter.setActiveIndex(selectedInnerIndex);
|
|
|
+ tabsRouter.setActiveIndex(1);
|
|
|
+ },
|
|
|
+ ),
|
|
|
+ _buildTopCategory(
|
|
|
+ context,
|
|
|
+ Assets.paymentHistoryIcon,
|
|
|
+ 38.0,
|
|
|
+ 38.0,
|
|
|
+ S.current.history,
|
|
|
+ tabsRouter.activeIndex == 2,
|
|
|
+ ).onTap(
|
|
|
+ () {
|
|
|
+ tabsRouter.setActiveIndex(2);
|
|
|
},
|
|
|
),
|
|
|
_buildTopCategory(
|
|
|
context,
|
|
|
Assets.paymentManageIcon,
|
|
|
- 52,
|
|
|
- 46.5,
|
|
|
- "Manage",
|
|
|
- tabsRouter.activeIndex == 4,
|
|
|
+ 42.0,
|
|
|
+ 32.0,
|
|
|
+ S.current.manage,
|
|
|
+ tabsRouter.activeIndex == 3,
|
|
|
).onTap(
|
|
|
() {
|
|
|
- tabsRouter.setActiveIndex(4);
|
|
|
+ tabsRouter.setActiveIndex(3);
|
|
|
},
|
|
|
),
|
|
|
],
|
|
|
),
|
|
|
),
|
|
|
Expanded(
|
|
|
- child: Stack(
|
|
|
- children: [
|
|
|
- //真正页面
|
|
|
- child,
|
|
|
-
|
|
|
- //顶部的子Tab
|
|
|
- Visibility(
|
|
|
- visible: tabsRouter.activeIndex >= 1 && tabsRouter.activeIndex <= 3,
|
|
|
- child: Row(
|
|
|
- mainAxisAlignment: MainAxisAlignment.spaceAround,
|
|
|
- children: [
|
|
|
- _buildInnerTab(
|
|
|
- context,
|
|
|
- S.current.payment,
|
|
|
- tabsRouter.activeIndex == 1,
|
|
|
- ).onTap(() {
|
|
|
- tabsRouter.setActiveIndex(1);
|
|
|
- }),
|
|
|
- _buildInnerTab(
|
|
|
- context,
|
|
|
- S.current.facility_active,
|
|
|
- tabsRouter.activeIndex == 2,
|
|
|
- ).onTap(() {
|
|
|
- tabsRouter.setActiveIndex(2);
|
|
|
- }),
|
|
|
- _buildInnerTab(
|
|
|
- context,
|
|
|
- S.current.history,
|
|
|
- tabsRouter.activeIndex == 3,
|
|
|
- ).onTap(() {
|
|
|
- tabsRouter.setActiveIndex(3);
|
|
|
- }),
|
|
|
- ],
|
|
|
- ).marginOnly(top: 14, bottom: 17),
|
|
|
- ),
|
|
|
- ],
|
|
|
- ),
|
|
|
+ child: child,
|
|
|
),
|
|
|
],
|
|
|
);
|
|
@@ -191,19 +155,4 @@ class PaymentPage extends HookConsumerWidget {
|
|
|
);
|
|
|
}
|
|
|
|
|
|
- //内部的Tab布局
|
|
|
- Widget _buildInnerTab(BuildContext context, String title, bool isSelected) {
|
|
|
- return MyTextView(
|
|
|
- title,
|
|
|
- fontSize: 16,
|
|
|
- isFontMedium: true,
|
|
|
- textColor: isSelected ? Colors.white : context.appColors.tabTextUnSelectedDefault,
|
|
|
- backgroundColor: isSelected ? context.appColors.btnBgDefault : Colors.transparent,
|
|
|
- cornerRadius: 16.5,
|
|
|
- paddingLeft: 20,
|
|
|
- paddingRight: 20,
|
|
|
- paddingTop: 8,
|
|
|
- paddingBottom: 8,
|
|
|
- );
|
|
|
- }
|
|
|
}
|