feat:医院支付,选择支付钱包支付
This commit is contained in:
1 parent
c2707899db
commit
3a7ca1e5be
17 files changed
+441
-117
No files matched your search
@@ -0,0 +1,97 @@
|
||||
import 'package:common_utils/common_utils.dart';
|
||||
import 'package:ducafe_ui_core/ducafe_ui_core.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:forui/forui.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:pj_supermarket_cloud/common/index.dart';
|
||||
|
||||
final _successColor = Colors.greenAccent[200];
|
||||
|
||||
Widget AppWalletSelector(
|
||||
BuildContext context, {
|
||||
required List<ServiceWallet> list,
|
||||
required Function(ServiceWallet) onChange,
|
||||
ServiceWallet? selector,
|
||||
}) {
|
||||
if (ObjectUtil.isEmpty(list)) {
|
||||
return const SizedBox();
|
||||
}
|
||||
final currentSelector = selector ?? list[0];
|
||||
final theme = FTheme.of(context);
|
||||
return list
|
||||
.map((v) {
|
||||
// 钱包类型映射
|
||||
final walletTypeStr = WalletType.values
|
||||
.firstWhereOrNull(
|
||||
(item) => item.code == v.walletTypeUniqueCode,
|
||||
)
|
||||
?.title ??
|
||||
"未知钱包";
|
||||
// 是否选中
|
||||
final isSelect =
|
||||
v.walletTypeUniqueCode == currentSelector.walletTypeUniqueCode;
|
||||
|
||||
return <Widget>[
|
||||
FIcon(
|
||||
FAssets.icons.walletMinimal,
|
||||
size: theme.typography.xl.fontSize,
|
||||
),
|
||||
SizedBox(width: 10.w),
|
||||
Text(
|
||||
walletTypeStr,
|
||||
style: theme.typography.xl.copyWith(height: 1),
|
||||
),
|
||||
SizedBox(width: 10.w),
|
||||
appPrice(context, v.balance),
|
||||
const Spacer(),
|
||||
FIcon(
|
||||
FAssets.icons.circleCheck,
|
||||
color: Colors.green,
|
||||
size: theme.typography.xl2.fontSize,
|
||||
).offstage(
|
||||
offstage: !isSelect,
|
||||
),
|
||||
]
|
||||
.toRow()
|
||||
.padding(
|
||||
vertical: 15.h,
|
||||
horizontal: 20.w,
|
||||
)
|
||||
.decorated(
|
||||
color: !isSelect ? theme.colorScheme.background : _successColor,
|
||||
border: Border.all(
|
||||
color: theme.colorScheme.primary,
|
||||
width: 1,
|
||||
),
|
||||
borderRadius: theme.style.borderRadius / 2,
|
||||
)
|
||||
.onTap(() => onChange(v));
|
||||
})
|
||||
.toList()
|
||||
.toColumnSpace(space: 10.w)
|
||||
.padding(
|
||||
vertical: 10.h,
|
||||
horizontal: 10.w,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// list.add(
|
||||
// ServiceWallet(
|
||||
// id: "1",
|
||||
// walletTypeUniqueCode: "1",
|
||||
// userId: "1",
|
||||
// walletTypeId: "1",
|
||||
// balance: 100,
|
||||
// ),
|
||||
// );
|
||||
// list.add(
|
||||
// ServiceWallet(
|
||||
// id: "2",
|
||||
// walletTypeUniqueCode: "2",
|
||||
// userId: "2",
|
||||
// walletTypeId: "2",
|
||||
// balance: 200,
|
||||
// ),
|
||||
// );
|
||||
Reference in new issue
Block a user