我正在开发一个使用Apple Pad和Stylus的绘图应用程序。为了在此应用程序中顺利使用手写笔,它必须禁用手写笔设置中的涂鸦选项。如果是,我如何访问设置在IOS或Android上的设置和更改设置选项?在访问设置之前,我可以检查当前的设置值吗?例如,我可以检查是否启用了手写笔中的涂鸦设置吗?
bbuxkriu1#
看看这个包:https://pub.dev/packages/app_settings/example
import 'dart:async'; import 'package:app_settings/app_settings.dart'; import 'package:flutter/material.dart'; /// Main method to return runApp. void main() => runApp(MyApp()); /// This is the main app stateful widget. class MyApp extends StatefulWidget { @override _MyAppState createState() => _MyAppState(); } /// This is the app state. class _MyAppState extends State<MyApp> { @override void initState() { /// Call out to intialize platform state. initPlatformState(); super.initState(); } /// Initialize platform state. Future<void> initPlatformState() async { // If the widget was removed from the tree while the asynchronous platform // message was in flight, we want to discard the reply rather than calling // setState to update our non-existent appearance. if (!mounted) return; } /// Widget build method to return MaterailApp. @override Widget build(BuildContext context) { var actionItems = getListOfActionButtons(); return MaterialApp( home: Scaffold( appBar: AppBar( title: const Text('App Settings Example App'), ), body: GridView.count( crossAxisCount: 2, childAspectRatio: 2, children: List.generate(actionItems.length, (index) { return Center( child: ButtonTheme( colorScheme: ColorScheme.dark(), minWidth: 150.0, child: actionItems[index], )); })))); } List<Widget> getListOfActionButtons() { var actionItems = <Widget>[]; actionItems.addAll([ ElevatedButton( child: Text("WIFI"), onPressed: () { AppSettings.openWIFISettings(); }, ), ElevatedButton( child: Text("Location"), onPressed: () { AppSettings.openLocationSettings(); }, ), ElevatedButton( child: Text("Security"), onPressed: () { AppSettings.openSecuritySettings(); }, ), ElevatedButton( child: Text("Lock & Password"), onPressed: () { AppSettings.openLockAndPasswordSettings(); }, ), ElevatedButton( child: Text("App Settings"), onPressed: () { AppSettings.openAppSettings(); }, ), ElevatedButton( child: Text("Bluetooth"), onPressed: () { AppSettings.openBluetoothSettings(); }, ), ElevatedButton( child: Text("Data Roaming"), onPressed: () { AppSettings.openDataRoamingSettings(); }, ), ElevatedButton( child: Text("Date"), onPressed: () { AppSettings.openDateSettings(); }, ), ElevatedButton( child: Text("Display"), onPressed: () { AppSettings.openDisplaySettings(); }, ), ElevatedButton( child: Text("Notification"), onPressed: () { AppSettings.openNotificationSettings(); }, ), ElevatedButton( child: Text("Sound"), onPressed: () { AppSettings.openSoundSettings(); }, ), ElevatedButton( child: Text("Internal Storage"), onPressed: () { AppSettings.openInternalStorageSettings(); }, ), ElevatedButton( child: Text("Battery optimization"), onPressed: () { AppSettings.openBatteryOptimizationSettings(); }, ), ElevatedButton( child: Text("NFC"), onPressed: () { AppSettings.openNFCSettings(); }, ), ElevatedButton( child: Text("VPN"), onPressed: () { AppSettings.openVPNSettings( asAnotherTask: true, ); }, ), ElevatedButton( child: Text("Device Settings"), onPressed: () { AppSettings.openDeviceSettings( asAnotherTask: true, ); }, ), ElevatedButton( child: Text("Accessibility"), onPressed: () { AppSettings.openAccessibilitySettings( asAnotherTask: true, ); }, ), ElevatedButton( child: Text("Developer"), onPressed: () { AppSettings.openDevelopmentSettings( asAnotherTask: true, ); }, ), ElevatedButton( child: Text("Hotspot"), onPressed: () { AppSettings.openHotspotSettings( asAnotherTask: true, ); }, ), ]); return actionItems; } /// Dispose method to close out and cleanup objects. @override void dispose() { super.dispose(); } }
vwkv1x7d2#
openDateSettings doest已在IOS上
2条答案
按热度按时间bbuxkriu1#
看看这个包:https://pub.dev/packages/app_settings/example
vwkv1x7d2#
openDateSettings doest已在IOS上