{"id":20516978,"url":"https://github.com/hellbus1/suitmedia_first_phase","last_synced_at":"2026-04-18T12:38:21.198Z","repository":{"id":68912160,"uuid":"384666170","full_name":"HellBus1/suitmedia_first_phase","owner":"HellBus1","description":null,"archived":false,"fork":false,"pushed_at":"2021-09-07T09:54:12.000Z","size":285,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-16T10:11:13.375Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Dart","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/HellBus1.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-07-10T10:01:35.000Z","updated_at":"2024-04-04T12:45:41.000Z","dependencies_parsed_at":null,"dependency_job_id":"d97be36d-6ad5-4347-9c2c-6f2b3378afcc","html_url":"https://github.com/HellBus1/suitmedia_first_phase","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HellBus1%2Fsuitmedia_first_phase","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HellBus1%2Fsuitmedia_first_phase/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HellBus1%2Fsuitmedia_first_phase/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HellBus1%2Fsuitmedia_first_phase/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/HellBus1","download_url":"https://codeload.github.com/HellBus1/suitmedia_first_phase/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242120247,"owners_count":20074878,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-15T21:33:13.512Z","updated_at":"2026-04-18T12:38:21.156Z","avatar_url":"https://github.com/HellBus1.png","language":"Dart","funding_links":[],"categories":[],"sub_categories":[],"readme":"# suitmedia_first_phase\n\n## First submission\nI create the app according to the flow, and here is a list of related files :\n1. Home (location: lib/pages/home.dart)\n2. Guest or event chooser (location: lib/pages/event_chooser.dart)\n3. List / table view events (location: lib/pages/event_list.dart)\n4. Grid / collection view guests (location: lib/pages/guest_list.dart)\n\n## Second Submission\n**1. Question 1 (Palindrome Check)**\n\nMy method is using dart's built in function to reverse original string as new variable and compare each other. I think this is not the best method (in term memory and time complexity) but it's simple enough to implement. Here is the piece of code :\n\nLocation lib/pages/home.dart (line 195 - 202)\n\n```dart\n  isPalindrome() {\n    String inputtext = _controller.text;\n    String buffer = _controller.text;\n    String reversedinputtext =\n        String.fromCharCodes(buffer.runes.toList().reversed);\n    print(reversedinputtext);\n    return inputtext == reversedinputtext;\n  }\n```\n\n**2. Question 2 (Determine is prime or not)**\n\nMy method is using iteration from 2 until it's squareroot and do modulo to the question number and the iteration (we don't need to iterate all number until the question number). This method has O(n^1/2) time complexity. Here is the pice of code :\n\nLocation lib/pages/event_chooser.dart (line 177 - 193)\n\n```dart\n  primeChecker(value) {\n    if (value \u003c= 1) {\n      return false;\n    }\n\n    if (value == 2) {\n      return true;\n    }\n\n    for (int i = 2; i \u003c= sqrt(value); i++) {\n      if (value % i == 0) {\n        return false;\n      }\n    }\n\n    return true;\n  }\n```\n\n**3. Question 3**\n\nThe important part are :\n- Implement pull to refresh \u0026 cached data in guest list view\nFor the cached data approach, i use file for storing json, i fill it when there is connection and load it when there is no connection. Thanks to this article https://medium.com/flutter-community/cache-manager-with-flutter-5a5db0d3a3e6 i found how to easily cached data using file with no need worry about permission (it's called Application Directory Path) The library i use are below :\n\n1. Flutter path provider \u003cbr/\u003e\nhttps://pub.dev/packages/path_provider\n\nHere is the piece of code :\n\nLocation lib/provider/main_provider.dart (line 71 - 138)\n\n```dart\n  writeToFile(value) async {\n    String _filePath = await filePath();\n    File userDocumentFile = File(_filePath);\n    userDocumentFile?.writeAsStringSync(value);\n  }\n\n  Future\u003cDirectory\u003e documentsPath() async {\n    String tempPath = (await getApplicationDocumentsDirectory())?.path;\n    return Directory(\"$tempPath\").create();\n  }\n\n  Future\u003cString\u003e filePath() async {\n    final path = (await documentsPath()).path;\n    return \"$path/$fileName\";\n  }\n\n  Future\u003cbool\u003e getFileReadAllData() async {\n    ...\n    try {\n      String _filePath = await filePath();\n      File userDocumentFile = File(_filePath);\n      final data = await userDocumentFile?.readAsString();\n      final jsonData = jsonDecode(data);\n\n      if (jsonData != null) {\n        makeDataList(jsonData);\n        ...\n  }\n\n  makeDataList(data) {\n    guestList.clear();\n    data.forEach((data) {\n      guestList.add(Guest.fromJson(data));\n    });\n  }\n\n  Future\u003cbool\u003e checkConnection() async {\n    var connectivityResult = await (Connectivity().checkConnectivity());\n    if (connectivityResult != ConnectivityResult.none) {\n      ...\n  }\n```\n\nSecond, the pull to refresh method implemented using below's library :\n\n1. Flutter pull to refresh \u003cbr/\u003e\nhttps://pub.dev/packages/pull_to_refresh\n\nTogether with pull action, i force the screen to reload from initial state by pop and push current page. So the screen can check connection again and then decide wheter fetch from internet or cached file.\n\nLocation: lib/pages/guest_list.dart\n\n- Plus button in action button appbar showing list of event with it's location (showed in map) with dummy latlong \nFor this question, we should use fragment rather than activity for the event list map location but flutter is component based framework. So then, i use similar approach to fragments, i use component change for list event and event map which use state variable called pageState to determine which component/fragment to show and it has same root page the event_list.dart. Here is the piece of code :\n\nLocation (parent): lib/pages/event_list.dart\nLocation (component): lib/components/event_list_component.dart \u0026 lib/components/map_view_component.dart\n\n```dart\n    String pageState = \"eventlist\";\n    ...\n    actions: [\n      IconButton(\n          onPressed: () {\n            this.setState(() {\n              this.pageState = 'eventmap';\n            });\n          },\n          icon: Icon(Icons.plus_one)),\n      IconButton(\n          onPressed: () {\n            this.setState(() {\n              this.pageState = 'eventlist';\n            });\n          },\n          icon: Icon(Icons.backspace))\n    ],\n    ...\n    body: Container(\n      margin: EdgeInsets.only(\n          top: 20,\n          bottom: 20,\n          left: MediaQuery.of(context).size.width / 25,\n          right: MediaQuery.of(context).size.width / 25),\n      child: (this.pageState == \"eventlist\")\n          ? EventListComponent(provider: provider)\n          : MapViewComponent(provider: provider),\n    ),\n```\n\nI improve the tasked feature a litte bit by adding another button to return list of event page component. For the event list map, i use dynamic tabbar with event name as the tab title. Together with tabbar it will create map page for each of them and showing location mark that corresponds its latlong dummy. For the map, i use library below :\n\n1. Flutter map : \u003cbr/\u003e\nhttps://pub.dev/packages/flutter_map\n\nLocation: lib/components/map_view_component.dart\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhellbus1%2Fsuitmedia_first_phase","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhellbus1%2Fsuitmedia_first_phase","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhellbus1%2Fsuitmedia_first_phase/lists"}