@@ -3,14 +3,13 @@ import 'dart:io';
33import 'package:bb_mobile/core/themes/app_theme.dart' ;
44import 'package:bb_mobile/core/utils/build_context_x.dart' ;
55import 'package:bb_mobile/core/utils/constants.dart' ;
6- import 'package:bb_mobile/core/widgets/settings_entry_item.dart' ;
76import 'package:bb_mobile/features/exchange/presentation/exchange_cubit.dart' ;
87import 'package:bb_mobile/features/exchange/ui/exchange_router.dart' ;
98import 'package:bb_mobile/features/exchange_support_chat/public/exchange_support_chat_facade.dart' ;
109import 'package:bb_mobile/features/settings/presentation/bloc/settings_cubit.dart' ;
11- import 'package:bb_mobile/features/settings/ui/settings_router.dart' ;
10+ import 'package:bb_mobile/features/settings/ui/settings_item.dart' ;
11+ import 'package:bb_mobile/features/settings/ui/widgets/settings_search_sheet.dart' ;
1212import 'package:bb_mobile/features/status_check/presentation/cubit.dart' ;
13- import 'package:bb_mobile/features/status_check/router.dart' ;
1413import 'package:bull_ui/bull_ui.dart' show Gap;
1514import 'package:flutter/material.dart' ;
1615import 'package:flutter/services.dart' ;
@@ -33,6 +32,12 @@ class _AllSettingsScreenState extends State<AllSettingsScreen> {
3332 context.read <ServiceStatusCubit >().checkStatus ();
3433 }
3534
35+ Future <void > _openSettingsSearch (List <SettingsItem > items) async {
36+ final item = await SettingsSearchSheet .show (context: context, items: items);
37+ if (item == null || ! mounted) return ;
38+ item.open (context);
39+ }
40+
3641 @override
3742 Widget build (BuildContext context) {
3843 final theme = Theme .of (context);
@@ -44,6 +49,9 @@ class _AllSettingsScreenState extends State<AllSettingsScreen> {
4449 final isSuperuser =
4550 context.select ((SettingsCubit cubit) => cubit.state.isSuperuser) ??
4651 false ;
52+ final isDevModeEnabled =
53+ context.select ((SettingsCubit cubit) => cubit.state.isDevModeEnabled) ??
54+ false ;
4755
4856 final serviceStatusLoading = context.select (
4957 (ServiceStatusCubit cubit) => cubit.state.isLoading,
@@ -53,110 +61,49 @@ class _AllSettingsScreenState extends State<AllSettingsScreen> {
5361 (ServiceStatusCubit cubit) => cubit.state.serviceStatus,
5462 );
5563
64+ final exchangeTitle = Platform .isIOS && ! isSuperuser
65+ ? context.loc.settingsAccountSettingsTitle
66+ : context.loc.settingsExchangeSettingsTitle;
67+ final items = buildSettingsItems (
68+ localization: context.loc,
69+ exchangeTitle: exchangeTitle,
70+ isSuperuser: isSuperuser,
71+ isDevModeEnabled: isDevModeEnabled,
72+ );
73+
5674 return Scaffold (
57- appBar: AppBar (title: Text (context.loc.settingsScreenTitle)),
75+ appBar: AppBar (
76+ title: Text (context.loc.settingsScreenTitle),
77+ actionsPadding: const EdgeInsets .only (right: 8 ),
78+ actions: [
79+ IconButton (
80+ key: const Key ('settings-search-button' ),
81+ tooltip: context.loc.settingsSearchHint,
82+ color: context.appColors.secondary,
83+ iconSize: 32 ,
84+ icon: const Icon (Icons .search),
85+ onPressed: () => _openSettingsSearch (items),
86+ ),
87+ ],
88+ ),
5889 body: SafeArea (
5990 child: SingleChildScrollView (
6091 child: Padding (
6192 padding: const EdgeInsets .symmetric (horizontal: 16 ),
6293 child: Column (
6394 children: [
64- SettingsEntryItem (
65- icon: Icons .currency_exchange,
66- title: Platform .isIOS && ! isSuperuser
67- ? context.loc.settingsAccountSettingsTitle
68- : context.loc.settingsExchangeSettingsTitle,
69- onTap: () {
70- if (Platform .isIOS) {
71- if (isSuperuser) {
72- final notLoggedIn = context
73- .read <ExchangeCubit >()
74- .state
75- .notLoggedIn;
76- if (notLoggedIn) {
77- context.goNamed (ExchangeRoute .exchangeLanding.name);
78- } else {
79- context.pushNamed (
80- SettingsRoute .exchangeSettings.name,
81- );
82- }
83- } else {
84- final notLoggedIn = context
85- .read <ExchangeCubit >()
86- .state
87- .notLoggedIn;
88- if (notLoggedIn) {
89- context.goNamed (ExchangeRoute .exchangeLanding.name);
90- } else {
91- context.pushNamed (
92- SettingsRoute .exchangeSettings.name,
93- );
94- }
95- }
96- } else {
97- final notLoggedIn = context
98- .read <ExchangeCubit >()
99- .state
100- .notLoggedIn;
101- if (notLoggedIn) {
102- context.goNamed (ExchangeRoute .exchangeLanding.name);
103- } else {
104- context.pushNamed (SettingsRoute .exchangeSettings.name);
105- }
106- }
107- },
108- ),
109- SettingsEntryItem (
110- icon: Icons .save,
111- title: context.loc.settingsWalletBackupTitle,
112- onTap: () {
113- context.pushNamed (SettingsRoute .backupSettings.name);
114- },
115- ),
116- SettingsEntryItem (
117- icon: Icons .currency_bitcoin,
118- title: context.loc.settingsBitcoinSettingsTitle,
119- onTap: () {
120- context.pushNamed (SettingsRoute .bitcoinSettings.name);
121- },
122- ),
123- SettingsEntryItem (
124- icon: Icons .app_settings_alt,
125- title: context.loc.settingsAppSettingsTitle,
126- onTap: () {
127- context.pushNamed (SettingsRoute .appSettings.name);
128- },
129- ),
130-
131- SettingsEntryItem (
132- icon: Icons .map,
133- title: context.loc.settingsBtcMapTitle,
134- onTap: () {
135- context.pushNamed (SettingsRoute .btcMap.name);
136- },
137- ),
138- SettingsEntryItem (
139- icon: Icons .description,
140- title: context.loc.settingsTermsOfServiceTitle,
141- onTap: () {
142- final url = Uri .parse (
143- SettingsConstants .termsAndConditionsLink,
144- );
145- launchUrl (url, mode: LaunchMode .inAppBrowserView);
146- },
147- ),
148- SettingsEntryItem (
149- icon: Icons .monitor_heart,
150- iconColor: serviceStatusLoading
151- ? context.appColors.textMuted
152- : serviceStatus.allServicesOnline
153- ? context.appColors.success
154- : context.appColors.error,
155- title: context.loc.settingsServicesStatusTitle,
156- onTap: () {
157- context.pushNamed (StatusCheckRoute .serviceStatus.name);
158- },
159- ),
95+ const Gap (16 ),
96+ for (final item in items.inSection (SettingsItemSection .root))
97+ item.buildTile (
98+ context,
99+ iconColor: item.id == SettingsItemId .servicesStatus
100+ ? serviceStatusLoading
101+ ? context.appColors.textMuted
102+ : serviceStatus.allServicesOnline
103+ ? context.appColors.success
104+ : context.appColors.error
105+ : null ,
106+ ),
160107 ],
161108 ),
162109 ),
0 commit comments