init_screen 1.3.4

  • Readme
  • Changelog
  • Example
  • Installing
  • 65

init_screen #

An easy to use, multipurpose init screen to introduce your app

WARNING
If you don't supply a custom NavButton you have to add the Material Design Icon package.
Just add material_design_icons_flutter: any to your dependencies in your pubspec.

Example usage #

The most basic example would be to return the InitScreen class, for example in your login activity:

@override
build(BuildContext context) {
    return InitScreen([Text("hi"), Text("am"), Text("sample content")]);
}

This creates a init screen and displays its' three children.
You can throw in any Widget you like but be aware that InitScreen just centers them.
You must supply a layout yourself.

Modification #

You can change a lot of behavior and stuff surrounding the InitScreen class.
For a complete list please see the InitScreen class.

But heres an example of how to change the NavButtons:

class MyInitScreen extends State<MyHomePage> {

    // that one is important! Don't miss out that the GlobalKey must be for InitScreenState
    final GlobalKey<InitScreenState> _key = GlobalKey();

    _buildWithCustomNavs() {
        return InitScreen(
            // children to display
            [Text("test"), Text("[3]")],
            key: _key, // needed for callback
            customNavButtonBuilder: (index) { // custom NavButton builder
                return IconButton(
                    icon: Icon(Icons.ac_unit),
                    // must use the public callback
                    onPressed: () => _key.currentState.navBtnClick(index),
                );
            },
        );
    }

    @override
    Widget build(BuildContext context) {
        return _buildWithCustomNavs();
    }
}

[1.3.4] - 08.06.2020 #

Fix nav bar overlap #

  • wrapped navbar with material in stack -> otherwise results in flutter error

[1.3.3] - 08.06.2020 #

Feature nav bar overlap optimization #

  • removed resizeToAvoidBottomPadding again cause of unwanted behavior
  • now nav bar is in separate stack independent of scaffold

[1.3.2] - 08.06.2020 #

Feature nav bar overlap #

  • added resizeToAvoidBottomPadding to scaffold -> keyboard overlaps navbar now
  • cleaned codebase

[1.3.1] - 07.06.2020 #

Feature nav helper end text modification #

  • nav helper end text now must be text widget -> easier to modify

[1.3.0] - 05.06.2020 #

Feature nav bar #

  • added optional nav bar -> can't be used together with nav buttons

[1.2.4] - 05.06.2020 #

Feature nav btn color #

  • added option to only change the nav btn color

[1.2.3] - 05.06.2020 #

Fix Merge conflict #

  • messed up merge, now fixed 👍

[1.2.2] - 05.06.2020 #

Feature background color #

  • yeah added background colors

[1.2.1] - 04.06.2020 #

Fix Navigation Helpers #

  • fixed positioning if nav helpers are not shown

[1.2.0] - 04.06.2020 #

Feature Navigation Helpers #

  • added validation as parameter if you already can change the page

[1.1.0] - 04.06.2020 #

Feature Navigation Helpers #

  • added icon buttons that help with navigation orientation
  • added customization options for them
  • changed default NavButton icon

[1.0.0] - 04.06.2020 #

Initial Release #

  • added InitScreen class
  • added customization possibilities
  • added examples

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:init_screen/init_screen.dart';

import 'agb.dart';

void main() {
    runApp(MyApp());
}

class MyApp extends StatelessWidget {
    @override
    Widget build(BuildContext context) {
        return MaterialApp(
            title: 'init_screen demo',
            home: MyHomePage(),
        );
    }
}

class MyHomePage extends StatefulWidget {

    @override
    _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {

    final GlobalKey<InitScreenState> _key = GlobalKey();
    final GlobalKey<FormState> _formKey = GlobalKey<FormState>();
    var _controller = TextEditingController();

    _buildAGB() {
        return SingleChildScrollView(
            child: Container(
                padding: EdgeInsets.all(20),
                child: AGB(),
            ),
        );
    }

    _buildWithCustomNavs() {
        return InitScreen(
            children: [Text("test"), _buildAGB(), Text("[3]")],
            key: _key, // needed for callback
            customNavButtonBuilder: (index) { // custom NavButton builder
                return IconButton(
                    icon: Icon(Icons.ac_unit),
                    onPressed: () => _key.currentState.navBtnClick(index),
                );
            },
        );
    }
    
    _buildWithValidator() {
        return InitScreen(
            children: [
                Padding(
                    padding: EdgeInsets.only(left: 64, right: 64),
                    child: Center(
                        child: Form(
                            key: _formKey,
                            child: TextFormField(
                                controller: _controller,
                                validator: (val) {
                                    if (val.isEmpty)
                                        return "Must not be empty!";
                                    return null;
                                },
                            ),
                        ),
                    ),
                ),
                Text("Hey you reached me!")
            ],
            validatorKey: _formKey,
        );
    }

    _buildSimple() {
        return InitScreen(
            children: [
                Text("hi"),
                SingleChildScrollView(
                    child: TextField(),
                ),
                Text("simple")
            ],
            showNavHelpers: true,
            showNavBar: true,
            showNavButtons: false,
        );
    }

    @override
    Widget build(BuildContext context) {
        return _buildSimple();
    }
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  init_screen: ^1.3.4

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:init_screen/init_screen.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
29
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
65
Learn more about scoring.

We analyzed this package on Jul 7, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.4
  • pana: 0.13.13
  • Flutter: 1.17.5

Analysis suggestions

Package not compatible with SDK dart

because of import path [init_screen] that is in a package requiring null.

Health suggestions

Format lib/init_screen.dart.

Run flutter format to format lib/init_screen.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.7.0 <3.0.0
flutter 0.0.0
material_design_icons_flutter ^4.0.5345 4.0.5345
Transitive dependencies
collection 1.14.12 1.14.13
meta 1.1.8 1.2.1
sky_engine 0.0.99
typed_data 1.1.6 1.2.0
vector_math 2.0.8
Dev dependencies
flutter_test