app_settings
一個用於從應用程式中開啟 iOS 和 Android 手機設定的 Flutter 插件。
適用於 iOS 和 Android 的 Flutter 外掛程式,用於存取應用程式的手機設定
{"sdk":"flutter"}^2.0.2{"sdk":"flutter"}^5.0.0以下為英文專案原文快照,最新內容請造訪 GitHub。
A Flutter plugin for opening iOS and Android phone settings from an app.
First, add app_settings as a dependency in your pubspec.yaml file.
flutter pub add app_settings
Next, import 'app_settings.dart' into your Dart code.
import 'package:app_settings/app_settings.dart';
TIP: If using Objective-C for iOS in your project, you will need to add use_frameworks! to your Runner project podfile in order to use this Swift plugin:
target 'Runner' do
use_frameworks!
If you prefer using Swift Package Manager (SPM), make sure to enable swift support in your project. See also Flutter SPM integration.
flutter config --enable-swift-package-manager
Open the settings of the application using AppSettings.openAppSettings().
By default, AppSettingsType.settings is used as the type, which opens the general application settings.
If the given type is not supported on the current platform, the general settings are opened instead.
Android If asAnotherTask is set to true, the settings page is opened in a different Activity.
Widget build(BuildContext context) {
return ElevatedButton(
onPressed: () => AppSettings.openAppSettings(type: AppSettingsType.location),
child: const Text('Open Location Settings'),
);
}
To open a Settings Panel on Android Q and higher,
call AppSettings.openAppSettingsPanel() with a given type.
Widget build(BuildContext context) {
return ElevatedButton(
onPressed: () => AppSettings.openAppSettingsPanel(AppSettingsPanelType.volume),
child: const Text('Open Volume Settings Panel'),
);
}
Settings panels are not supported on other platforms.