feat: 新增设备绑定、扫码与联系人管理功能
This commit is contained in:
@@ -77,8 +77,8 @@ class ProfileTab extends ConsumerWidget {
|
||||
),
|
||||
),
|
||||
|
||||
SectionTitle(l10n.deviceBound),
|
||||
_deviceListCard(ref, l10n),
|
||||
SectionTitle(l10n.deviceBound, action: l10n.deviceManage),
|
||||
_deviceListCard(context, ref, l10n),
|
||||
|
||||
SectionTitle(l10n.profileInfo),
|
||||
CardBox(
|
||||
@@ -103,7 +103,8 @@ class ProfileTab extends ConsumerWidget {
|
||||
const AppDivider(),
|
||||
_settingRow('🔒', const Color(0xFF22C55E), l10n.setPrivacy, '定位、相册、权限管理'),
|
||||
const AppDivider(),
|
||||
_settingRow('🛡️', AppColors.red, l10n.setSecurity, '登录设备、密码'),
|
||||
_settingRow('🛡️', AppColors.red, l10n.setSecurity, '登录设备、密码',
|
||||
onTap: () => context.push('/security')),
|
||||
const AppDivider(),
|
||||
_settingRow('❓', AppColors.gray, l10n.setHelp, null),
|
||||
const AppDivider(),
|
||||
@@ -139,7 +140,8 @@ class ProfileTab extends ConsumerWidget {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _deviceListCard(WidgetRef ref, AppLocalizations l10n) {
|
||||
Widget _deviceListCard(
|
||||
BuildContext context, WidgetRef ref, AppLocalizations l10n) {
|
||||
final devicesAsync = ref.watch(myDevicesProvider);
|
||||
return CardBox(
|
||||
padding: EdgeInsets.zero,
|
||||
@@ -160,17 +162,34 @@ class ProfileTab extends ConsumerWidget {
|
||||
),
|
||||
data: (devices) {
|
||||
if (devices.isEmpty) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: Text(l10n.deviceNone,
|
||||
style: const TextStyle(fontSize: 13, color: AppColors.sub)),
|
||||
// 无绑定设备时也可点击进入设备管理页添加设备。
|
||||
return GestureDetector(
|
||||
behavior: HitTestBehavior.opaque,
|
||||
onTap: () => context.push('/device/manage'),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text(l10n.deviceNone,
|
||||
style: const TextStyle(fontSize: 13, color: AppColors.sub)),
|
||||
),
|
||||
Text('${l10n.deviceManageAdd} ›',
|
||||
style: const TextStyle(fontSize: 13, color: AppColors.green)),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
return Column(
|
||||
children: [
|
||||
for (var i = 0; i < devices.length; i++) ...[
|
||||
if (i > 0) const AppDivider(),
|
||||
_deviceCard(devices[i], l10n),
|
||||
GestureDetector(
|
||||
behavior: HitTestBehavior.opaque,
|
||||
onTap: () => context.push('/device/manage'),
|
||||
child: _deviceCard(devices[i], l10n),
|
||||
),
|
||||
],
|
||||
],
|
||||
);
|
||||
@@ -238,7 +257,9 @@ class ProfileTab extends ConsumerWidget {
|
||||
),
|
||||
);
|
||||
|
||||
Widget _settingRow(String emoji, Color color, String label, String? sub) => Padding(
|
||||
Widget _settingRow(String emoji, Color color, String label, String? sub,
|
||||
{VoidCallback? onTap}) {
|
||||
final row = Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 13),
|
||||
child: Row(
|
||||
children: [
|
||||
@@ -265,4 +286,11 @@ class ProfileTab extends ConsumerWidget {
|
||||
],
|
||||
),
|
||||
);
|
||||
if (onTap == null) return row;
|
||||
return GestureDetector(
|
||||
behavior: HitTestBehavior.opaque,
|
||||
onTap: onTap,
|
||||
child: row,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user