11import 'package:flutter/material.dart' ;
2+ import 'package:flutter/services.dart' ;
23import 'package:flutter/widgets.dart' ;
34import 'package:package_info/package_info.dart' ;
5+ import 'package:sentinelx/channels/network_channel.dart' ;
46import 'package:sentinelx/models/db/prefs_store.dart' ;
57import 'package:sentinelx/models/db/sentinelx_db.dart' ;
68import 'package:sentinelx/screens/Lock/lock_screen.dart' ;
79import 'package:sentinelx/screens/dojo_configure.dart' ;
810import 'package:sentinelx/shared_state/app_state.dart' ;
911import 'package:sentinelx/shared_state/sentinel_state.dart' ;
1012import 'package:sentinelx/widgets/confirm_modal.dart' ;
13+ import 'package:sentinelx/widgets/port_selector.dart' ;
1114import 'package:sentinelx/widgets/qr_camera/push_up_camera_wrapper.dart' ;
1215import 'package:sentinelx/widgets/sentinelx_icons.dart' ;
1316import 'package:sentinelx/widgets/theme_chooser.dart' ;
@@ -44,9 +47,7 @@ class _SettingsState extends State<Settings> {
4447 centerTitle: true ,
4548 primary: true ,
4649 ),
47- backgroundColor: Theme
48- .of (context)
49- .backgroundColor,
50+ backgroundColor: Theme .of (context).backgroundColor,
5051 body: Container (
5152 margin: EdgeInsets .only (top: 12 ),
5253 child: ListView (
@@ -56,9 +57,7 @@ class _SettingsState extends State<Settings> {
5657 padding: const EdgeInsets .symmetric (vertical: 6 , horizontal: 18 ),
5758 child: Text (
5859 "App" ,
59- style: TextStyle (color: Theme
60- .of (context)
61- .accentColor),
60+ style: TextStyle (color: Theme .of (context).accentColor),
6261 ),
6362 ),
6463 Divider (),
@@ -69,19 +68,16 @@ class _SettingsState extends State<Settings> {
6968 ),
7069 trailing: loadingErase
7170 ? SizedBox (
72- child: CircularProgressIndicator (
73- strokeWidth: 1 ,
74- ),
75- width: 12 ,
76- height: 12 ,
77- )
71+ child: CircularProgressIndicator (
72+ strokeWidth: 1 ,
73+ ),
74+ width: 12 ,
75+ height: 12 ,
76+ )
7877 : SizedBox .shrink (),
7978 title: Text (
8079 "Clear all data" ,
81- style: Theme
82- .of (context)
83- .textTheme
84- .subtitle,
80+ style: Theme .of (context).textTheme.subtitle,
8581 ),
8682 subtitle: Text ("Clear all data from the device" ),
8783 onTap: () {
@@ -96,10 +92,7 @@ class _SettingsState extends State<Settings> {
9692 ),
9793 title: Text (
9894 "Theme" ,
99- style: Theme
100- .of (context)
101- .textTheme
102- .subtitle,
95+ style: Theme .of (context).textTheme.subtitle,
10396 ),
10497 subtitle: Text ("Customize theme" ),
10598 onTap: () {
@@ -111,9 +104,7 @@ class _SettingsState extends State<Settings> {
111104 padding: const EdgeInsets .symmetric (vertical: 6 , horizontal: 18 ),
112105 child: Text (
113106 "Security" ,
114- style: TextStyle (color: Theme
115- .of (context)
116- .accentColor),
107+ style: TextStyle (color: Theme .of (context).accentColor),
117108 ),
118109 ),
119110 Divider (),
@@ -124,23 +115,17 @@ class _SettingsState extends State<Settings> {
124115 ),
125116 title: Text (
126117 lockEnabled ? "Change Lock PIN" : "Enable Lock Screen" ,
127- style: Theme
128- .of (context)
129- .textTheme
130- .subtitle,
118+ style: Theme .of (context).textTheme.subtitle,
131119 ),
132- subtitle:
133- Text ("Database will be encrypted using the provided PIN" ),
120+ subtitle: Text ("Database will be encrypted using the provided PIN" ),
134121 onTap: enableOrChangeLock,
135122 ),
136123 Divider (),
137124 Container (
138125 padding: const EdgeInsets .symmetric (vertical: 6 , horizontal: 18 ),
139126 child: Text (
140127 "Network" ,
141- style: TextStyle (color: Theme
142- .of (context)
143- .accentColor),
128+ style: TextStyle (color: Theme .of (context).accentColor),
144129 ),
145130 ),
146131 Divider (),
@@ -151,27 +136,35 @@ class _SettingsState extends State<Settings> {
151136 ),
152137 title: Text (
153138 "Tor" ,
154- style: Theme
155- .of (context)
156- .textTheme
157- .subtitle,
139+ style: Theme .of (context).textTheme.subtitle,
158140 ),
159141 subtitle: Text ("Manage Tor service" ),
160142 onTap: () {
161143 showTorPanel (context);
162144 },
163145 ),
146+ ListTile (
147+ leading: Padding (
148+ padding: const EdgeInsets .symmetric (vertical: 12 ),
149+ child: Icon (Icons .import_export),
150+ ),
151+ title: Text (
152+ "Socks Port" ,
153+ style: Theme .of (context).textTheme.subtitle,
154+ ),
155+ subtitle: Text ("Set Tor service socks port" ),
156+ onTap: () {
157+ showPortChooser ();
158+ },
159+ ),
164160 ListTile (
165161 leading: Padding (
166162 padding: const EdgeInsets .symmetric (vertical: 12 ),
167163 child: Icon (Icons .router),
168164 ),
169165 title: Text (
170166 "Samourai DOJO" ,
171- style: Theme
172- .of (context)
173- .textTheme
174- .subtitle,
167+ style: Theme .of (context).textTheme.subtitle,
175168 ),
176169 subtitle: Text ("Power your sentinel with Dojo backend" ),
177170 onTap: () {
@@ -191,14 +184,14 @@ class _SettingsState extends State<Settings> {
191184 Padding (
192185 padding: EdgeInsets .all (24 ),
193186 ),
194- Text ("Version : $ version " , style : Theme
195- . of (context)
196- . textTheme
197- .caption, ),
198- Text ("build : $ buildNumber " , style : Theme
199- . of (context)
200- . textTheme
201- .caption, )
187+ Text (
188+ "Version : $ version " ,
189+ style : Theme . of (context). textTheme.caption,
190+ ),
191+ Text (
192+ "build : $ buildNumber " ,
193+ style : Theme . of (context). textTheme.caption,
194+ )
202195 ],
203196 )
204197 ],
@@ -222,11 +215,7 @@ class _SettingsState extends State<Settings> {
222215 void deleteConfirmModal () async {
223216 bool confirm = await showConfirmModel (
224217 context: context,
225- title: Text ("Are you sure want to continue?" ,
226- style: Theme
227- .of (context)
228- .textTheme
229- .subhead),
218+ title: Text ("Are you sure want to continue?" , style: Theme .of (context).textTheme.subhead),
230219 iconPositive: new Icon (
231220 Icons .check_circle,
232221 color: Colors .greenAccent[200 ],
@@ -262,10 +251,7 @@ class _SettingsState extends State<Settings> {
262251 }
263252 bool confirm = await showConfirmModel (
264253 context: context,
265- title: Text ("Choose option" , style: Theme
266- .of (context)
267- .textTheme
268- .subhead),
254+ title: Text ("Choose option" , style: Theme .of (context).textTheme.subhead),
269255 iconPositive: new Icon (
270256 Icons .dialpad,
271257 ),
@@ -284,18 +270,15 @@ class _SettingsState extends State<Settings> {
284270 } catch (e) {
285271 debugPrint (e);
286272 }
287- Navigator .of (context).pushNamedAndRemoveUntil (
288- '/' , (Route <dynamic > route) => false ,
289- arguments: "LOCK" );
290- }
273+ Navigator .of (context).pushNamedAndRemoveUntil ('/' , (Route <dynamic > route) => false , arguments: "LOCK" );
274+ }
291275 }
292276
293277 void setPassword () async {
294278 final text = await Navigator .push (
295279 context,
296280 MaterialPageRoute (
297- builder: (context) =>
298- LockScreen (
281+ builder: (context) => LockScreen (
299282 lockScreenMode: LockScreenMode .CONFIRM ,
300283 ),
301284 fullscreenDialog: true ),
@@ -321,4 +304,8 @@ class _SettingsState extends State<Settings> {
321304 return ThemeChooser ();
322305 });
323306 }
307+
308+ void showPortChooser () {
309+ showModalBottomSheet (context: context, isScrollControlled: true , builder: (context) => PortSelector ());
310+ }
324311}
0 commit comments