Skip to content

Commit

Permalink
Connected settings open in drawer
Browse files Browse the repository at this point in the history
  • Loading branch information
hmziqrs committed Sep 27, 2020
1 parent dc2cee2 commit 3076b8e
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 9 deletions.
12 changes: 12 additions & 0 deletions lib/screens/HomeScreen/widgets/Drawer/HomeDrawer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,16 @@ class _HomeDrawerState extends State<HomeDrawer> with AnimationMixin {
}
}

void buttonHandler(data.NavigationKey key) {
switch (key) {
case data.NavigationKey.settings:
Provider.of<ScreenStateProvider>(context, listen: false)
.isSettingsOpen = true;
break;
default:
}
}

@override
Widget build(BuildContext context) {
final state = Provider.of<HomeProvider>(context, listen: false);
Expand Down Expand Up @@ -135,6 +145,8 @@ class _HomeDrawerState extends State<HomeDrawer> with AnimationMixin {
.map(
(entry) => HomeDrawerButton(
entry: entry,
onPressed: () => this.buttonHandler(
entry.value["key"]),
baseAnimation: this.animation.value,
),
)
Expand Down
8 changes: 5 additions & 3 deletions lib/screens/HomeScreen/widgets/Drawer/HomeDrawerButton.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,14 @@ enum AnimProp { opacity }

class HomeDrawerButton extends StatelessWidget {
HomeDrawerButton({
@required this.entry,
@required this.onPressed,
@required this.baseAnimation,
@required MapEntry<int, Map<String, String>> this.entry,
});

final double baseAnimation;
final MapEntry<int, Map<String, String>> entry;
final VoidCallback onPressed;
final MapEntry<int, Map<String, Object>> entry;

@override
Widget build(BuildContext context) {
Expand Down Expand Up @@ -47,7 +49,7 @@ class HomeDrawerButton extends StatelessWidget {
horizontal: AppDimensions.padding * 2,
),
child: RaisedButton(
onPressed: () {},
onPressed: this.onPressed,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(4.0),
),
Expand Down
21 changes: 15 additions & 6 deletions lib/screens/HomeScreen/widgets/Drawer/data.dart
Original file line number Diff line number Diff line change
@@ -1,28 +1,37 @@
import '../../messages/keys.dart';

enum NavigationKey {
home,
moies,
developer,
designer,
download,
settings,
}

final list = [
{
"label": HomeScreenMessages.drawerHome,
"key": "home",
"key": NavigationKey.home,
},
{
"label": HomeScreenMessages.drawerMovies,
"key": "moies",
"key": NavigationKey.moies,
},
{
"label": HomeScreenMessages.drawerDeveloper,
"key": "developer",
"key": NavigationKey.developer,
},
{
"label": HomeScreenMessages.drawerDesigner,
"key": "developer",
"key": NavigationKey.designer,
},
{
"label": HomeScreenMessages.drawerDownload,
"key": "download",
"key": NavigationKey.download,
},
{
"label": HomeScreenMessages.drawerSettings,
"key": "settings",
"key": NavigationKey.settings,
},
];

0 comments on commit 3076b8e

Please sign in to comment.