v0.0.4
hardware_buttons_find_flutter
異なるボタンを持つモバイルデバイスでは、ボタンが押されたときにボタン名をリッスンします。
25いいね 1430日間ダウンロード135Pub ポイント
Android
異なるボタンを持つモバイルデバイスでは、ボタンが押されたときにボタン名をリッスンします。
以下は英語原文のスナップショットです。最新版は GitHub をご覧ください。
It is necessary to learn the feedback of buttons on different types of reading devices and take steps based on it. This plugin will help you. This code, written with Stream, always listens to the native code, returning the name of the button to you when the button is pressed. Based on the answer you get, write down the functions you envision.
class _MyAppState extends State<MyApp> {
String? _latestHardwareButtonEvent;
StreamSubscription<String>? _buttonSubscription;
@override
void initState() {
super.initState();
_buttonSubscription = HardwareButtons.buttonEvents?.listen((event) {
setState(() {
_latestHardwareButtonEvent = event.toString();
});
});
}
@override
void dispose() {
super.dispose();
_buttonSubscription?.cancel();
}
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text('Hardware buttons find'),
),
body: Center(
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Text('Button name: $_latestHardwareButtonEvent\n'),
],
),
),
),
);
}
}
依存関係一覧 4 件
{"sdk":"flutter"}^2.0.2{"sdk":"flutter"}^2.0.0用途で絞り込み、開発状況を比較し、採用前に元のリポジトリで要件を確認しましょう。
“A repository is the most basic element of GitHub.”
GitHub Docs — About repositories ↗