scroll_navigation

Features

  • Scrolling pages by gestures.
  • Page movement when tapping an icon.
  • Indicator that follows the scroll.
  • Works with the back button.
  • Fancy animations.
  • Customizable colors.
  • Easy and powerful implementation! :)


Implementation

return ScrollNavigation(
  //DEFAULT VALUES
  //initialPage = 0,
  //navigationOnTop = false,
  //showIdentifier = true,
  //identifierPhysics = true,
  //identifierOnBottom = true,
  //identifierWithBorder = false,
  //activeColor = Colors.blue,
  //desactiveColor = Colors.grey,
  //backgroundBody = Colors.grey[100],
  //backgroundNav = Colors.white,
  //verticalPadding = 18,
  //elevation = 3.0,
  //navItemIconSize = 24.0,
  //navItemTitleFontSize = 12.0,
  pages: <Widget>[
    Screen(title: title("Camera")),
    Screen(title: title("Messages"), backgroundColor: Colors.yellow[50]),
    Screen(title: title("Favor"), body: Container(color: Colors.cyan[50])),
    Screen(title: title("Activity"), backgroundColor: Colors.yellow[50]),
    Screen(title: title("Home"))
  ],
  navItems: <ScrollNavigationItem>[
    ScrollNavigationItem(icon: Icon(Icons.camera)),
    ScrollNavigationItem(icon: Icon(Icons.chat)),
    ScrollNavigationItem(icon: Icon(Icons.favorite)),
    ScrollNavigationItem(icon: Icon(Icons.notifications)),
    ScrollNavigationItem(
      icon: Icon(Icons.home),
      activeIcon: Icon(Icon: verified_user))
  ],
  pagesActionButtons: <Widget>[
    FloatingActionButton( //PAGE 1
      child: Icon(Icons.receipt),onPressed: () => null
    ),
    null,
    FloatingActionButton( //PAGE 3
      child: Icon(Icons.sync), onPressed: () => null,
    ),
    null,
    FloatingActionButton( //PAGE 5
      child: Icon(Icons.add), onPressed: () => print("Cool :)"),
    ),
  ],
);






Scroll Navigation Details

(It's recommended to set showAppBar = false on the Screen Widget)

navigationOnTop = TruenavigationOnTop = False

Go to a Page Code

final navigationKey = GlobalKey<ScrollNavigationState>();

@override
Widget build(BuildContext context) {
  return ScrollNavigation(
    key: navigationKey,
    navigationOnTop = true, //Default is false
    pages: <Widget>[],
    navItems: <ScrollNavigationItem>[],
  );
}

void goToPage(int index) {
  navigationKey.currentState.goToPage(index);
}






Identifier Details

identifierPhysics = TrueidentifierPhysics = False



identifierOnBottom = FalseshowIdentifier = False

Code

return ScrollNavigation(
    showIdentifier = true,
    identifierPhysics = true,
    identifierOnBottom = true,
    pages: <Widget>[],
    navItems: <ScrollNavigationItem>[],
);






Screen Details

Screen fixes some problems the Scaffold has with the ScrollNavigation.

Without WidgetsWith Widgets

Without Widgets Code

return Screen();

With Widgets Code

return Screen(
    title: title("Home"), //Function in the Example
    leftWidget: Icon(Icons.menu, color: Colors.grey),
    rightWidget: Icon(Icons.favorite, color: Colors.grey),
);



Hide AppBar on scroll.


Code

ScrollController controller = ScrollController();

return Screen(
    height: 56.0,
    elevation: 0.0,
    centerTitle: false,
    title: title("Title Scroll"),
    leftWidget: ScreenReturnButton(), //IMPORTANT TO RETURN!
    controllerToHideAppBar: controller,
    body: ListView.builder(
      itemCount: 15,
      controller: controller,
      itemBuilder: (context, key) {
        return Padding(
          padding: EdgeInsets.symmetric(vertical: 5),
          child: Container(
            height: 50,
            color: Colors.blue[50],
          ),
        );
      },
    ),
  );






Title Scroll Navigation Details


Code

return TitleScrollNavigation(
    titles: ["Page 1", "New page", "Second new page"],
    pages: [
      Container(color: Colors.blue[50]),
      Container(color: Colors.red[50]),
      Container(color: Colors.yellow[50]),
    ],
);

Libraries

screen
scroll_navigation
scroll_navigation
title_scroll_navigation