lecle_system_shortcuts 0.0.1+1 lecle_system_shortcuts: ^0.0.1+1 copied to clipboard
A flutter plugin to use the Android and iOS system shortcuts.
lecle_system_shortcuts #
A flutter plugin to use the Android and iOS system shortcuts. Migrate from system_shortcuts package
For using funtions and getters related to WIFI settings you need to add these two permissions in your AndroidManifext.xml file #
<uses-feature android:name="android.hardware.wifi" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE"/>
For using funtions and getters related to BLUETOOTH settings you need to add these two permissions in your AndroidManifext.xml file #
<uses-feature android:name="android.hardware.bluetooth" />
<uses-permission android:name="android.permission.BLUETOOTH"/>
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
<uses-permission android:name="android.permission.INTERNET" />
Make this import #
import 'package:lecle_system_shortcuts/lecle_system_shortcuts.dart';
Functions #
Press home button using this function. #
await SystemShortcuts.home(); // Perform a home button tap in android
Press back button using this function #
await SystemShortcuts.back(); // Perform a back button tap in android
Press volume Down in using this function #
await SystemShortcuts.volDown(); // Perform a volume down button click
Press volume Down in using this function #
await SystemShortcuts.volUp();// Perform a volume up button click
Toggle WIFI using this function #
await SystemShortcuts.wifi(); // Toggle wifi in Android
Toggle BLUETOOTH using this function #
await SystemShortcuts.bluetooth(); // Toggle bluetooth in Android
Getters #
Get current WIFI state #
await SystemShortcuts.checkWifi; // Return true/false
Get current BLUETOOTH state #
await SystemShortcuts.checkBluetooth; // Return true/false
Usage #
FlatButton(
child: Text("Home"),
onPressed: () async {
await SystemShortcuts.home();
},
),
FlatButton(
child: Text("Check Wifi"),
onPressed: () async {
bool wifi = await SystemShortcuts.checkWifi;
},
),