mirror of
				https://gitlab.com/comunic/comunicmobile
				synced 2025-11-04 04:04:18 +00:00 
			
		
		
		
	Can force to use mobile mode
This commit is contained in:
		@@ -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(() {});
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -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
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user