|
@@ -6,8 +6,10 @@ import 'package:cs_resources/theme/theme_config.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:auto_route/auto_route.dart';
|
|
import 'package:auto_route/auto_route.dart';
|
|
import 'package:flutter/services.dart';
|
|
import 'package:flutter/services.dart';
|
|
|
|
+import 'package:flutter_hooks/flutter_hooks.dart';
|
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
|
import 'package:router/ext/auto_router_extensions.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/ext/ex_widget.dart';
|
|
import 'package:widgets/my_appbar.dart';
|
|
import 'package:widgets/my_appbar.dart';
|
|
import 'package:widgets/my_load_image.dart';
|
|
import 'package:widgets/my_load_image.dart';
|
|
@@ -30,24 +32,34 @@ class PaymentPage extends HookConsumerWidget {
|
|
|
|
|
|
@override
|
|
@override
|
|
Widget build(BuildContext context, WidgetRef ref) {
|
|
Widget build(BuildContext context, WidgetRef ref) {
|
|
- final viewModel = ref.read(paymentViewModelProvider.notifier);
|
|
|
|
|
|
+ final viewModel = ref.watch(paymentViewModelProvider.notifier);
|
|
|
|
+ int selectedInnerIndex = 1; // 1-3索引记录当前的值
|
|
|
|
|
|
return Scaffold(
|
|
return Scaffold(
|
|
appBar: MyAppBar.appBar(
|
|
appBar: MyAppBar.appBar(
|
|
context,
|
|
context,
|
|
- S.current.facility,
|
|
|
|
|
|
+ S.current.payment,
|
|
backgroundColor: context.appColors.whiteBG,
|
|
backgroundColor: context.appColors.whiteBG,
|
|
),
|
|
),
|
|
backgroundColor: context.appColors.backgroundDark,
|
|
backgroundColor: context.appColors.backgroundDark,
|
|
body: AutoTabsRouter.pageView(
|
|
body: AutoTabsRouter.pageView(
|
|
routes: const [
|
|
routes: const [
|
|
InfoPageRoute(),
|
|
InfoPageRoute(),
|
|
- CondoPageRoute(),
|
|
|
|
|
|
+ CondoPaymentPageRoute(),
|
|
|
|
+ CondoActivePageRoute(),
|
|
|
|
+ CondoHistoryPageRoute(),
|
|
ManagePageRoute(),
|
|
ManagePageRoute(),
|
|
],
|
|
],
|
|
builder: (context, child, pageController) {
|
|
builder: (context, child, pageController) {
|
|
final tabsRouter = AutoTabsRouter.of(context);
|
|
final tabsRouter = AutoTabsRouter.of(context);
|
|
|
|
|
|
|
|
+ pageController.addListener(() {
|
|
|
|
+ //监听赋值内部的选中索引
|
|
|
|
+ if (tabsRouter.activeIndex >= 1 && tabsRouter.activeIndex <= 3) {
|
|
|
|
+ selectedInnerIndex = tabsRouter.activeIndex;
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+
|
|
return Column(
|
|
return Column(
|
|
children: [
|
|
children: [
|
|
Container(
|
|
Container(
|
|
@@ -56,8 +68,7 @@ class PaymentPage extends HookConsumerWidget {
|
|
child: Row(
|
|
child: Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
|
children: [
|
|
children: [
|
|
-
|
|
|
|
- _buildCategory(
|
|
|
|
|
|
+ _buildTopCategory(
|
|
context,
|
|
context,
|
|
Assets.paymentInfoIcon,
|
|
Assets.paymentInfoIcon,
|
|
34,
|
|
34,
|
|
@@ -65,39 +76,75 @@ class PaymentPage extends HookConsumerWidget {
|
|
"Info",
|
|
"Info",
|
|
tabsRouter.activeIndex == 0,
|
|
tabsRouter.activeIndex == 0,
|
|
).onTap(
|
|
).onTap(
|
|
- () {
|
|
|
|
|
|
+ () {
|
|
tabsRouter.setActiveIndex(0);
|
|
tabsRouter.setActiveIndex(0);
|
|
},
|
|
},
|
|
),
|
|
),
|
|
- _buildCategory(
|
|
|
|
|
|
+ _buildTopCategory(
|
|
context,
|
|
context,
|
|
Assets.paymentCondoIcon,
|
|
Assets.paymentCondoIcon,
|
|
48,
|
|
48,
|
|
43,
|
|
43,
|
|
- "Condo",
|
|
|
|
- tabsRouter.activeIndex == 1,
|
|
|
|
|
|
+ "Condo",
|
|
|
|
+ tabsRouter.activeIndex == 1 || tabsRouter.activeIndex == 2 || tabsRouter.activeIndex == 3,
|
|
).onTap(
|
|
).onTap(
|
|
- () {
|
|
|
|
- tabsRouter.setActiveIndex(1);
|
|
|
|
|
|
+ () {
|
|
|
|
+ tabsRouter.setActiveIndex(selectedInnerIndex);
|
|
},
|
|
},
|
|
),
|
|
),
|
|
- _buildCategory(
|
|
|
|
|
|
+ _buildTopCategory(
|
|
context,
|
|
context,
|
|
Assets.paymentManageIcon,
|
|
Assets.paymentManageIcon,
|
|
52,
|
|
52,
|
|
46.5,
|
|
46.5,
|
|
"Manage",
|
|
"Manage",
|
|
- tabsRouter.activeIndex == 2,
|
|
|
|
|
|
+ tabsRouter.activeIndex == 4,
|
|
).onTap(
|
|
).onTap(
|
|
- () {
|
|
|
|
- tabsRouter.setActiveIndex(2);
|
|
|
|
|
|
+ () {
|
|
|
|
+ tabsRouter.setActiveIndex(4);
|
|
},
|
|
},
|
|
),
|
|
),
|
|
],
|
|
],
|
|
),
|
|
),
|
|
),
|
|
),
|
|
Expanded(
|
|
Expanded(
|
|
- child: child,
|
|
|
|
|
|
+ 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),
|
|
|
|
+ ),
|
|
|
|
+ ],
|
|
|
|
+ ),
|
|
),
|
|
),
|
|
],
|
|
],
|
|
);
|
|
);
|
|
@@ -107,7 +154,7 @@ class PaymentPage extends HookConsumerWidget {
|
|
}
|
|
}
|
|
|
|
|
|
//顶部的Tab布局
|
|
//顶部的Tab布局
|
|
- Widget _buildCategory(BuildContext context, String iconPath, double iconWidth, double iconHeight, String title, bool isSelected) {
|
|
|
|
|
|
+ Widget _buildTopCategory(BuildContext context, String iconPath, double iconWidth, double iconHeight, String title, bool isSelected) {
|
|
return Column(
|
|
return Column(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
@@ -120,13 +167,13 @@ class PaymentPage extends HookConsumerWidget {
|
|
shape: BoxShape.circle, // 设置为圆形
|
|
shape: BoxShape.circle, // 设置为圆形
|
|
boxShadow: isSelected
|
|
boxShadow: isSelected
|
|
? [
|
|
? [
|
|
- BoxShadow(
|
|
|
|
- color: context.appColors.tabLightBlueShadow, // 设置阴影颜色
|
|
|
|
- blurRadius: 5, // 设置模糊半径
|
|
|
|
- spreadRadius: 0.05, // 控制阴影扩散
|
|
|
|
- offset: const Offset(0, 4), // 设置阴影偏移量
|
|
|
|
- ),
|
|
|
|
- ]
|
|
|
|
|
|
+ BoxShadow(
|
|
|
|
+ color: context.appColors.tabLightBlueShadow, // 设置阴影颜色
|
|
|
|
+ blurRadius: 5, // 设置模糊半径
|
|
|
|
+ spreadRadius: 0.05, // 控制阴影扩散
|
|
|
|
+ offset: const Offset(0, 4), // 设置阴影偏移量
|
|
|
|
+ ),
|
|
|
|
+ ]
|
|
: [], // 未选中时无阴影,
|
|
: [], // 未选中时无阴影,
|
|
),
|
|
),
|
|
child: Center(
|
|
child: Center(
|
|
@@ -143,4 +190,20 @@ 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,
|
|
|
|
+ );
|
|
|
|
+ }
|
|
}
|
|
}
|