Code Monkey home page Code Monkey logo

assesment's Introduction

Abdul Rehman assessment

Overview

This Flutter application is developed as part of the Flutter Dynamic Form Builder Task. The objective of this task is to create an application capable of dynamically generating and displaying a form based on JSON input. The form's field visibility changes according to user selections, guided by visibility rules defined within the JSON. The application adapts to any modifications in the JSON structure.

JSON Structure

The application accepts JSON input that defines the form fields, their types, valid values (for dropdowns), and visibility conditions. Below is an example of the expected JSON format:

[
  {
    "field_name": "f1",
    "widget": "dropdown",
    "valid_values": ["A", "B"]
  },
  {
    "field_name": "f2",
    "widget": "textfield",
    "visible": "f1=='A'"
  },
  {
    "field_name": "f3",
    "widget": "textfield",
    "visible": "f1=='A'"
  },
  {
    "field_name": "f4",
    "widget": "textfield",
    "visible": "f1=='A'"
  },
  {
    "field_name": "f5",
    "widget": "textfield",
    "visible": "f1=='B'"
  },
  {
    "field_name": "f6",
    "widget": "textfield",
    "visible": "f1=='B'"
  }
]

Key Features

  • Dynamic Form Generation: The app dynamically creates dart model which in turns are used to render form fields based on the provided JSON input.

  • Conditional Visibility: Fields are shown or hidden based on the conditions specified in the "visible" attribute of the JSON. These conditions evaluate based on the user's input.

  • State Management: Riverpod is the state management tool used for managing the state of the form, including the visibility and values of the fields.

  • Widget Build Optimization: The Flutter build mechanism rebuilds only widgets that are necessary based on user interaction and changes in visibility conditions.

Technical Considerations

  • Error Handling: for a malformed or json data that doesn't meet the requirement, the model that convert json to dart model handles this as there won't be a form data if the json doesn't have the specified keys that translates to form data

  • Extensibility: The Solution i have here handles all scenerios the form can come and will render appropriately.

assesment's People

Contributors

arsarsars1 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.