#!/usr/bin/env python # coding: utf-8 # # "Coding Period: Week 3" # > "Working on Home Screen backend with BLoC Architecture" # # - toc: false # - branch: master # - badges: true # - comments: true # - hide: false # - search_exclude: true # This week I learned BLoC Architecture in Flutter, I understood it quickly from YouTube videos. I started implementing it in App. # # I will try to explain first what BLOC components should do as short as possible (and as trivial as possible). # # * UI screen - obviously shows data to the user # # * BLOC (or the ViewModel) - decides HOW to display data to the user, do we make the text bold, do we show the error, do we go to next screen. # # * Repo - decides WHAT data to display to the user (do we show the content from db, do we fetch it from API) # # ### Working on Home Screen Backend # I have created BLoC for home screen & location services, I have done the following tasks in Home screen # # 1. Fetched & Displayed User Location using Geolocator Package # App will ask for location permission & will access location of user, I have used two packages # # * location - For asking GPS Permission # # * GeoLocator - For Getting coordinates of user location # # 2. Fetched Nearby Hospitals using Overpass API # # * Used Overpass API for Getting Nearby Hospitals, I have to pass Location Coordinates & radius to get hospitals around my Location # # * Then I Parsed JSoN data recieved to list of objects # # 3. Fetching Image of each hospital from Google # # * For fetching images, I have Used FutureBuilder Widget in flutter which executes a function which searches on Google by Hospital name & fetches the HTML Response, Then I get the link of first image & pass it to another widget Cached Netwrok Image which loads the image. # # 4. Using Shimmer Loading Effect to load list # # * I have use flutter shimmer package for doing this, I have created a ListTile for this, While the data is Loading I display this. # # ### GIF of Home Screen # # ![Home Demo](https://github.com/Darshpreet2000/My-Blog/blob/master/images/home_demo.gif?raw=true) # # ### SQL Database Class # # Completed Main functionality of SQL Database class # # * Implemented Basic Insertion in SQL Database using Flutter **sqflite** package, Some Other function are remaining which I will complete in upcoming weeks # # # ### Working on Web Crawler # # Scraped CDM of Indiana State # # * I have Used Data Provided by Indiana State, It contains discharge data of Hospitals of 2018, I have scraped data using scrapy, processed data to proper column names using python. # # # ### What do I plan to do next week # # 1. I have used shared pref to store some data, I will replace it with Hive # # 2. I will use sqflite to store CDM # # 3. Working on Main Feature of this App [ Compare Prices Screen] # # 4. Scraping CDM of New York State # # #