Skip to content

Commit

Permalink
feat: added button events
Browse files Browse the repository at this point in the history
  • Loading branch information
e200 committed Nov 21, 2021
1 parent a8e2221 commit 7ac1c96
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 16 deletions.
21 changes: 11 additions & 10 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -61,16 +61,17 @@ class RemoteControl extends StatelessWidget {
],
),
const SizedBox(height: 30),
const NavigationControl(),
const SizedBox(height: 30),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
VerticalButtons(
children: [
ShadowedIconButton(
shadowOpacity: 0,
icon: const Icon(FeatherIcons.volume2),
NavigationControl(
onPressNavigateLeft:
ref.read(remoteSignalEmitter).navigateLeft,
onPressNavigateDown:
ref.read(remoteSignalEmitter).navigateDown,
onPressNavigateRight:
ref.read(remoteSignalEmitter).navigateRight,
onPressNavigateUp:
ref.read(remoteSignalEmitter).navigateUp,
onPressOk: ref.read(remoteSignalEmitter).ok,
),
onPress: () {},
),
const SizedBox(height: 10),
Expand Down
25 changes: 19 additions & 6 deletions lib/ui/controls/navigation.dart
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,20 @@ class _ArrowButton extends StatelessWidget {
}

class NavigationControl extends StatelessWidget {
const NavigationControl({Key? key}) : super(key: key);
final VoidCallback onPressNavigateLeft;
final VoidCallback onPressNavigateUp;
final VoidCallback onPressNavigateRight;
final VoidCallback onPressNavigateDown;
final VoidCallback onPressOk;

const NavigationControl({
Key? key,
required this.onPressNavigateDown,
required this.onPressNavigateLeft,
required this.onPressNavigateRight,
required this.onPressNavigateUp,
required this.onPressOk,
}) : super(key: key);

@override
Widget build(BuildContext context) {
Expand All @@ -75,24 +88,24 @@ class NavigationControl extends StatelessWidget {
const SizedBox.shrink(),
_ArrowButton(
icon: Icons.arrow_drop_up_rounded,
onPress: () {},
onPress: onPressNavigateUp,
),
const SizedBox.shrink(),
_ArrowButton(
icon: Icons.arrow_left_rounded,
onPress: () {},
onPress: onPressNavigateLeft,
),
_OkButton(
onPress: () {},
onPress: onPressOk,
),
_ArrowButton(
icon: Icons.arrow_right_rounded,
onPress: () {},
onPress: onPressNavigateRight,
),
const SizedBox.shrink(),
_ArrowButton(
icon: Icons.arrow_drop_down_rounded,
onPress: () {},
onPress: onPressNavigateDown,
),
const SizedBox.shrink(),
],
Expand Down

0 comments on commit 7ac1c96

Please sign in to comment.