spotube/lib/components/Settings/SettingsHotkeyTile.dart
Kingkor Roy Tirtho e666e25ffd Global custom hotkey support for playback control
UserPreferences provider genius access token not loading on init bug fix
2022-02-06 10:01:29 +06:00

49 lines
1.4 KiB
Dart

import 'package:flutter/material.dart';
import 'package:hotkey_manager/hotkey_manager.dart';
import 'package:spotube/components/Shared/RecordHotKeyDialog.dart';
class SettingsHotKeyTile extends StatelessWidget {
final String title;
final HotKey? currentHotKey;
final ValueChanged<HotKey> onHotKeyRecorded;
const SettingsHotKeyTile({
required this.onHotKeyRecorded,
required this.title,
Key? key,
this.currentHotKey,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.symmetric(vertical: 10),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(title),
Row(
children: [
if (currentHotKey != null)
HotKeyVirtualView(hotKey: currentHotKey!),
const SizedBox(width: 10),
ElevatedButton(
child: const Text("Set Shortcut"),
onPressed: () {
showDialog(
context: context,
builder: (context) {
return RecordHotKeyDialog(
onHotKeyRecorded: onHotKeyRecorded,
);
},
);
},
),
],
)
],
),
);
}
}