-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Reordering items within the same level. #4
- Loading branch information
1 parent
62ef04c
commit 35651d2
Showing
4 changed files
with
165 additions
and
25 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,59 @@ | ||
[ | ||
{ | ||
"id": 1, | ||
"index_in_level": 0, | ||
"title": "People", | ||
"tiles": [ | ||
{ | ||
"id": 2, | ||
"index_in_level": 0, | ||
"title": "Online Now", | ||
"tiles": [ | ||
{ | ||
"id": 3, | ||
"index_in_level": 0, | ||
"title": "Family", | ||
"tiles": [] | ||
}, | ||
{ | ||
"id": 4, | ||
"index_in_level": 1, | ||
"title": "Friends", | ||
"tiles": [ | ||
{ | ||
"id": 5, | ||
"index_in_level": 0, | ||
"title": "Sports Team", | ||
"tiles": [] | ||
}, | ||
{ | ||
"id": 6, | ||
"index_in_level": 1, | ||
"title": "Gamerz", | ||
"tiles": [] | ||
} | ||
] | ||
}, | ||
{ | ||
"id": 7, | ||
"index_in_level": 2, | ||
"title": "Work", | ||
"tiles": [] | ||
} | ||
] | ||
}, | ||
{ | ||
"id": 8, | ||
"index_in_level": 1, | ||
"title": "Everyone", | ||
"tiles": [] | ||
} | ||
] | ||
}, | ||
{ | ||
"id": 9, | ||
"index_in_level": 1, | ||
"title": "Potaro", | ||
"tiles": [] | ||
} | ||
] |
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,27 @@ | ||
import 'dart:convert'; | ||
|
||
import 'package:flutter/services.dart'; | ||
|
||
import 'tiles.dart'; | ||
|
||
mixin SettingsManagerMixin { | ||
final jsonFilePath = 'assets/menu_items.json'; | ||
|
||
|
||
/// Loads the MenuItemInfo list from the json file | ||
Future<List<MenuItemInfo>> loadMenuItems() async { | ||
// Get string from json | ||
final String response = await rootBundle.loadString(jsonFilePath); | ||
List<dynamic> data = await json.decode(response); | ||
|
||
// Converting json to list of MenuItemInfo objects | ||
final List<MenuItemInfo> menuItems = data.map((obj) => MenuItemInfo.fromJson(obj)).toList(); | ||
|
||
// Return the MenuItemInfo list | ||
return menuItems; | ||
} | ||
|
||
|
||
|
||
|
||
} |
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