1
0
mirror of https://gitlab.com/comunic/comunicmobile synced 2024-11-25 22:39:22 +00:00

Can force to use mobile mode

This commit is contained in:
Pierre HUBERT 2020-05-13 18:21:30 +02:00
parent d04b40f662
commit a6ce969e89
2 changed files with 23 additions and 5 deletions

View File

@ -11,12 +11,10 @@ import 'package:settings_ui/settings_ui.dart';
class ApplicationSettings extends StatefulWidget { class ApplicationSettings extends StatefulWidget {
@override @override
_ApplicationSettingsState createState() => _ApplicationSettingsState createState() => _ApplicationSettingsState();
_ApplicationSettingsState();
} }
class _ApplicationSettingsState class _ApplicationSettingsState extends State<ApplicationSettings> {
extends State<ApplicationSettings> {
PreferencesHelper _preferencesHelper; PreferencesHelper _preferencesHelper;
Future<void> _refresh() async { Future<void> _refresh() async {
@ -31,7 +29,11 @@ class _ApplicationSettingsState
Widget _buildSections() { Widget _buildSections() {
return SettingsList( return SettingsList(
sections: [_buildAppearanceSection(), _buildGeneralSection()], sections: [
_buildAppearanceSection(),
_buildGeneralSection(),
_buildDebugSection()
],
); );
} }
@ -61,6 +63,21 @@ class _ApplicationSettingsState
], ],
); );
/// Debug section
SettingsSection _buildDebugSection() => SettingsSection(
title: tr("Debug features"),
tiles: [
_PreferencesSettingsTile(
preferencesKey: PreferencesKeyList.FORCE_MOBILE_MODE,
title: tr("Force mobile mode"),
subtitle: tr(
"Force the smartphone mode of the application to be used, even when tablet mode could be used."),
onChange: _updatedSettings,
helper: _preferencesHelper,
),
],
);
/// Apply new settings /// Apply new settings
_updatedSettings() { _updatedSettings() {
setState(() {}); setState(() {});

View File

@ -202,6 +202,7 @@ bool darkTheme() => preferences().getBool(PreferencesKeyList.ENABLE_DARK_THEME);
/// Check out whether we use tablet mode or not /// Check out whether we use tablet mode or not
bool isTablet(BuildContext context) => bool isTablet(BuildContext context) =>
!preferences().getBool(PreferencesKeyList.FORCE_MOBILE_MODE) &&
MediaQuery.of(context).size.width >= 1024; MediaQuery.of(context).size.width >= 1024;
/// Show about Comunic dialog /// Show about Comunic dialog