搜索插件、代码仓与 APP 分类

GitHub 代码仓mdalameen/bottom_bar_page_transition

bottom_bar_page_transition

mdalameen/bottom_bar_page_transition open-source repository details.

bottom_bar_page_transition 项目封面
星标
7
复刻
1
最近推送(UTC)
2022年7月7日
项目状态
未归档

原始 README

以下为英文项目原文快照,最新内容请访问 GitHub。

bottom_bar_page_transition

Flutter package to display transition for switching pages beween bottom bar page navigation.

Previews

Circular Slide Fade

Features

  • Can be used to show animation while swiching pages in bottom navigation bar
  • Add global key to widget to avoid reinitate widget

Getting Started

Installing

To use this package, add bottom_bar_page_transition as a dependency in your pubspec.yaml file.

In your dart file import the library by

import 'package:bottom_bar_page_transition/bottom_bar_page_transition.dart';

In build method

return Scaffold(
      body: BottomBarPageTransition(
        builder: (_, index) => _getBody(index),
        currentIndex: _currentPage,
        totalLength: totalPage,
        transitionType: transitionType,
        transitionDuration: duration,
        transitionCurve: curve,
      ),
      bottomNavigationBar: _getBottomBar(),
    );

create `_getBody(int index) method to return body of the widget

Widget _getBody(int index) {
    return CustomScrollView(
      //key:_keys[index] //add keys to avoid initiate child widget after animation ends
      slivers: <Widget>[
        SliverAppBar(
          title: Text('Page $index'),
        ),
        SliverFillRemaining(
          child: Center(child: Text('Page $index')),
        )
      ],
    );
  }

create _getBottomBar() to create bottom bar

Widget _getBottomBar() {
    return BottomNavigationBar(
        currentIndex: _currentPage, 
        onTap: (index) {
          _currentPage = index;
          setState(() {});
        },
        selectedItemColor: Colors.blue,
        unselectedItemColor: Colors.grey,
        type: BottomNavigationBarType.fixed,
        items: List.generate(
            totalPage,
            (index) => BottomNavigationBarItem(
                  icon: Icon(icons[index]),
                  title: Text(names[index]),
                )));
  }

Parameter Description

builder - function to return content of widget
currentIndex - current displaying page
totalLength - total number of pages
transitionType - tractionType can be circle/slide/fade
transitionDuration - Duration of animation
transitionCurve - Curve is animation curve and they are used to adjust the rate of change of an animation over time
Mohamed Al Ameen GitHub avatar
GitHub 作者

Mohamed Al Ameen ↗

语言DartSwiftJavaObjective-C

此仓库发布的插件

使用的依赖

依赖清单 3 项

  • flutter{"sdk":"flutter"}
  • flutter_test开发依赖{"sdk":"flutter"}
  • flutter_lints开发依赖^6.0.0

如何选择适合项目的代码仓?

先按使用场景筛选,再比较项目活跃情况,最后到原始仓库核对使用要求。

  1. 通过仓库名、作者或描述搜索,再按技术分类缩小范围。
  2. 结合星标、复刻与最近推送比较项目;星标反映社区关注,不代表质量保证。
  3. 使用前在 GitHub 核对 README、许可证与 Issues。

来源与维护

“A repository is the most basic element of GitHub.”

GitHub Docs — About repositories ↗