NETFLIX APPBAR IMITATION PACKAGE

Dremar Design

WATCH THE VIDEO EXAMPLE

The package will allow you to simulate the Netflix app menu behavior.

The class i created is just a simple imitation, so there can be stack memory problems or graphical performance issues on older devices.

HOW TO USE IT

You need page_transition (at least version 1.0.0) and after_layout (at least version 1.0.5) in order to use this package.

After you have imported it, you should create your personalized Stateful or Stateless Widget classes. After you did this, on your main default function you have to create a list of objects and to return the NetflixAppBar instance.

  • LIST OF OBJECTS

    Let's create a simple list of objects

    //we initialize the list
    List<DrTextTransitionTitleObject> titles = new List();
    
    //we add a new Widget class, one of them you created
    titles.add(new DrTextTransitionTitleObject("title", "slug", your_class_name()));
    
  • NetflixAppBar ARGUMENTS
   NetflixAppBar(List<DrTextTransitionTitleObject> titles, int duration,
      {Widget header,
      double headerHeight = 0,
      Color background = Colors.transparent,
      Color appBarColor,
      int dumping = 100,
      double titlePaddingLeft = 16,
      double titlePaddingRight = 15,
      double titleActiveFontSize = 20,
      double maxOpacity = 0.6,
      double initialOpacity = 0,
      bool pinned = false,
      TextStyle titleStyles = const TextStyle(
          color: Colors.white, fontSize: 16, fontWeight: FontWeight.bold),
      Widget leading,
      Function(ScrollController, String, NetflixAppBar) onScreenChange,
      MainAxisAlignment mainAxisAlignment})
TITLETYPEDESCRIPTIONDEFAULT VALUE
titlesListThe list of objects you initially creatednull
durationintThe duration (in milliseconds) of your menu animationnull
headerWidgetThe AppBar header, it's optionalnull
headerHeightdoubleThe AppBar header height0
backgroundColorThe main color of the Scaffold NetlixToolbar will returnColors.transparent
appBarColorColorThe main color of the AppBarColors.purpleAccent.withOpacity(0.7)
dumpingintMore the value is bigger more the user has to scroll down before the AppBar disappears100
titleStylesTextStyleThe Style you want to set up to your menu titlesconst TextStyle( color: Colors.white, fontSize: 16, fontWeight: FontWeight.bold),
titlePaddingLeftdoubleThe padding left that should have the titles' row16
titlePaddingRightdoubleThe padding right that should have the title row15
titleActiveFontSizedoubleThe font size of the Title Label during a transition20
leadingWidgetThe leading AppBar Widgetnull
pinnedboolIf you want the AppBar always fixed on the top set pinned to truefalse
initialOpacitydoubleThe initial and minimum opacity of the AppBar0
maxOpacitydoubleThe max opacity the AppBar can reach while the user scrolls down. AppBar opacity will reach your value following the dumping value you set0.6
onScreenChangeFunction(ScrollController, String, NetflixToolbar)A function that will allow you to get the control of the current screennull
mainAxisAlignmentMainAxisAlignmentAppBar title row mainAxisAlignmentMainAxisAlignment.spaceBewteen when titles length is > 2; MainAxisAlignment.start when titles length is <= 2

Example:


      List<DrTextTransitionTitleObject> titles = new List();

      titles.add(new DrTextTransitionTitleObject("Movies", "movies", Movies()));
      titles.add(new DrTextTransitionTitleObject("Tv Series", "tv", Tv()));
      titles.add(new DrTextTransitionTitleObject("About Me", "about", AboutUs()));

      int milliseconds = 700;

      TextStyle titleStyles = const TextStyle(
          fontFamily: "Dr1",
          color: Colors.white,
          fontSize: 18,
          fontWeight: FontWeight.bold);

      instance = NetflixAppBar(
        titles,
        milliseconds,
        initialOpacity: 0.3,
        maxOpacity: 1,
        dumping: 100,
        titleStyles: titleStyles,
        titleActiveFontSize: 21,
        appBarColor: Colors.black,
        background: Colors.black,
        onScreenChange:
            (ScrollController controller, String slug, NetflixAppBar instance) {
          print("Controller received correctly \n We are on $slug screen");
          this.currentSlug = slug;
          this.instance = NetflixAppBar.getInstance();
          var newTitles = this.instance.titles;

          //....

        },
      );
      return instance;

IMPORTANT

after the first screen transition the class that wraps NetflixAppBar instance will be disposed, so be careful.

STATIC FUNCTIONS

  • getInstance()

    NetflixAppBar.getInstance() will return the current NetflixAppBar instance. So you can get info about current titles, attributes, and so on

  • getContext()

    NetflixAppBar.getContext() will return the current NetflixAppBar instance context

  • notify()

    NetflixAppBar.notify() will allow you to update graphical elements on the current displayed screen

  • goBack()

    NetflixAppBar.goBack() will allow you to return to the previous screen

  • DrTextTransitionTitleObject ARGUMENTS

  DrTextTransitionTitleObject(String name, String heroTag, Widget function,
        {List<DrTextTransitionTitleObject> newTitles,
        bool personalized = false,
        Widget overrideWidget,
        Function overrideAction,
        TextStyle primaryStyle,
        Widget header,
        double headerHeight,
        double paddingLeft = 0})

TITLETYPEDESCRIPTIONDEFAULT VALUE
nameStringThe title valuenull
heroTagStringThis is the label slug, it allows to the app to use it as an Hero Widget tag for the animationsnull
functionWidgetThis is the Widget you want to show up when a user clicks on the label. If you set an overrideAction function then you can set the function property to nullnull
newTitlesListThe list of titles you want to show up when you click on that specific titlenull
personalizedboolIf you set personalized to true it means you want to create a your own Widget for that title on the AppBar. The default widget is an Animated Text Viewfalse
overrideWidgetWidgetIf personalized is true you must specify an overrideWidget. It is the Widget Flutter will show for that title on the AppBarnull
overrideActionFunctionIt is helpful when you want to trigger a personalized function when a user clicks on that title on the menunull
primaryStyleTextStyleThe style you want to give to the default TextView widget that shows the title name on the AppBarnull
paddingLeftdoubleThe padding left you want to give to the default TextView widget that shows the title name on the AppBar0
headerWidgetWhen a user clicks on the title and you don't set an overrideAction this is the new widget will appear on the top of the AppBarnull
headerHeightdoubleThe header widget heightnull

Example:


      List<DrTextTransitionTitleObject> titles = new List();
      List<DrTextTransitionTitleObject> tvTitles = new List();

      var movies = new Movies();
      var tv = new Tv();

      titles.add(new DrTextTransitionTitleObject("Movies", "movies", movies,
          header: switchHeader("movies")));
      titles.add(new DrTextTransitionTitleObject("Tv Series", "tv", tv,
          newTitles: tvTitles, header: switchHeader("movies")));
      titles.add(new DrTextTransitionTitleObject("About Me", "about", AboutUs()));

      tvTitles.add(new DrTextTransitionTitleObject("Tv Series", "tv", tv,
          newTitles: titles,
          header: switchHeader("tv"),
          personalized: true,
          overrideWidget: Icon(
            Icons.search,
            color: Colors.white,
            size: 32,
          )));
      tvTitles.add(new DrTextTransitionTitleObject("Movies", "movies", movies,
          newTitles: titles, paddingLeft: 35));

WEB IMPLEMENTATION

CLICK HERE to see a web example

CONTACTS

You can contact me through Telegram: @dremar_design

DONATIONS

CLICK HERE if you want to pay me a coffee :)

Libraries

netflix_appbar
netflix_appbar_web