Skip to content

Latest commit

 

History

History
42 lines (33 loc) · 2.05 KB

intro.md

File metadata and controls

42 lines (33 loc) · 2.05 KB

Introduction

The basic skeleton of the project is created without any external dependencies. If you would like to create similar project to learn about Flutter widgets, you can reuse all the codes of the base branch. I hope it is useful to you and save you some efforts and times.

Note: While the code in the base branch still working fine, the Fluwix no longer using the code structure described below. Please refer to the lib/main.dart of the main branch for latest code structure and the blog post to find out the reason I adopted flutter_modular package.

Directory Structure

The project following certain naming conventions and directory stucture as per the following image and description:

Directory Structure

  • The common/presentation/widgets directory stored the codes of reusable widgets of the project

  • Each widget will be coded in separate branch and come with it's own README.md file. The recommended naming convention is the directory name in lib and images directory is same with the branch name and the main file of the widget is branch_name_screen.

  • The nested_list is a good example on the image above and please check out the branch.

How to Add New Widget

In the lib\main.dart file:

  1. Add the name of new widget to the names list:
    List<String> names = [
      'Nested List',
      'Tab Buttons',
      'Stock Chart',
      'New Widget', // example
    ];
  1. Open the new widget's screen in onTap event of the list view, 3 is the position of new widget in names list:
    onTap: () {
        switch (position) {
        case 0:
            _gotoScreen(context, NestedListScreen());
            break;
        case 3: // example
            _gotoScreen(context, NewWidgetScreen()); // example
            break; // example
        }
    },