feat:封装appEmpty组建
This commit is contained in:
1 parent
14067d973b
commit
74af303915
7 files changed
+79
-60
No files matched your search
@@ -0,0 +1,41 @@
|
||||
import 'package:ducafe_ui_core/ducafe_ui_core.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:forui/forui.dart';
|
||||
|
||||
Widget appEmpty(
|
||||
BuildContext context, {
|
||||
bool loading = false,
|
||||
String loadingText = "正在识别中",
|
||||
SvgAsset? emptyIcon,
|
||||
String emptyText = "请让用户放置饭卡",
|
||||
}) {
|
||||
final theme = FTheme.of(context);
|
||||
emptyIcon ??= FAssets.icons.idCard;
|
||||
if (loading) {
|
||||
return <Widget>[
|
||||
CircularProgressIndicator(
|
||||
color: theme.colorScheme.primary,
|
||||
).width(100.w).height(100.w).center(),
|
||||
SizedBox(height: 10.h),
|
||||
Text(
|
||||
loadingText,
|
||||
style: theme.typography.base.copyWith(
|
||||
color: theme.colorScheme.primary,
|
||||
),
|
||||
),
|
||||
].toColumn(mainAxisAlignment: MainAxisAlignment.center);
|
||||
}
|
||||
return <Widget>[
|
||||
FIcon(
|
||||
emptyIcon,
|
||||
size: theme.typography.xl4.fontSize,
|
||||
),
|
||||
SizedBox(height: 10.h),
|
||||
Text(
|
||||
emptyText,
|
||||
style: theme.typography.base.copyWith(
|
||||
color: theme.colorScheme.primary,
|
||||
),
|
||||
),
|
||||
].toColumn(mainAxisAlignment: MainAxisAlignment.center);
|
||||
}
|
||||
@@ -5,40 +5,6 @@ import 'package:get/get.dart';
|
||||
|
||||
import 'package:pj_supermarket_cloud/common/index.dart';
|
||||
|
||||
Widget readCardEmpty(
|
||||
BuildContext context, {
|
||||
required bool loading,
|
||||
}) {
|
||||
final theme = FTheme.of(context);
|
||||
if (loading) {
|
||||
return <Widget>[
|
||||
CircularProgressIndicator(
|
||||
color: theme.colorScheme.primary,
|
||||
).width(100.w).height(100.w).center(),
|
||||
SizedBox(height: 10.h),
|
||||
Text(
|
||||
"扫描中",
|
||||
style: theme.typography.base.copyWith(
|
||||
color: theme.colorScheme.primary,
|
||||
),
|
||||
),
|
||||
].toColumn(mainAxisAlignment: MainAxisAlignment.center);
|
||||
}
|
||||
return <Widget>[
|
||||
FIcon(
|
||||
FAssets.icons.idCard,
|
||||
size: theme.typography.xl4.fontSize,
|
||||
),
|
||||
SizedBox(height: 10.h),
|
||||
Text(
|
||||
"请让用户放置饭卡",
|
||||
style: theme.typography.base.copyWith(
|
||||
color: theme.colorScheme.primary,
|
||||
),
|
||||
),
|
||||
].toColumn(mainAxisAlignment: MainAxisAlignment.center);
|
||||
}
|
||||
|
||||
Future<void> cardDialog({
|
||||
required String title,
|
||||
required Rx<bool> loading,
|
||||
@@ -87,9 +53,12 @@ Future<void> cardDialog({
|
||||
].toColumn(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
),
|
||||
child: readCardEmpty(
|
||||
child: appEmpty(
|
||||
context,
|
||||
loading: loading.value,
|
||||
loadingText: "扫描中",
|
||||
emptyText: "请让用户放置饭卡",
|
||||
emptyIcon: FAssets.icons.idCard,
|
||||
),
|
||||
),
|
||||
).width(width * 0.5).height(height * 0.5),
|
||||
|
||||
@@ -6,6 +6,7 @@ export './app/app_back.dart';
|
||||
export './app/app_check_pay_type_dialog.dart';
|
||||
export './app/app_date_picker.dart';
|
||||
export './app/app_divider_title.dart';
|
||||
export './app/app_empty.dart';
|
||||
export './app/app_icon.dart';
|
||||
export './app/app_img.dart';
|
||||
export './app/app_logo.dart';
|
||||
|
||||
@@ -75,6 +75,7 @@ mixin OrderMixin {
|
||||
Future? putOffSendSubScreenDelayed;
|
||||
|
||||
/// **************** start 更新属性 start ****************
|
||||
|
||||
set sysType(SysType type) {
|
||||
_sysType = type;
|
||||
sendSubScreenType();
|
||||
|
||||
@@ -388,8 +388,8 @@ class SelectPayTypeDialogController extends GetxController {
|
||||
logger.e("|$_tag|人脸识别,意外的错误error:|$e|task:|$task|");
|
||||
Toast.error(msg: "识别人脸错误,请重试");
|
||||
} finally {
|
||||
_faceCallbackLock = false;
|
||||
EasyLoading.dismiss();
|
||||
_faceCallbackLock = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -398,8 +398,8 @@ class SelectPayTypeDialogController extends GetxController {
|
||||
final getChannel = FaceDiscernPlugs.getChannel;
|
||||
getChannel.setMethodCallHandler((call) async {
|
||||
if (call.method == "faceDiscernBack") {
|
||||
EasyLoading.dismiss();
|
||||
SubScreenPlugin.doubleScreenShow();
|
||||
EasyLoading.dismiss();
|
||||
}
|
||||
if (call.method == "faceDiscernPageInit") {
|
||||
EasyLoading.dismiss();
|
||||
@@ -424,12 +424,13 @@ class SelectPayTypeDialogController extends GetxController {
|
||||
|
||||
Future<void> selectPayTypeDialog() async {
|
||||
final payTypeC = Get.find<SelectPayTypeDialogController>();
|
||||
final context = Get.context!;
|
||||
payTypeC.initPayType();
|
||||
final theme = FTheme.of(Get.context!);
|
||||
final width = Get.context!.width;
|
||||
final height = Get.context!.height;
|
||||
return showDialog(
|
||||
context: Get.context!,
|
||||
context: context,
|
||||
barrierDismissible: false,
|
||||
builder: (BuildContext _) {
|
||||
return PopScope(
|
||||
@@ -472,7 +473,11 @@ Future<void> selectPayTypeDialog() async {
|
||||
() => Visibility(
|
||||
visible: payTypeC.payUser.value == null,
|
||||
replacement: selectPayTypeUser(payTypeC.payUser.value),
|
||||
child: selectPayTypeHint(payTypeC.orderPayDisplayType.value),
|
||||
child: selectPayTypeHint(
|
||||
context,
|
||||
type: payTypeC.orderPayDisplayType.value,
|
||||
isLoading: payTypeC.isRecognition.value,
|
||||
),
|
||||
),
|
||||
).center().expanded(),
|
||||
].toColumn().width(width * 0.5).height(height * 0.6),
|
||||
@@ -486,13 +491,15 @@ Future<void> selectPayTypeDialog() async {
|
||||
color: theme.colorScheme.secondary,
|
||||
),
|
||||
),
|
||||
onPress: () {
|
||||
if (payTypeC.payUser.value == null) {
|
||||
payTypeC.doRecognition();
|
||||
} else {
|
||||
payTypeC.doSubmit();
|
||||
}
|
||||
},
|
||||
onPress: payTypeC.isRecognition.value
|
||||
? null
|
||||
: () {
|
||||
if (payTypeC.payUser.value == null) {
|
||||
payTypeC.doRecognition();
|
||||
} else {
|
||||
payTypeC.doSubmit();
|
||||
}
|
||||
},
|
||||
),
|
||||
).flexible(flex: 1),
|
||||
SizedBox(width: 20.w),
|
||||
@@ -562,7 +569,11 @@ Widget selectPayTypeUser(ServiceUser? user) {
|
||||
.height(double.infinity);
|
||||
}
|
||||
|
||||
Widget selectPayTypeHint(OrderPayDisplayType? type) {
|
||||
Widget selectPayTypeHint(
|
||||
BuildContext context, {
|
||||
OrderPayDisplayType? type,
|
||||
bool isLoading = false,
|
||||
}) {
|
||||
final theme = FTheme.of(Get.context!);
|
||||
if (type == null) return const SizedBox.shrink();
|
||||
const baseMsg = "请点击开始识别按钮";
|
||||
@@ -586,17 +597,11 @@ Widget selectPayTypeHint(OrderPayDisplayType? type) {
|
||||
icon = FAssets.icons.circleDollarSign;
|
||||
break;
|
||||
}
|
||||
return <Widget>[
|
||||
FIcon(
|
||||
icon,
|
||||
size: theme.typography.xl4.fontSize,
|
||||
),
|
||||
SizedBox(height: 10.h),
|
||||
Text(
|
||||
msg,
|
||||
style: theme.typography.lg,
|
||||
),
|
||||
]
|
||||
.toColumn(mainAxisAlignment: MainAxisAlignment.center)
|
||||
.height(double.infinity);
|
||||
return appEmpty(
|
||||
context,
|
||||
loading: isLoading,
|
||||
loadingText: "识别中",
|
||||
emptyText: msg,
|
||||
emptyIcon: icon,
|
||||
).height(double.infinity);
|
||||
}
|
||||
@@ -53,6 +53,7 @@ class CanteenProductController extends GetxController with OrderMixin {
|
||||
);
|
||||
appSetting = await AppSettingTool.getSysSetting();
|
||||
// 打开副屏
|
||||
SubScreenPlugin.doubleScreenShow();
|
||||
SubScreenPlugin.sendMsgToViceScreen(SubScreenAction.jumpSubPage.name);
|
||||
// 组件初始化
|
||||
hourType.value = appSetting.hourType ?? ProductHourType.MORNING;
|
||||
|
||||
@@ -57,6 +57,7 @@ class SupermarketOrderController extends GetxController with OrderMixin {
|
||||
);
|
||||
appSetting = await AppSettingTool.getSysSetting();
|
||||
// 打开副屏
|
||||
SubScreenPlugin.doubleScreenShow();
|
||||
SubScreenPlugin.sendMsgToViceScreen(SubScreenAction.jumpSubPage.name);
|
||||
// 组件初始化
|
||||
hourType.value = ProductHourType.TOTAL;
|
||||
|
||||
Reference in new issue
Block a user