init_screen 1.0.0 init_screen: ^1.0.0 copied to clipboard
An easy to use, multipurpose init screen to introduce your app
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();
}
}