fix:我的和设置列表

This commit is contained in:
jingyun
2026-06-22 16:54:55 +08:00
parent 3513fbac0f
commit 75ba309e8c
2 changed files with 203 additions and 681 deletions
@@ -120,14 +120,14 @@ class ProfilePage extends ConsumerWidget {
// padding: EdgeInsets.zero, // padding: EdgeInsets.zero,
// child: Column( // child: Column(
// children: [ // children: [
// _SettingRow( // SettingRow(
// icon: Icons.download_outlined, // icon: Icons.download_outlined,
// title: '本地导出备份', // title: '本地导出备份',
// trailing: '导出', // trailing: '导出',
// onTap: () => _showLocalBackupSheet(context), // onTap: () => _showLocalBackupSheet(context),
// ), // ),
// const PrototypeDivider(margin: EdgeInsets.zero), // const PrototypeDivider(margin: EdgeInsets.zero),
// _SettingRow( // SettingRow(
// icon: Icons.cloud_outlined, // icon: Icons.cloud_outlined,
// title: '云备份 · 多端同步', // title: '云备份 · 多端同步',
// trailing: loggedIn ? '已登录' : '登录解锁', // trailing: loggedIn ? '已登录' : '登录解锁',
@@ -141,14 +141,14 @@ class ProfilePage extends ConsumerWidget {
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
child: Column( child: Column(
children: [ children: [
_SettingRow( SettingRow(
icon: Icons.tune_outlined, icon: Icons.tune_outlined,
title: '纯度系数管理', title: '纯度系数管理',
trailing: '${settings.purityPresets.length}', trailing: '${settings.purityPresets.length}',
onTap: () => _showPuritySheet(context, settings), onTap: () => _showPuritySheet(context, settings),
), ),
const PrototypeDivider(margin: EdgeInsets.zero), const PrototypeDivider(margin: EdgeInsets.zero),
_SettingRow( SettingRow(
icon: Icons.percent_outlined, icon: Icons.percent_outlined,
title: '回收折扣设置', title: '回收折扣设置',
trailing: trailing:
@@ -156,7 +156,7 @@ class ProfilePage extends ConsumerWidget {
onTap: () => _showRecycleSheet(context, settings), onTap: () => _showRecycleSheet(context, settings),
), ),
const PrototypeDivider(margin: EdgeInsets.zero), const PrototypeDivider(margin: EdgeInsets.zero),
_SettingRow( SettingRow(
icon: Icons.palette_outlined, icon: Icons.palette_outlined,
title: '涨跌颜色', title: '涨跌颜色',
trailing: settings.priceColorMode.label, trailing: settings.priceColorMode.label,
@@ -173,14 +173,14 @@ class ProfilePage extends ConsumerWidget {
}, },
), ),
const PrototypeDivider(margin: EdgeInsets.zero), const PrototypeDivider(margin: EdgeInsets.zero),
_SettingRow( SettingRow(
icon: Icons.currency_yen_outlined, icon: Icons.currency_yen_outlined,
title: '显示币种', title: '显示币种',
trailing: '¥ CNY', trailing: '¥ CNY',
onTap: () => _toast(context, '当前仅支持 ¥ CNY'), onTap: () => _toast(context, '当前仅支持 ¥ CNY'),
), ),
const PrototypeDivider(margin: EdgeInsets.zero), const PrototypeDivider(margin: EdgeInsets.zero),
_SettingRow( SettingRow(
icon: Icons.grid_view_outlined, icon: Icons.grid_view_outlined,
title: '添加桌面小组件', title: '添加桌面小组件',
trailing: '占位', trailing: '占位',
@@ -194,14 +194,14 @@ class ProfilePage extends ConsumerWidget {
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
child: Column( child: Column(
children: [ children: [
_SettingRow( SettingRow(
icon: Icons.settings, icon: Icons.settings,
title: '设置', title: '设置',
trailing: null, trailing: null,
onTap: () => context.push(AppRoutes.settings), onTap: () => context.push(AppRoutes.settings),
), ),
const PrototypeDivider(margin: EdgeInsets.zero), const PrototypeDivider(margin: EdgeInsets.zero),
_SettingRow( SettingRow(
icon: Icons.privacy_tip_outlined, icon: Icons.privacy_tip_outlined,
title: '隐私政策 · 用户协议', title: '隐私政策 · 用户协议',
trailing: null, trailing: null,
@@ -213,14 +213,14 @@ class ProfilePage extends ConsumerWidget {
), ),
), ),
const PrototypeDivider(margin: EdgeInsets.zero), const PrototypeDivider(margin: EdgeInsets.zero),
_SettingRow( SettingRow(
icon: Icons.info_outline, icon: Icons.info_outline,
title: '免责声明 · 数据来源', title: '免责声明 · 数据来源',
trailing: null, trailing: null,
onTap: () => _showDisclaimer(context), onTap: () => _showDisclaimer(context),
), ),
const PrototypeDivider(margin: EdgeInsets.zero), const PrototypeDivider(margin: EdgeInsets.zero),
_SettingRow( SettingRow(
icon: Icons.feedback_outlined, icon: Icons.feedback_outlined,
title: '意见反馈 · 关于金值', title: '意见反馈 · 关于金值',
trailing: null, trailing: null,
@@ -352,22 +352,26 @@ class _MenuRow extends StatelessWidget {
} }
} }
class _SettingRow extends StatelessWidget { class SettingRow extends StatelessWidget {
const _SettingRow({ const SettingRow({
required this.icon, required this.icon,
required this.title, required this.title,
required this.onTap, required this.onTap,
this.trailing, this.trailing,
this.destructive = false,
}); });
final IconData icon; final IconData icon;
final String title; final String title;
final String? trailing; final String? trailing;
final VoidCallback onTap; final VoidCallback onTap;
final bool destructive;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final cs = ShadTheme.of(context).colorScheme; final cs = ShadTheme.of(context).colorScheme;
final color = destructive ? cs.destructive : cs.foreground;
return InkWell( return InkWell(
onTap: onTap, onTap: onTap,
child: Padding( child: Padding(
@@ -379,9 +383,10 @@ class _SettingRow extends StatelessWidget {
Expanded( Expanded(
child: Text( child: Text(
title, title,
style: const TextStyle( style: TextStyle(
fontSize: 14, fontSize: 14,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
color: color,
), ),
), ),
), ),
@@ -16,10 +16,12 @@ import '../../../common/theme/theme_controller.dart';
import '../../../common/widgets/adaptive.dart'; import '../../../common/widgets/adaptive.dart';
import '../../../common/widgets/app_toast.dart'; import '../../../common/widgets/app_toast.dart';
import '../../../common/widgets/circle_back_button.dart'; import '../../../common/widgets/circle_back_button.dart';
import '../../../common/widgets/prototype_ui.dart';
import '../../auth/application/auth_controller.dart'; import '../../auth/application/auth_controller.dart';
import '../../auth/data/auth_models.dart'; import '../../auth/data/auth_models.dart';
import '../../profile/application/profile_settings_controller.dart'; import '../../profile/application/profile_settings_controller.dart';
import '../../profile/data/profile_models.dart'; import '../../profile/data/profile_models.dart';
import '../../profile/presentation/profile_page.dart';
class SettingsPage extends HookConsumerWidget { class SettingsPage extends HookConsumerWidget {
const SettingsPage({super.key}); const SettingsPage({super.key});
@@ -64,52 +66,57 @@ class SettingsPage extends HookConsumerWidget {
const SizedBox(height: 22), const SizedBox(height: 22),
const _Section('资产参数'), const _Section('资产参数'),
_Card( PrototypeCard(
children: [ padding: EdgeInsets.zero,
_SwitchRow( child: Column(
title: '隐藏金额', children: [
subtitle: '在资产页和持仓列表中隐藏金额信息', SettingRow(
value: profileSettings.amountHidden, icon: Icons.palette_outlined,
onChanged: (_) => ref title: '涨跌颜色',
.read(profileSettingsControllerProvider.notifier) trailing: profileSettings.priceColorMode.label,
.toggleAmountHidden(), onTap: () {
), final nextMode =
Divider(height: 1, thickness: 1, color: cs.border), profileSettings.priceColorMode ==
_NavRow( PriceColorMode.redUpGreenDown
icon: FlutterRemix.line_chart_line, ? PriceColorMode.greenUpRedDown
label: '涨跌颜色', : PriceColorMode.redUpGreenDown;
trailing: profileSettings.priceColorMode.label, ref
onTap: () => _showPriceColorSheet(context, ref), .read(profileSettingsControllerProvider.notifier)
), .setPriceColorMode(nextMode);
Divider(height: 1, thickness: 1, color: cs.border), toastInfo(msg: '已切换为「${nextMode.label}');
_NavRow( },
icon: FlutterRemix.coins_line, ),
label: '纯度系数', const PrototypeDivider(margin: EdgeInsets.zero),
trailing: '${profileSettings.purityPresets.length}', SettingRow(
onTap: () => _showPuritySheet(context, profileSettings), icon: Icons.tune_outlined,
), title: '纯度系数管理',
Divider(height: 1, thickness: 1, color: cs.border), trailing: '${profileSettings.purityPresets.length}',
_NavRow( onTap: () => context.push(AppRoutes.profilePurity),
icon: FlutterRemix.exchange_box_line, ),
label: '回收折扣', const PrototypeDivider(margin: EdgeInsets.zero),
trailing: '已设置', SettingRow(
onTap: () => _showRecycleSheet(context, profileSettings), icon: Icons.percent_outlined,
), title: '回收折扣设置',
], trailing:
'${(profileSettings.recycleDiscounts.values.first * 100).toStringAsFixed(0)}%',
onTap: () => context.push(AppRoutes.profileRecycle),
),
],
),
), ),
// const SizedBox(height: 22), // const SizedBox(height: 22),
// const _Section('备份'), // const _Section('备份'),
// _Card( // _Card(
// children: [ // children: [
// _NavRow( // SettingRow(
// icon: FlutterRemix.download_2_line, // icon: FlutterRemix.download_2_line,
// label: '本地导出备份', // label: '本地导出备份',
// trailing: '导出', // trailing: '导出',
// onTap: () => _showLocalBackupSheet(context), // onTap: () => _showLocalBackupSheet(context),
// ), // ),
// Divider(height: 1, thickness: 1, color: cs.border), // const PrototypeDivider(margin: EdgeInsets.zero),
// _NavRow( // SettingRow(
// icon: FlutterRemix.cloud_line, // icon: FlutterRemix.cloud_line,
// label: '云备份', // label: '云备份',
// trailing: '占位', // trailing: '占位',
@@ -119,104 +126,116 @@ class SettingsPage extends HookConsumerWidget {
// ), // ),
const SizedBox(height: 22), const SizedBox(height: 22),
const _Section('工具'), const _Section('工具'),
_Card( PrototypeCard(
children: [ padding: EdgeInsets.zero,
_NavRow( child: Column(
icon: FlutterRemix.layout_grid_line, children: [
label: '桌面小组件', SettingRow(
trailing: '占位', icon: FlutterRemix.layout_grid_line,
onTap: () => _showWidgetSheet(context), title: '桌面小组件',
), trailing: '占位',
if (kDebugMode) ...[ onTap: () => _showWidgetSheet(context),
Divider(height: 1, thickness: 1, color: cs.border),
_NavRow(
icon: Icons.bug_report_outlined,
label: '调试工具',
onTap: () => context.push(AppRoutes.debug),
), ),
if (kDebugMode) ...[
const PrototypeDivider(margin: EdgeInsets.zero),
SettingRow(
icon: Icons.bug_report_outlined,
title: '调试工具',
onTap: () => context.push(AppRoutes.debug),
),
],
], ],
], ),
), ),
const SizedBox(height: 22), const SizedBox(height: 22),
const _Section('法律'), const _Section('法律'),
_Card( PrototypeCard(
children: [ padding: EdgeInsets.zero,
_NavRow( child: Column(
icon: FlutterRemix.file_list_3_line, children: [
label: '用户协议', SettingRow(
onTap: () => launchUrlString( icon: FlutterRemix.file_list_3_line,
AppH5UrlsHelper.withCacheBuster(AppH5Urls.userProtocolUrl), title: '用户协议',
mode: LaunchMode.inAppBrowserView, onTap: () => launchUrlString(
AppH5UrlsHelper.withCacheBuster(AppH5Urls.userProtocolUrl),
mode: LaunchMode.inAppBrowserView,
),
), ),
), const PrototypeDivider(margin: EdgeInsets.zero),
Divider(height: 1, thickness: 1, color: cs.border), SettingRow(
_NavRow( icon: FlutterRemix.shield_check_line,
icon: FlutterRemix.shield_check_line, title: '隐私政策',
label: '隐私政策', onTap: () => launchUrlString(
onTap: () => launchUrlString( AppH5UrlsHelper.withCacheBuster(AppH5Urls.privacyUrl),
AppH5UrlsHelper.withCacheBuster(AppH5Urls.privacyUrl), mode: LaunchMode.inAppBrowserView,
mode: LaunchMode.inAppBrowserView, ),
), ),
), const PrototypeDivider(margin: EdgeInsets.zero),
Divider(height: 1, thickness: 1, color: cs.border), SettingRow(
_NavRow( icon: FlutterRemix.alert_line,
icon: FlutterRemix.alert_line, title: '免责声明',
label: '免责声明', onTap: () => _showDisclaimerSheet(context),
onTap: () => _showDisclaimerSheet(context), ),
), ],
], ),
), ),
if (loggedIn) ...[ if (loggedIn) ...[
const SizedBox(height: 22), const SizedBox(height: 22),
const _Section('账户'), const _Section('账户'),
_Card( PrototypeCard(
children: [ padding: EdgeInsets.zero,
_NavRow( child: Column(
icon: FlutterRemix.logout_box_r_line, children: [
label: '退出登录', SettingRow(
onTap: () => _confirmLogout(context, ref), icon: FlutterRemix.logout_box_r_line,
), title: '退出登录',
Divider(height: 1, thickness: 1, color: cs.border), onTap: () => _confirmLogout(context, ref),
_NavRow( ),
icon: FlutterRemix.delete_bin_line, const PrototypeDivider(margin: EdgeInsets.zero),
label: '注销账号', SettingRow(
destructive: true, icon: FlutterRemix.delete_bin_line,
onTap: () => context.push(AppRoutes.deleteAccount), title: '注销账号',
), destructive: true,
], onTap: () => context.push(AppRoutes.deleteAccount),
),
],
),
), ),
], ],
const SizedBox(height: 22), const SizedBox(height: 22),
const _Section('关于'), const _Section('关于'),
_Card( PrototypeCard(
children: [ padding: EdgeInsets.zero,
const _AboutRow(), child: Column(
Divider(height: 1, thickness: 1, color: cs.border), children: [
_NavRow( const _AboutRow(),
icon: FlutterRemix.mail_line, const PrototypeDivider(margin: EdgeInsets.zero),
label: '联系我们', SettingRow(
trailing: 'business@hnsiderui.cn', icon: FlutterRemix.mail_line,
onTap: () { title: '联系我们',
final now = DateTime.now(); trailing: 'business@hnsiderui.cn',
final lastTapAt = contactLastTapAt.value; onTap: () {
if (lastTapAt == null || final now = DateTime.now();
now.difference(lastTapAt) > final lastTapAt = contactLastTapAt.value;
const Duration(milliseconds: 500)) { if (lastTapAt == null ||
contactDebugTapCount.value = 0; now.difference(lastTapAt) >
} const Duration(milliseconds: 500)) {
contactLastTapAt.value = now; contactDebugTapCount.value = 0;
contactDebugTapCount.value += 1; }
if (contactDebugTapCount.value >= 10) { contactLastTapAt.value = now;
contactDebugTapCount.value = 0; contactDebugTapCount.value += 1;
contactLastTapAt.value = null; if (contactDebugTapCount.value >= 10) {
context.push(AppRoutes.debug); contactDebugTapCount.value = 0;
} contactLastTapAt.value = null;
}, context.push(AppRoutes.debug);
), }
], },
),
],
),
), ),
const SizedBox(height: 14), const SizedBox(height: 14),
_RiskFooter(cs: cs), _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 { Future<void> _showWidgetSheet(BuildContext context) async {
final cs = ShadTheme.of(context).colorScheme; final cs = ShadTheme.of(context).colorScheme;
await showModalBottomSheet<void>( 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 { class _ThemeSegmentCard extends StatelessWidget {
const _ThemeSegmentCard({required this.themeMode, required this.onChanged}); const _ThemeSegmentCard({required this.themeMode, required this.onChanged});
@@ -874,117 +548,56 @@ class _ThemeSegmentButton extends StatelessWidget {
} }
} }
class _SwitchRow extends StatelessWidget { // class SettingRow extends StatelessWidget {
const _SwitchRow({ // const SettingRow({
required this.title, // required this.icon,
required this.subtitle, // required this.label,
required this.value, // this.trailing,
required this.onChanged, // this.onTap,
}); // this.destructive = false,
// });
final String title; //
final String subtitle; // final IconData icon;
final bool value; // final String label;
final ValueChanged<bool> onChanged; // final String? trailing;
// final VoidCallback? onTap;
@override // final bool destructive;
Widget build(BuildContext context) { //
final cs = ShadTheme.of(context).colorScheme; // @override
return Padding( // Widget build(BuildContext context) {
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 18), // final cs = ShadTheme.of(context).colorScheme;
child: Row( // final color = destructive ? cs.destructive : cs.foreground;
crossAxisAlignment: CrossAxisAlignment.center, // return InkWell(
children: [ // onTap: onTap,
Expanded( // child: Padding(
child: Column( // padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 14),
crossAxisAlignment: CrossAxisAlignment.start, // child: Row(
children: [ // children: [
Text( // Icon(icon, size: 20, color: const Color(0xFF8A8780)),
title, // const SizedBox(width: 12),
style: TextStyle( // Expanded(
fontSize: 16, // child: Text(
fontWeight: FontWeight.w600, // label,
color: cs.foreground, // style: TextStyle(
), // fontSize: 14,
), // fontWeight: FontWeight.w600,
const SizedBox(height: 6), // color: color,
Text( // ),
subtitle, // ),
style: AppText.meta.copyWith( // ),
fontSize: 13, // if (trailing != null)
color: cs.mutedForeground, // Text(
), // trailing!,
), // style: TextStyle(fontSize: 12, color: cs.mutedForeground),
], // ),
), // const SizedBox(width: 6),
), // Icon(Icons.chevron_right, size: 16, 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 _AboutRow extends StatelessWidget { class _AboutRow extends StatelessWidget {
const _AboutRow(); 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 { class _SheetPrimaryButton extends StatelessWidget {
const _SheetPrimaryButton({required this.label, required this.onTap}); 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 { class _LogoutSheetButton extends StatelessWidget {
const _LogoutSheetButton({ const _LogoutSheetButton({
required this.label, required this.label,