Skip to content

Xapptor/xapptor_router

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

60 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Xapptor Router

pub package

Router Module for Web and Mobile Navigation.

Let's get started

1 - Depend on it

Add it to your package's pubspec.yaml file
dependencies:
    xapptor_router: ^0.0.2

2 - Install it

Install packages from the command line
flutter pub get

3 - Learn it like a charm

Call your start_screens_config function in your main.dart

Future<void> main() async {
    WidgetsFlutterBinding.ensureInitialized();
    await Firebase.initializeApp();
    Paint.enableDithering = true;
    SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
    start_screens_config();
}

Create start_screens_config function

* Set current_build_mode

* Set landing_screen

* Set unknown_screen

* Add new app screens with add_new_app_screen function

* Final step is call runApp function using the default Xapptor App class, setting your app_name and theme

start_screens_config() {
    current_build_mode = BuildMode.release;
    landing_screen = Landing();
    unknown_screen = UnknownScreen(
        logo_path: logo_image_path,
    );

    add_new_app_screen(
        AppScreen(
            name: "login",
            child: UserInfoView(
                text_list: [
                    "Email",
                    "Password",
                    "Remember me",
                    "Log In",
                    "Recover password",
                    "Register",
                ],
                tc_and_pp_text: RichText(text: TextSpan()),
                gender_values: [],
                country_values: [],
                text_color: Colors.blue,
                first_button_color: Colors.white,
                second_button_color: Colors.white,
                third_button_color: Colors.white,
                logo_image_path: "your_image_path",
                has_language_picker: false,
                topbar_color: Colors.blue,
                custom_background: null,
                user_info_form_type: UserInfoFormType.login,
                outline_border: true,
                first_button_action: null,
                second_button_action: open_forgot_password,
                third_button_action: open_register,
                has_back_button: true,
                text_field_background_color: null,
            ),
        ),
    );

    add_new_app_screen(
        AppScreen(
            name: "privacy_policy",
            child: PrivacyPolicy(
                base_url: "https://www.domain.com",
                use_topbar: false,
                topbar_color: Colors.blue,
            ),
        ),
    );

    add_new_app_screen(
        AppScreen(
            name: "home",
            child: Home(),
        ),
    );

    runApp(
        App(
            app_name: "MyAppName",
            theme: ThemeData(
                primarySwatch: your_material_color,
                fontFamily: 'VarelaRound',
                textButtonTheme: TextButtonThemeData(
                    style: TextButton.styleFrom(
                        padding: EdgeInsets.only(
                            left: 20,
                            right: 20,
                        ),
                    ),
                ),
            ),
        ),
    );
}

You can open a screen calling the function open_screen and passing the name of the screen:

open_screen("home/courses");

4 - Check Abeinstitute Repo for more examples

Abeinstitute Repo

Abeinstitute

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages