๐Ÿš€ This is mobile application using Flutter for develop a pizza store

Overview

Flutter Pizza Hut ๐Ÿ•

Description:

  • ๐Ÿš€ This is mobile application using Flutter for develop a pizza store

  • ๐Ÿš€ Factory Method

  • Create Enum product_type.dart & location_type.dart

enum ProductType {
  burger,
  pizza,
  chicken,
  chips,
}

enum LocationType {
  hanoi,
  danang,
  hochiminh,
}
  • Create Abstract Class - food.dart
import 'package:flutter_pizza_store/src/events/location_event.dart';
import 'package:flutter_pizza_store/src/models/product.dart';

abstract class Food {
  void initial() {}

  void filterByLocation(LocationType location) {}

  List<Product> products() {
    return [];
  }
}
  • Create Concrete Class - burger.dart, similar with pizza.dart, chicken.dart, chips.dart
import 'package:flutter_pizza_store/src/events/location_event.dart';
import 'package:flutter_pizza_store/src/events/product_event.dart';
import 'package:flutter_pizza_store/src/models/food.dart';
import 'package:flutter_pizza_store/src/models/product.dart';
import 'package:flutter_pizza_store/src/repository/product_repository.dart';

class Burger implements Food {
  List<Product> _products = [];

  @override
  void initial() {
    allProducts.forEach((product) {
      if (product.type == ProductType.burger) _products.add(product);
    });
  }

  @override
  void filterByLocation(LocationType location) {
    _products
        .where((e) {
          return e.location != location;
        })
        .toList()
        .forEach((_products.remove));
  }

  @override
  List<Product> products() {
    return _products;
  }
}
  • Create Factory Class - food_factory.dart
import 'package:flutter_pizza_store/src/events/product_event.dart';
import 'package:flutter_pizza_store/src/models/burger.dart';
import 'package:flutter_pizza_store/src/models/chicken.dart';
import 'package:flutter_pizza_store/src/models/chips.dart';
import 'package:flutter_pizza_store/src/models/food.dart';
import 'package:flutter_pizza_store/src/models/pizza.dart';

class FoodFactory {
  static Food getFood(ProductType type) {
    switch (type) {
      case ProductType.burger:
        return Burger();
      case ProductType.pizza:
        return Pizza();
      case ProductType.chicken:
        return Chicken();
      case ProductType.chips:
        return Chips();
      default:
        return Burger();
    }
  }
}

How I can run it?

  • ๐Ÿš€ Clone this repo
  • ๐Ÿš€ Run below code in terminal of project
flutter pub get
flutter run

Screenshots

Author: lambiengcode

You might also like...

A new Flutter application. Done for mobile computing lab practical

A new Flutter application. Done for mobile computing lab practical

Notes-app-using-flutter A new Flutter application. Done for mobile computing lab

Feb 7, 2022

A Mobile Application for NITT students to digitally unlock/lock shared-cycles in stands.

A Mobile Application for NITT students to digitally unlock/lock shared-cycles in stands.

CycleLock App A Mobile Application for NITT students to digitally unlock/lock shared-cycles in stands. Requirements Java-Version - '12.x' Flutter-Vers

Nov 6, 2022

A mobile travel app is a software application that has been developed specifically for use on smaller devices

A mobile travel app is a software application that has been developed specifically for use on smaller devices

A mobile travel app is a software application that has been developed specifically for use on smaller devices, such as smartphones and tablets, and can be used by business travellers to book and manage their travel whilst on the move

Apr 27, 2022

Clock app - A mobile application where to set alarm, timer and stopwatch

Clock app - A mobile application where to set alarm, timer and stopwatch

Clock App Mobile application to check the time, set alarm, timer and stop watch

Dec 31, 2022

A simple pokedex mobile application

A simple pokedex mobile application

A simple pokedex mobile application. That contains provider for state management, custom routing, find dominat color with palette generator, send request to api and get response from api.

Feb 22, 2022

Drishti is a simple mobile application created as a project for YIP KDISC and Google Devs Solution Challenge

Drishti is a simple mobile application created as a project for YIP KDISC and Google Devs Solution Challenge

Drishti is a simple mobile application created as a project for YIP KDISC and Google Devs Solution Challenge. This app aims to make reporting and spreading the news of accidents and dangers easier and effective.

Nov 29, 2022

ReverseHand is a mobile application that was created with the vision of helping to reduce any power imbalances that consumers may face when seeking trade services.

ReverseHand is a mobile application that was created with the vision of helping to reduce any power imbalances that consumers may face when seeking trade services.

ReverseHand is a mobile application that was created with the vision of helping to reduce any power imbalances that consumers may face when seeking trade services. To achieve this, the mobile application allows consumers to make their needs for services known in the form of job listings, where tradesmen are able to place bids in order to be chosen and hired.

Nov 2, 2022

A simple recipe showing application made using Flutter , using card Views MaterialPageRoute etc.

recipes A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to get you started if this

Oct 31, 2021

A tourism mobile app using flutter

A tourism mobile app using flutter

Palghar Tourism project_description Explore the docs ยป View Demo ยท Report Bug ยท Request Feature Table of Contents About The Project Built With Getting

Dec 9, 2022
Owner
Dao Hong Vinh
I am a Mobile App Developer ๐Ÿผ
Dao Hong Vinh
This is project using flutter and firebase for develop a mobile application about online school

This is project using flutter and firebase for develop a mobile application about online school

Hackathon 4 May 17, 2021
Phone-Store-App-UI-Flutter - Flutter Phone E-Store App UI with support for dark and light mode

Phone-Store-App-UI-Flutter - Flutter Phone E-Store App UI with support for dark and light mode

Jakub Sobaล„ski 2 Apr 30, 2022
Flutter Chat Socket - using Flutter for develop a realtime chat app

Flutter Chat Socket - using Flutter for develop a realtime chat app

Rois Khoiron 4 Dec 7, 2022
Watches store app built with flutter

watch_store Screenshots: Getting Started This project is a starting point for a Flutter application. A few resources to get you started if this is you

Muhammed Abdel Dayem 0 Nov 2, 2021
Counter - A simple flutter app to count how many people are in a store/building

People counter made with Flutter Summary About the app Preview of the finished a

Luan Silva da Silva 1 Feb 12, 2022
This is mobile application fortune telling using Flutter for development.

Flutter Tarot Card Description: This is mobile application fortune telling using Flutter for development. How I can run it? ?? Clone this repository ?

Dao Hong Vinh 17 Sep 25, 2022
๐ŸƒLossy is a mobile application built using flutter framework and firebase for android.

Lossy The Weight and Fitness Tracker App. Lossy is a mobile application built using flutter framework and firebase for android. Track your daily weigh

LakhanKumawat แต–โบ 8 Nov 26, 2022
Movies Mobile Application to demonstrate Network calls in Flutter using with Chopper library

Movies Mobile Application to demonstrate Network calls in Flutter using with Chopper library. For API TMDB API console is used.

Varun Verma 1 Nov 7, 2022
ChitChat - a mobile application built using flutter framework and firebase for android

This is a flutter app made using dart programming language . It uses firebase api to store and fetch data . It also uses native devices features such as library and camera . You can signup or login through your mail and can chat easily with your colleagues .

LakhanKumawat แต–โบ 5 Nov 6, 2022
Flutter ThingsBoard PE Mobile Application

Flutter ThingsBoard PE Mobile Application Getting Started This project is a starting point for a ThingsBoard PE Mobile application. A few resources to

ThingsBoard - Open-source IoT Platform 65 Dec 8, 2022