fix:我的和设置列表
This commit is contained in:
@@ -16,10 +16,12 @@ import '../../../common/theme/theme_controller.dart';
|
||||
import '../../../common/widgets/adaptive.dart';
|
||||
import '../../../common/widgets/app_toast.dart';
|
||||
import '../../../common/widgets/circle_back_button.dart';
|
||||
import '../../../common/widgets/prototype_ui.dart';
|
||||
import '../../auth/application/auth_controller.dart';
|
||||
import '../../auth/data/auth_models.dart';
|
||||
import '../../profile/application/profile_settings_controller.dart';
|
||||
import '../../profile/data/profile_models.dart';
|
||||
import '../../profile/presentation/profile_page.dart';
|
||||
|
||||
class SettingsPage extends HookConsumerWidget {
|
||||
const SettingsPage({super.key});
|
||||
@@ -64,52 +66,57 @@ class SettingsPage extends HookConsumerWidget {
|
||||
|
||||
const SizedBox(height: 22),
|
||||
const _Section('资产参数'),
|
||||
_Card(
|
||||
children: [
|
||||
_SwitchRow(
|
||||
title: '隐藏金额',
|
||||
subtitle: '在资产页和持仓列表中隐藏金额信息',
|
||||
value: profileSettings.amountHidden,
|
||||
onChanged: (_) => ref
|
||||
.read(profileSettingsControllerProvider.notifier)
|
||||
.toggleAmountHidden(),
|
||||
),
|
||||
Divider(height: 1, thickness: 1, color: cs.border),
|
||||
_NavRow(
|
||||
icon: FlutterRemix.line_chart_line,
|
||||
label: '涨跌颜色',
|
||||
trailing: profileSettings.priceColorMode.label,
|
||||
onTap: () => _showPriceColorSheet(context, ref),
|
||||
),
|
||||
Divider(height: 1, thickness: 1, color: cs.border),
|
||||
_NavRow(
|
||||
icon: FlutterRemix.coins_line,
|
||||
label: '纯度系数',
|
||||
trailing: '${profileSettings.purityPresets.length} 项',
|
||||
onTap: () => _showPuritySheet(context, profileSettings),
|
||||
),
|
||||
Divider(height: 1, thickness: 1, color: cs.border),
|
||||
_NavRow(
|
||||
icon: FlutterRemix.exchange_box_line,
|
||||
label: '回收折扣',
|
||||
trailing: '已设置',
|
||||
onTap: () => _showRecycleSheet(context, profileSettings),
|
||||
),
|
||||
],
|
||||
PrototypeCard(
|
||||
padding: EdgeInsets.zero,
|
||||
child: Column(
|
||||
children: [
|
||||
SettingRow(
|
||||
icon: Icons.palette_outlined,
|
||||
title: '涨跌颜色',
|
||||
trailing: profileSettings.priceColorMode.label,
|
||||
onTap: () {
|
||||
final nextMode =
|
||||
profileSettings.priceColorMode ==
|
||||
PriceColorMode.redUpGreenDown
|
||||
? PriceColorMode.greenUpRedDown
|
||||
: PriceColorMode.redUpGreenDown;
|
||||
ref
|
||||
.read(profileSettingsControllerProvider.notifier)
|
||||
.setPriceColorMode(nextMode);
|
||||
toastInfo(msg: '已切换为「${nextMode.label}」');
|
||||
},
|
||||
),
|
||||
const PrototypeDivider(margin: EdgeInsets.zero),
|
||||
SettingRow(
|
||||
icon: Icons.tune_outlined,
|
||||
title: '纯度系数管理',
|
||||
trailing: '${profileSettings.purityPresets.length} 项',
|
||||
onTap: () => context.push(AppRoutes.profilePurity),
|
||||
),
|
||||
const PrototypeDivider(margin: EdgeInsets.zero),
|
||||
SettingRow(
|
||||
icon: Icons.percent_outlined,
|
||||
title: '回收折扣设置',
|
||||
trailing:
|
||||
'金 ${(profileSettings.recycleDiscounts.values.first * 100).toStringAsFixed(0)}%',
|
||||
onTap: () => context.push(AppRoutes.profileRecycle),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
// const SizedBox(height: 22),
|
||||
// const _Section('备份'),
|
||||
// _Card(
|
||||
// children: [
|
||||
// _NavRow(
|
||||
// SettingRow(
|
||||
// icon: FlutterRemix.download_2_line,
|
||||
// label: '本地导出备份',
|
||||
// trailing: '导出',
|
||||
// onTap: () => _showLocalBackupSheet(context),
|
||||
// ),
|
||||
// Divider(height: 1, thickness: 1, color: cs.border),
|
||||
// _NavRow(
|
||||
// const PrototypeDivider(margin: EdgeInsets.zero),
|
||||
// SettingRow(
|
||||
// icon: FlutterRemix.cloud_line,
|
||||
// label: '云备份',
|
||||
// trailing: '占位',
|
||||
@@ -119,104 +126,116 @@ class SettingsPage extends HookConsumerWidget {
|
||||
// ),
|
||||
const SizedBox(height: 22),
|
||||
const _Section('工具'),
|
||||
_Card(
|
||||
children: [
|
||||
_NavRow(
|
||||
icon: FlutterRemix.layout_grid_line,
|
||||
label: '桌面小组件',
|
||||
trailing: '占位',
|
||||
onTap: () => _showWidgetSheet(context),
|
||||
),
|
||||
if (kDebugMode) ...[
|
||||
Divider(height: 1, thickness: 1, color: cs.border),
|
||||
_NavRow(
|
||||
icon: Icons.bug_report_outlined,
|
||||
label: '调试工具',
|
||||
onTap: () => context.push(AppRoutes.debug),
|
||||
PrototypeCard(
|
||||
padding: EdgeInsets.zero,
|
||||
child: Column(
|
||||
children: [
|
||||
SettingRow(
|
||||
icon: FlutterRemix.layout_grid_line,
|
||||
title: '桌面小组件',
|
||||
trailing: '占位',
|
||||
onTap: () => _showWidgetSheet(context),
|
||||
),
|
||||
if (kDebugMode) ...[
|
||||
const PrototypeDivider(margin: EdgeInsets.zero),
|
||||
SettingRow(
|
||||
icon: Icons.bug_report_outlined,
|
||||
title: '调试工具',
|
||||
onTap: () => context.push(AppRoutes.debug),
|
||||
),
|
||||
],
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
const SizedBox(height: 22),
|
||||
const _Section('法律'),
|
||||
_Card(
|
||||
children: [
|
||||
_NavRow(
|
||||
icon: FlutterRemix.file_list_3_line,
|
||||
label: '用户协议',
|
||||
onTap: () => launchUrlString(
|
||||
AppH5UrlsHelper.withCacheBuster(AppH5Urls.userProtocolUrl),
|
||||
mode: LaunchMode.inAppBrowserView,
|
||||
PrototypeCard(
|
||||
padding: EdgeInsets.zero,
|
||||
child: Column(
|
||||
children: [
|
||||
SettingRow(
|
||||
icon: FlutterRemix.file_list_3_line,
|
||||
title: '用户协议',
|
||||
onTap: () => launchUrlString(
|
||||
AppH5UrlsHelper.withCacheBuster(AppH5Urls.userProtocolUrl),
|
||||
mode: LaunchMode.inAppBrowserView,
|
||||
),
|
||||
),
|
||||
),
|
||||
Divider(height: 1, thickness: 1, color: cs.border),
|
||||
_NavRow(
|
||||
icon: FlutterRemix.shield_check_line,
|
||||
label: '隐私政策',
|
||||
onTap: () => launchUrlString(
|
||||
AppH5UrlsHelper.withCacheBuster(AppH5Urls.privacyUrl),
|
||||
mode: LaunchMode.inAppBrowserView,
|
||||
const PrototypeDivider(margin: EdgeInsets.zero),
|
||||
SettingRow(
|
||||
icon: FlutterRemix.shield_check_line,
|
||||
title: '隐私政策',
|
||||
onTap: () => launchUrlString(
|
||||
AppH5UrlsHelper.withCacheBuster(AppH5Urls.privacyUrl),
|
||||
mode: LaunchMode.inAppBrowserView,
|
||||
),
|
||||
),
|
||||
),
|
||||
Divider(height: 1, thickness: 1, color: cs.border),
|
||||
_NavRow(
|
||||
icon: FlutterRemix.alert_line,
|
||||
label: '免责声明',
|
||||
onTap: () => _showDisclaimerSheet(context),
|
||||
),
|
||||
],
|
||||
const PrototypeDivider(margin: EdgeInsets.zero),
|
||||
SettingRow(
|
||||
icon: FlutterRemix.alert_line,
|
||||
title: '免责声明',
|
||||
onTap: () => _showDisclaimerSheet(context),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
if (loggedIn) ...[
|
||||
const SizedBox(height: 22),
|
||||
const _Section('账户'),
|
||||
_Card(
|
||||
children: [
|
||||
_NavRow(
|
||||
icon: FlutterRemix.logout_box_r_line,
|
||||
label: '退出登录',
|
||||
onTap: () => _confirmLogout(context, ref),
|
||||
),
|
||||
Divider(height: 1, thickness: 1, color: cs.border),
|
||||
_NavRow(
|
||||
icon: FlutterRemix.delete_bin_line,
|
||||
label: '注销账号',
|
||||
destructive: true,
|
||||
onTap: () => context.push(AppRoutes.deleteAccount),
|
||||
),
|
||||
],
|
||||
PrototypeCard(
|
||||
padding: EdgeInsets.zero,
|
||||
child: Column(
|
||||
children: [
|
||||
SettingRow(
|
||||
icon: FlutterRemix.logout_box_r_line,
|
||||
title: '退出登录',
|
||||
onTap: () => _confirmLogout(context, ref),
|
||||
),
|
||||
const PrototypeDivider(margin: EdgeInsets.zero),
|
||||
SettingRow(
|
||||
icon: FlutterRemix.delete_bin_line,
|
||||
title: '注销账号',
|
||||
destructive: true,
|
||||
onTap: () => context.push(AppRoutes.deleteAccount),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
const SizedBox(height: 22),
|
||||
const _Section('关于'),
|
||||
_Card(
|
||||
children: [
|
||||
const _AboutRow(),
|
||||
Divider(height: 1, thickness: 1, color: cs.border),
|
||||
_NavRow(
|
||||
icon: FlutterRemix.mail_line,
|
||||
label: '联系我们',
|
||||
trailing: 'business@hnsiderui.cn',
|
||||
onTap: () {
|
||||
final now = DateTime.now();
|
||||
final lastTapAt = contactLastTapAt.value;
|
||||
if (lastTapAt == null ||
|
||||
now.difference(lastTapAt) >
|
||||
const Duration(milliseconds: 500)) {
|
||||
contactDebugTapCount.value = 0;
|
||||
}
|
||||
contactLastTapAt.value = now;
|
||||
contactDebugTapCount.value += 1;
|
||||
if (contactDebugTapCount.value >= 10) {
|
||||
contactDebugTapCount.value = 0;
|
||||
contactLastTapAt.value = null;
|
||||
context.push(AppRoutes.debug);
|
||||
}
|
||||
},
|
||||
),
|
||||
],
|
||||
PrototypeCard(
|
||||
padding: EdgeInsets.zero,
|
||||
child: Column(
|
||||
children: [
|
||||
const _AboutRow(),
|
||||
const PrototypeDivider(margin: EdgeInsets.zero),
|
||||
SettingRow(
|
||||
icon: FlutterRemix.mail_line,
|
||||
title: '联系我们',
|
||||
trailing: 'business@hnsiderui.cn',
|
||||
onTap: () {
|
||||
final now = DateTime.now();
|
||||
final lastTapAt = contactLastTapAt.value;
|
||||
if (lastTapAt == null ||
|
||||
now.difference(lastTapAt) >
|
||||
const Duration(milliseconds: 500)) {
|
||||
contactDebugTapCount.value = 0;
|
||||
}
|
||||
contactLastTapAt.value = now;
|
||||
contactDebugTapCount.value += 1;
|
||||
if (contactDebugTapCount.value >= 10) {
|
||||
contactDebugTapCount.value = 0;
|
||||
contactLastTapAt.value = null;
|
||||
context.push(AppRoutes.debug);
|
||||
}
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 14),
|
||||
_RiskFooter(cs: cs),
|
||||
@@ -289,325 +308,6 @@ class SettingsPage extends HookConsumerWidget {
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _showPriceColorSheet(BuildContext context, WidgetRef ref) async {
|
||||
final cs = ShadTheme.of(context).colorScheme;
|
||||
final current = ref.read(profileSettingsControllerProvider).priceColorMode;
|
||||
final selected = await showModalBottomSheet<PriceColorMode>(
|
||||
context: context,
|
||||
backgroundColor: cs.card,
|
||||
barrierColor: Colors.black.withValues(alpha: 0.5),
|
||||
shape: const RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.vertical(
|
||||
top: Radius.circular(Spacing.radiusCard),
|
||||
),
|
||||
),
|
||||
builder: (ctx) => SafeArea(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.fromLTRB(20, 8, 20, 20),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Center(
|
||||
child: Container(
|
||||
width: 38,
|
||||
height: 4,
|
||||
margin: const EdgeInsets.only(bottom: 16),
|
||||
decoration: BoxDecoration(
|
||||
color: cs.border,
|
||||
borderRadius: BorderRadius.circular(9999),
|
||||
),
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'涨跌颜色',
|
||||
style: TextStyle(
|
||||
fontSize: 19,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: cs.foreground,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
'选择行情上涨和下跌的配色方案。',
|
||||
style: TextStyle(fontSize: 13, color: cs.mutedForeground),
|
||||
),
|
||||
const SizedBox(height: 18),
|
||||
_ChoiceButton(
|
||||
label: PriceColorMode.redUpGreenDown.label,
|
||||
selected: current == PriceColorMode.redUpGreenDown,
|
||||
onTap: () =>
|
||||
Navigator.of(ctx).pop(PriceColorMode.redUpGreenDown),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
_ChoiceButton(
|
||||
label: PriceColorMode.greenUpRedDown.label,
|
||||
selected: current == PriceColorMode.greenUpRedDown,
|
||||
onTap: () =>
|
||||
Navigator.of(ctx).pop(PriceColorMode.greenUpRedDown),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
if (selected != null && context.mounted) {
|
||||
ref
|
||||
.read(profileSettingsControllerProvider.notifier)
|
||||
.setPriceColorMode(selected);
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _showPuritySheet(
|
||||
BuildContext context,
|
||||
ProfileSettings settings,
|
||||
) async {
|
||||
final cs = ShadTheme.of(context).colorScheme;
|
||||
await showModalBottomSheet<void>(
|
||||
context: context,
|
||||
backgroundColor: cs.card,
|
||||
barrierColor: Colors.black.withValues(alpha: 0.5),
|
||||
shape: const RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.vertical(
|
||||
top: Radius.circular(Spacing.radiusCard),
|
||||
),
|
||||
),
|
||||
builder: (ctx) => SafeArea(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.fromLTRB(20, 8, 20, 20),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Center(
|
||||
child: Container(
|
||||
width: 38,
|
||||
height: 4,
|
||||
margin: const EdgeInsets.only(bottom: 16),
|
||||
decoration: BoxDecoration(
|
||||
color: cs.border,
|
||||
borderRadius: BorderRadius.circular(9999),
|
||||
),
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'纯度系数',
|
||||
style: TextStyle(
|
||||
fontSize: 19,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: cs.foreground,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
'用于估值换算的本地纯度预设。',
|
||||
style: TextStyle(fontSize: 13, color: cs.mutedForeground),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
for (final entry in settings.purityPresets.entries) ...[
|
||||
_ValueRow(
|
||||
label: entry.key,
|
||||
value: '${(entry.value * 100).toStringAsFixed(2)}%',
|
||||
),
|
||||
if (entry.key != settings.purityPresets.keys.last) ...[
|
||||
const SizedBox(height: 10),
|
||||
],
|
||||
],
|
||||
const SizedBox(height: 18),
|
||||
_SheetPrimaryButton(
|
||||
label: '知道了',
|
||||
onTap: () => Navigator.of(ctx).pop(),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> _showRecycleSheet(
|
||||
BuildContext context,
|
||||
ProfileSettings settings,
|
||||
) async {
|
||||
final cs = ShadTheme.of(context).colorScheme;
|
||||
await showModalBottomSheet<void>(
|
||||
context: context,
|
||||
backgroundColor: cs.card,
|
||||
barrierColor: Colors.black.withValues(alpha: 0.5),
|
||||
shape: const RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.vertical(
|
||||
top: Radius.circular(Spacing.radiusCard),
|
||||
),
|
||||
),
|
||||
builder: (ctx) => SafeArea(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.fromLTRB(20, 8, 20, 20),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Center(
|
||||
child: Container(
|
||||
width: 38,
|
||||
height: 4,
|
||||
margin: const EdgeInsets.only(bottom: 16),
|
||||
decoration: BoxDecoration(
|
||||
color: cs.border,
|
||||
borderRadius: BorderRadius.circular(9999),
|
||||
),
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'回收折扣',
|
||||
style: TextStyle(
|
||||
fontSize: 19,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: cs.foreground,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
'用于计算金、铂、银的回收参考值。',
|
||||
style: TextStyle(fontSize: 13, color: cs.mutedForeground),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
for (final entry in settings.recycleDiscounts.entries) ...[
|
||||
_ValueRow(
|
||||
label: entry.key.label,
|
||||
value: '${(entry.value * 100).toStringAsFixed(0)}%',
|
||||
),
|
||||
if (entry.key != settings.recycleDiscounts.keys.last) ...[
|
||||
const SizedBox(height: 10),
|
||||
],
|
||||
],
|
||||
const SizedBox(height: 18),
|
||||
_SheetPrimaryButton(
|
||||
label: '知道了',
|
||||
onTap: () => Navigator.of(ctx).pop(),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> _showLocalBackupSheet(BuildContext context) async {
|
||||
final cs = ShadTheme.of(context).colorScheme;
|
||||
final ok = await showModalBottomSheet<bool>(
|
||||
context: context,
|
||||
backgroundColor: cs.card,
|
||||
barrierColor: Colors.black.withValues(alpha: 0.5),
|
||||
shape: const RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.vertical(
|
||||
top: Radius.circular(Spacing.radiusCard),
|
||||
),
|
||||
),
|
||||
builder: (ctx) => SafeArea(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.fromLTRB(20, 8, 20, 20),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Center(
|
||||
child: Container(
|
||||
width: 38,
|
||||
height: 4,
|
||||
margin: const EdgeInsets.only(bottom: 16),
|
||||
decoration: BoxDecoration(
|
||||
color: cs.border,
|
||||
borderRadius: BorderRadius.circular(9999),
|
||||
),
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'本地导出备份',
|
||||
style: TextStyle(
|
||||
fontSize: 19,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: cs.foreground,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
'将当前持仓、偏好设置和 mock 账号状态导出到本地文件。',
|
||||
style: TextStyle(fontSize: 13, color: cs.mutedForeground),
|
||||
),
|
||||
const SizedBox(height: 18),
|
||||
_SheetPrimaryButton(
|
||||
label: '导出备份',
|
||||
onTap: () => Navigator.of(ctx).pop(true),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
_SheetSecondaryButton(
|
||||
label: '取消',
|
||||
onTap: () => Navigator.of(ctx).pop(false),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
if (ok == true && context.mounted) {
|
||||
toastInfo(msg: '已导出本地备份(mock)');
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _showCloudBackupSheet(BuildContext context) async {
|
||||
final cs = ShadTheme.of(context).colorScheme;
|
||||
await showModalBottomSheet<void>(
|
||||
context: context,
|
||||
backgroundColor: cs.card,
|
||||
barrierColor: Colors.black.withValues(alpha: 0.5),
|
||||
shape: const RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.vertical(
|
||||
top: Radius.circular(Spacing.radiusCard),
|
||||
),
|
||||
),
|
||||
builder: (ctx) => SafeArea(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.fromLTRB(20, 8, 20, 20),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Center(
|
||||
child: Container(
|
||||
width: 38,
|
||||
height: 4,
|
||||
margin: const EdgeInsets.only(bottom: 16),
|
||||
decoration: BoxDecoration(
|
||||
color: cs.border,
|
||||
borderRadius: BorderRadius.circular(9999),
|
||||
),
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'云备份',
|
||||
style: TextStyle(
|
||||
fontSize: 19,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: cs.foreground,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
'后续会接入云同步与多端恢复,这里先保留入口。',
|
||||
style: TextStyle(fontSize: 13, color: cs.mutedForeground),
|
||||
),
|
||||
const SizedBox(height: 18),
|
||||
_SheetPrimaryButton(
|
||||
label: '知道了',
|
||||
onTap: () => Navigator.of(ctx).pop(),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> _showWidgetSheet(BuildContext context) async {
|
||||
final cs = ShadTheme.of(context).colorScheme;
|
||||
await showModalBottomSheet<void>(
|
||||
@@ -743,32 +443,6 @@ class _Section extends StatelessWidget {
|
||||
}
|
||||
}
|
||||
|
||||
class _Card extends StatelessWidget {
|
||||
const _Card({required this.children});
|
||||
|
||||
final List<Widget> children;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final cs = ShadTheme.of(context).colorScheme;
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
color: cs.card,
|
||||
border: Border.all(color: cs.border),
|
||||
borderRadius: BorderRadius.circular(Spacing.radiusCard),
|
||||
),
|
||||
clipBehavior: Clip.antiAlias,
|
||||
child: Column(
|
||||
children: [
|
||||
for (var i = 0; i < children.length; i++) ...[
|
||||
if (i > 0) Divider(height: 1, thickness: 1, color: cs.border),
|
||||
children[i],
|
||||
],
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _ThemeSegmentCard extends StatelessWidget {
|
||||
const _ThemeSegmentCard({required this.themeMode, required this.onChanged});
|
||||
@@ -874,117 +548,56 @@ class _ThemeSegmentButton extends StatelessWidget {
|
||||
}
|
||||
}
|
||||
|
||||
class _SwitchRow extends StatelessWidget {
|
||||
const _SwitchRow({
|
||||
required this.title,
|
||||
required this.subtitle,
|
||||
required this.value,
|
||||
required this.onChanged,
|
||||
});
|
||||
|
||||
final String title;
|
||||
final String subtitle;
|
||||
final bool value;
|
||||
final ValueChanged<bool> onChanged;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final cs = ShadTheme.of(context).colorScheme;
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 18),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
title,
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: cs.foreground,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 6),
|
||||
Text(
|
||||
subtitle,
|
||||
style: AppText.meta.copyWith(
|
||||
fontSize: 13,
|
||||
color: cs.mutedForeground,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 16),
|
||||
ShadSwitch(
|
||||
value: value,
|
||||
onChanged: onChanged,
|
||||
checkedTrackColor: cs.primary,
|
||||
thumbColor: cs.background,
|
||||
width: 44,
|
||||
height: 26,
|
||||
margin: 2,
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _NavRow extends StatelessWidget {
|
||||
const _NavRow({
|
||||
required this.icon,
|
||||
required this.label,
|
||||
this.trailing,
|
||||
this.onTap,
|
||||
this.destructive = false,
|
||||
});
|
||||
|
||||
final IconData icon;
|
||||
final String label;
|
||||
final String? trailing;
|
||||
final VoidCallback? onTap;
|
||||
final bool destructive;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final cs = ShadTheme.of(context).colorScheme;
|
||||
final color = destructive ? cs.destructive : cs.foreground;
|
||||
return GestureDetector(
|
||||
onTap: onTap,
|
||||
behavior: HitTestBehavior.opaque,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 15),
|
||||
child: Row(
|
||||
children: [
|
||||
SizedBox(width: 24, child: Icon(icon, size: 20, color: color)),
|
||||
const SizedBox(width: 13),
|
||||
Expanded(
|
||||
child: Text(label, style: TextStyle(fontSize: 15, color: color)),
|
||||
),
|
||||
if (trailing != null)
|
||||
Text(
|
||||
trailing!,
|
||||
style: AppText.meta.copyWith(
|
||||
fontSize: 13,
|
||||
color: cs.mutedForeground,
|
||||
),
|
||||
),
|
||||
if (onTap != null && trailing == null)
|
||||
Icon(
|
||||
FlutterRemix.arrow_right_s_line,
|
||||
size: 20,
|
||||
color: cs.mutedForeground,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
// class SettingRow extends StatelessWidget {
|
||||
// const SettingRow({
|
||||
// required this.icon,
|
||||
// required this.label,
|
||||
// this.trailing,
|
||||
// this.onTap,
|
||||
// this.destructive = false,
|
||||
// });
|
||||
//
|
||||
// final IconData icon;
|
||||
// final String label;
|
||||
// final String? trailing;
|
||||
// final VoidCallback? onTap;
|
||||
// final bool destructive;
|
||||
//
|
||||
// @override
|
||||
// Widget build(BuildContext context) {
|
||||
// final cs = ShadTheme.of(context).colorScheme;
|
||||
// final color = destructive ? cs.destructive : cs.foreground;
|
||||
// return InkWell(
|
||||
// onTap: onTap,
|
||||
// child: Padding(
|
||||
// padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 14),
|
||||
// child: Row(
|
||||
// children: [
|
||||
// Icon(icon, size: 20, color: const Color(0xFF8A8780)),
|
||||
// const SizedBox(width: 12),
|
||||
// Expanded(
|
||||
// child: Text(
|
||||
// label,
|
||||
// style: TextStyle(
|
||||
// fontSize: 14,
|
||||
// fontWeight: FontWeight.w600,
|
||||
// color: color,
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// if (trailing != null)
|
||||
// Text(
|
||||
// trailing!,
|
||||
// style: TextStyle(fontSize: 12, color: cs.mutedForeground),
|
||||
// ),
|
||||
// const SizedBox(width: 6),
|
||||
// Icon(Icons.chevron_right, size: 16, color: cs.mutedForeground),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
|
||||
class _AboutRow extends StatelessWidget {
|
||||
const _AboutRow();
|
||||
@@ -1058,45 +671,6 @@ class _RiskFooter extends StatelessWidget {
|
||||
}
|
||||
}
|
||||
|
||||
class _ChoiceButton extends StatelessWidget {
|
||||
const _ChoiceButton({
|
||||
required this.label,
|
||||
required this.selected,
|
||||
required this.onTap,
|
||||
});
|
||||
|
||||
final String label;
|
||||
final bool selected;
|
||||
final VoidCallback onTap;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final cs = ShadTheme.of(context).colorScheme;
|
||||
return GestureDetector(
|
||||
onTap: onTap,
|
||||
behavior: HitTestBehavior.opaque,
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
height: 52,
|
||||
alignment: Alignment.center,
|
||||
decoration: BoxDecoration(
|
||||
color: selected ? cs.primary : cs.secondary,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
border: Border.all(color: selected ? cs.primary : cs.border),
|
||||
),
|
||||
child: Text(
|
||||
label,
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: selected ? cs.primaryForeground : cs.foreground,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _SheetPrimaryButton extends StatelessWidget {
|
||||
const _SheetPrimaryButton({required this.label, required this.onTap});
|
||||
|
||||
@@ -1130,63 +704,6 @@ class _SheetPrimaryButton extends StatelessWidget {
|
||||
}
|
||||
}
|
||||
|
||||
class _SheetSecondaryButton extends StatelessWidget {
|
||||
const _SheetSecondaryButton({required this.label, required this.onTap});
|
||||
|
||||
final String label;
|
||||
final VoidCallback onTap;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final cs = ShadTheme.of(context).colorScheme;
|
||||
return GestureDetector(
|
||||
behavior: HitTestBehavior.opaque,
|
||||
onTap: onTap,
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
height: 52,
|
||||
alignment: Alignment.center,
|
||||
decoration: BoxDecoration(
|
||||
color: cs.secondary,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
border: Border.all(color: cs.border),
|
||||
),
|
||||
child: Text(
|
||||
label,
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: cs.foreground,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _ValueRow extends StatelessWidget {
|
||||
const _ValueRow({required this.label, required this.value});
|
||||
|
||||
final String label;
|
||||
final String value;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final cs = ShadTheme.of(context).colorScheme;
|
||||
return Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text(
|
||||
label,
|
||||
style: TextStyle(fontSize: 15, color: cs.foreground),
|
||||
),
|
||||
),
|
||||
Text(value, style: TextStyle(fontSize: 13, color: cs.mutedForeground)),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _LogoutSheetButton extends StatelessWidget {
|
||||
const _LogoutSheetButton({
|
||||
required this.label,
|
||||
|
||||
Reference in New Issue
Block a user