-
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support to update ShortcutViewer on a page
- Create ShortcutInfo just for infos - Set some unamed shortcuts
- Loading branch information
Showing
12 changed files
with
77 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
import 'package:fluent_ui/fluent_ui.dart'; | ||
import 'package:xbox_launcher/models/shortcut_models/shortcut_option.dart'; | ||
import 'package:xbox_launcher/models/shortcut_models/shortcut_info.dart'; | ||
|
||
abstract class MappingDefinition { | ||
List<ShortcutOption>? defineMapping(BuildContext context); | ||
List<ShortcutInfo>? defineMapping(BuildContext context); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import 'package:xbox_launcher/models/controller_keyboard_pair.dart'; | ||
|
||
class ShortcutInfo { | ||
String description; | ||
ControllerKeyboardPair controllerKeyboardPair; | ||
bool show; | ||
|
||
ShortcutInfo(this.description, | ||
{required this.controllerKeyboardPair, this.show = true}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,14 @@ | ||
import 'package:fluent_ui/fluent_ui.dart'; | ||
import 'package:xbox_launcher/models/controller_keyboard_pair.dart'; | ||
import 'package:xbox_launcher/models/shortcut_models/shortcut_info.dart'; | ||
|
||
class ShortcutOption { | ||
String description; | ||
ControllerKeyboardPair controllerKeyboardPair; | ||
class ShortcutOption extends ShortcutInfo { | ||
void Function(BuildContext) action; | ||
bool show; | ||
MapEntry<ControllerKeyboardPair, void Function(BuildContext)> | ||
get rawShortcut => MapEntry(controllerKeyboardPair, action); | ||
|
||
ShortcutOption(this.description, | ||
{required this.controllerKeyboardPair, | ||
ShortcutOption(super.description, | ||
{required super.controllerKeyboardPair, | ||
required this.action, | ||
this.show = true}); | ||
super.show}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import 'package:fluent_ui/fluent_ui.dart'; | ||
import 'package:xbox_launcher/models/shortcut_models/shortcut_info.dart'; | ||
import 'package:xbox_launcher/shared/widgets/shortcuts/shortcuts_viewer.dart'; | ||
|
||
abstract class ShortcutViewerSupport { | ||
ShortcutsViewer? _shortcutsOverlay; | ||
void Function(void Function())? _reloadShortcutViewer; | ||
|
||
bool get supportShortcuts => _shortcutsOverlay != null; | ||
|
||
Widget? get shortcutOverlayWidget { | ||
if (_shortcutsOverlay == null) return null; | ||
|
||
return StatefulBuilder( | ||
builder: (context, setState) { | ||
_reloadShortcutViewer = setState; | ||
|
||
return _shortcutsOverlay!; | ||
}, | ||
); | ||
} | ||
|
||
void updateShortcuts(List<ShortcutInfo> shortcuts) { | ||
if (shortcuts.isEmpty) return; | ||
|
||
_shortcutsOverlay = ShortcutsViewer(shortcuts); | ||
_reloadShortcutViewer?.call(() {}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters