Files
biz_xfj_cloud/lib/common/widgets/user/user_info.dart
T

60 lines
1.6 KiB
Dart

import 'package:common_utils/common_utils.dart';
import 'package:ducafe_ui_core/ducafe_ui_core.dart';
import 'package:flutter/widgets.dart';
import 'package:forui/forui.dart';
import 'package:pj_supermarket_cloud/common/index.dart';
Widget appUserInfo(
BuildContext context, {
dynamic username = "未知",
dynamic balance = "未知",
String? avatar = "",
bool visibleMoney = true,
}) {
if (ObjectUtil.isEmpty(username)) {
username = "未知";
}
if (ObjectUtil.isEmpty(balance)) {
balance = "未知";
}
if (ObjectUtil.isEmpty(avatar)) {
avatar = "";
}
final theme = FTheme.of(context);
final style = theme.typography.lg;
return <Widget>[
ObjectUtil.isNotEmpty(avatar)
? appImg(avatar).width(80.w).height(80.w)
: Image.asset(
AssetsImages.defaultAvatar,
fit: BoxFit.cover,
width: 80.w,
height: 80.w,
),
SizedBox(width: 10.w),
<Widget>[
Text("姓名:$username", style: style),
<Widget>[
Text("余额:", style: style),
appPrice(context, balance),
].toRow().offstage(offstage: !visibleMoney),
].toColumn(crossAxisAlignment: CrossAxisAlignment.start),
<Widget>[
FButton(
label: Text(
"识别",
style: theme.typography.base.copyWith(
color: theme.colorScheme.primary,
),
),
style: FButtonStyle.outline,
onPress: () {},
).width(100.w).height(50.w).offstage(offstage: true),
].toColumn(),
]
.toRow(
mainAxisAlignment: MainAxisAlignment.center,
)
.width(double.infinity);
}