@@ -3,6 +3,7 @@ import 'package:flutter/material.dart';
33import '../generated/l10n/zulip_localizations.dart' ;
44import '../model/settings.dart' ;
55import 'app_bar.dart' ;
6+ import 'button.dart' ;
67import 'icons.dart' ;
78import 'page.dart' ;
89import 'store.dart' ;
@@ -95,12 +96,11 @@ class _SettingsNavitem extends StatelessWidget {
9596 fontSize: 20 ).merge (weightVariableTextStyle (context, wght: 600 ))),
9697 subtitle: subtitle != null ? Text (
9798 subtitle! ,
98- style: TextStyle (
99- fontSize: 17 ).merge (weightVariableTextStyle (context, wght: 400 ))) : null ,
99+ style: TextStyle (fontSize: 17 ).merge (weightVariableTextStyle (context, wght: 400 ))) : null ,
100100 onTap: onTap,
101101 trailing: Icon (
102102 ZulipIcons .chevron_right,
103- color: designVariables.contextMenuItemIcon, ),
103+ color: designVariables.contextMenuItemIcon),
104104 ));}
105105}
106106
@@ -146,13 +146,19 @@ class _BrowserPreferenceSetting extends StatelessWidget {
146146 @override
147147 Widget build (BuildContext context) {
148148 final zulipLocalizations = ZulipLocalizations .of (context);
149+ final designVariables = DesignVariables .of (context);
149150 final globalSettings = GlobalStoreWidget .settingsOf (context);
150151 final openLinksWithInAppBrowser =
151152 globalSettings.effectiveBrowserPreference == BrowserPreference .inApp;
152- return SwitchListTile .adaptive (
153- title: Text (zulipLocalizations.openLinksWithInAppBrowser),
154- value: openLinksWithInAppBrowser,
155- onChanged: (newValue) => _handleChange (context, newValue));
153+ return Material (
154+ color: Colors .transparent,
155+ child: ListTile (
156+ title: Text (zulipLocalizations.openLinksWithInAppBrowser,
157+ style: TextStyle (
158+ color: designVariables.contextMenuItemText, fontSize: 20 ).merge (weightVariableTextStyle (context, wght: 600 ))),
159+ trailing: _CustomSwitch (
160+ value: openLinksWithInAppBrowser,
161+ onChanged: (newValue) => _handleChange (context, newValue))));
156162 }
157163}
158164
@@ -273,19 +279,28 @@ class ExperimentalFeaturesPage extends StatelessWidget {
273279 final zulipLocalizations = ZulipLocalizations .of (context);
274280 final globalSettings = GlobalStoreWidget .settingsOf (context);
275281 final flags = GlobalSettingsStore .experimentalFeatureFlags;
282+ final designVariables = DesignVariables .of (context);
276283 assert (flags.isNotEmpty);
277284 return Scaffold (
278285 appBar: AppBar (
279286 title: Text (zulipLocalizations.experimentalFeatureSettingsPageTitle)),
280- body: Column (children: [
281- ListTile (
282- title: Text (zulipLocalizations.experimentalFeatureSettingsWarning)),
283- for (final flag in flags)
284- SwitchListTile .adaptive (
285- title: Text (flag.name), // no i18n; these are developer-facing settings
286- value: globalSettings.getBool (flag),
287- onChanged: (value) => globalSettings.setBool (flag, value)),
288- ]));
287+ body: ListView (
288+ padding: const EdgeInsets .symmetric (vertical: 8 ),
289+ children: [Padding (
290+ padding: const EdgeInsets .all (16.0 ),
291+ child: Text (zulipLocalizations.experimentalFeatureSettingsWarning,
292+ style: TextStyle (fontSize: 17 ).merge (weightVariableTextStyle (context, wght: 400 )))),
293+ for (final flag in flags)
294+ Padding (padding: const EdgeInsets .symmetric (horizontal: 16 , vertical: 8 ),
295+ child: Row (
296+ children: [Expanded (
297+ child: Text (flag.name,
298+ style: TextStyle (fontSize: 20 , color: designVariables.contextMenuItemText).merge (weightVariableTextStyle (context, wght: 600 )))),
299+ _CustomSwitch (
300+ value: globalSettings.getBool (flag),
301+ onChanged: (value) => globalSettings.setBool (flag, value)),
302+ ])),
303+ ]));
289304 }
290305}
291306
@@ -344,4 +359,22 @@ class CustomRadioTile<T> extends StatelessWidget {
344359 ])));
345360 }
346361}
362+ class _CustomSwitch extends StatelessWidget {
363+ const _CustomSwitch ({
364+ required this .value,
365+ required this .onChanged,
366+ });
367+
368+ final bool value;
369+ final ValueChanged <bool > onChanged;
370+
371+ @override
372+ Widget build (BuildContext context) {
373+ return GestureDetector (
374+ behavior: HitTestBehavior .translucent,
375+ onTap: () => onChanged (! value),
376+ child: Toggle (value: value, onChanged: onChanged ));
377+ }
378+ }
379+
347380
0 commit comments