feat:适配多租户

This commit is contained in:
dzc committed 2025-04-22 15:15:46 +08:00
1 parent cdbb69f843
commit b370be9111
13 files changed
+175 -8

No files matched your search

@@ -0,0 +1,50 @@
import 'package:common_utils/common_utils.dart';
import 'package:flutter/material.dart';
import 'package:forui/forui.dart';
import 'package:pj_supermarket_cloud/common/index.dart';
Widget appTenantDialog(
BuildContext context,
FRadioSelectGroupController<String> controller, {
required List<ServiceTenant> list,
}) {
final theme = FTheme.of(context);
final selectList = list.where((v) => ObjectUtil.isNotEmpty(v.code));
return FSelectMenuTile<String>(
title: Text(
"单位",
style: theme.typography.base,
),
groupController: controller,
validator: (value) => value == null ? '请选择' : null,
autoHide: true,
prefixIcon: FIcon(
FAssets.icons.building2,
size: theme.typography.xl.fontSize,
),
menu: selectList.map((v) {
return FSelectTile(
title: Text(
v.name!,
style: theme.typography.base,
),
value: v.code!,
);
}).toList(),
details: ListenableBuilder(
listenable: controller,
builder: (context, _) {
final v = controller.value.firstOrNull;
if (v == null) return const SizedBox();
final target = selectList.firstWhere((i) => i.code == v);
return Text(
target.name!,
style: theme.typography.base.copyWith(
color: theme.colorScheme.primary,
),
);
},
),
);
}