Giter VIP home page Giter VIP logo

curved_navigation_bar's Introduction

curved_navigation_bar

pub package

A Flutter package for easy implementation of curved navigation bar.

Gif

Add dependency

dependencies:
  curved_navigation_bar: ^1.0.5 #latest version

Easy to use

Scaffold(
  bottomNavigationBar: CurvedNavigationBar(
    backgroundColor: Colors.blueAccent,
    items: <Widget>[
      Icon(Icons.add, size: 30),
      Icon(Icons.list, size: 30),
      Icon(Icons.compare_arrows, size: 30),
    ],
    onTap: (index) {
      //Handle button tap
    },
  ),
  body: Container(color: Colors.blueAccent),
)

Attributes

items: List of Widgets
index: index of NavigationBar, can be used to change current index or to set initial index
color: Color of NavigationBar, default Colors.white
buttonBackgroundColor: background color of floating button, default same as color attribute
backgroundColor: Color of NavigationBar's background, default Colors.blueAccent
onTap: Function handling taps on items
animationCurve: Curves interpolating button change animation, default Curves.easeOutCubic
animationDuration: Duration of button change animation, default Duration(milliseconds: 600)
height: Height of NavigationBar, min 0.0, max 75.0
maxWidth: Allows to set the width of the navigation bar lower than the entire screen width by default
letIndexChange: Function which takes page index as argument and returns bool. If function returns false then page is not changed on button tap. It returns true by default\

Change page programmatically

 //State class
  int _page = 0;
  GlobalKey<CurvedNavigationBarState> _bottomNavigationKey = GlobalKey();

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        bottomNavigationBar: CurvedNavigationBar(
          key: _bottomNavigationKey,
          items: <Widget>[
            Icon(Icons.add, size: 30),
            Icon(Icons.list, size: 30),
            Icon(Icons.compare_arrows, size: 30),
          ],
          onTap: (index) {
            setState(() {
              _page = index;
            });
          },
        ),
        body: Container(
          color: Colors.blueAccent,
          child: Center(
            child: Column(
              children: <Widget>[
                Text(_page.toString(), textScaleFactor: 10.0),
                ElevatedButton(
                  child: Text('Go To Page of index 1'),
                  onPressed: () {
                    //Page change using state does the same as clicking index 1 navigation button
                    final CurvedNavigationBarState? navBarState =
                        _bottomNavigationKey.currentState;
                    navBarState?.setPage(1);
                  },
                )
              ],
            ),
          ),
        ));
  }

curved_navigation_bar's People

Contributors

desno365 avatar fourleaftec avatar kattatzu avatar mike-altonji avatar prafgup avatar rafalbednarczuk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

curved_navigation_bar's Issues

InitialIndex is not correctly used

InitialIndex is ignored because is hardcoded to 0.
This cause an incorrect icon in the case that you for example hide and show curved bar in different view.
initialIndex will be ignored and the current selected item take home icon.

If in curved_navigation_bar.dart you change line 19 from
this.initialIndex=0 to this.InitialIndex

and change the line 48 from
_icon = widget.items[0]; to _icon = widget.items[widget.initialIndex];

All works fine.

P.s. I would appreciate collaborate with you in this plugin if you want.

AndroidManifest is missing for run example

If you try to run example directly show this error message:

Launching example/example.dart on Android SDK built for x86 in debug mode...
No application found for TargetPlatform.android_x86.
Is your project missing an android/AndroidManifest.xml?
Consider running "flutter create ." to create one.

Adding a text below the icon

Hello, on the point, its a great work. but can i ask u about how to add a text below the icons? i try to wrap it in a column, its work but the text is also pop up when the icon pressed, so the text is overflow the button button. How to make the text is stay at the navbar? Thanks and sorry for my bad english

Docked FloatingActionButton

It'd be cool if you'll make setting docked FAB like with standard BottomNavigationBar possible. Now it just goes over NavBar.

5

missed up

when i use ( supportedLocales: [const Locale("fa", "IR")],) for my MaterialApp the buttonNavigationBar misses up

Control the height of CurvedNavigationBar

Hi,
this plugin is very awesome.
There is a way to controle the height of CurvedNavigationBar?
In particular I have in the bottom too blank space and I would like reduce it a little bit.
Thanks

InkWell optional Splash effect

The nav_button.dart file has an InkWell with a SplashColour. It doesnt look nice when you have a SizedBox of 100.0 and the bar of only 75.0

Could this SplashColour be removed? or possibly one of the following

  • Expose Properties of NavButton so it can be customized and used with the NavBar
  • Change the NavButton to also be circular, but Infront of the NavCustomPainter (may look better when Splash is over and not hidden behind
child: InkWell(
        splashColor: Colors.transparent,
        highlightColor: Colors.transparent,
        onTap: () {
          onTap(index);
        },
        child: Container(

https://github.com/rafalbednarczuk/curved_navigation_bar/blob/master/lib/src/nav_button.dart#L19

hiding the bar

Hey! I have an intricate app and I have one particular page with a map API and I am trying to extend the screen and hide the curved nav bar for a better user experience. I was looking to link to this map api page and have the nav bar hidden.

I've tried different routes and states. any ideas?

Fixed Option

Is there an option for fixed animation? Thus, the blue background (color) does not change to the icon selected as in the image.

Screen Shot 2020-04-06 at 03 46 59

Increase tap surface

You have to be very precise in tapping to trigger the gesture detector. Can there be a way to increase the tap surface?

IN RTL

I use this in a RTL app and it don't work right

how to add to the project ...

sorry for this really basic question but im new to flutter and dont know how to add it to my project.
in first place for adding the dependencies i have this error : Error on line 14, column 3 of pubspec.yaml: A package may not list itself as a dependency.

second where to add that Scaffold(...)

and third i dont know how to use it in another project ...

i wish you guys can help me with comments or a link to a tutorial
thank you

How change the bottom-bar-index on page change?

Great job, looks great!

I just tried the CurvedNavigationBar. I stuck with one question/problem: I use Pageview to show the content. When you swipe to another page, I want to change the selected bottombar also, but there is only a initialIndex. How can I change the selected bottombaritem afterwards?

Tap on the same icon again

I'm using this package in a bottom bar. When an icon is selected its gesture detector is dragged down, so it's very diffucult to tap it again.
I would like to know if it's possible to maintain the gesture detector in the same position as the selected icon.

Curved Navigation Bar problem with RTL (Arabic) Languages

hi ...
I used it in the Arabic language ... which is RTL layout ... there is a problem ...

the problem is when I have 5 items ... and chose the centred item ... ok

but when I chose second items which its index = 1 ... it animated to the mirror position just like I chose the item 4 which it's index = 3 .... also the first item (index = 0) looks like I choose item 5 (index 4)...

bottomNavigationBar: CurvedNavigationBar( index: _page, height: 55.0, items: <Widget>[ Icon(Icons.info, size: 25,color: Colors.white,), Icon(FontAwesomeIcons.hashtag, size: 22,color: Colors.white,), Icon(FontAwesomeIcons.briefcaseMedical, size: 20,color: Colors.white,), Icon(FontAwesomeIcons.solidMoon, size: 20,color: Colors.white,), Icon(Icons.account_circle, size: 25,color: Colors.white,), ], color: Colors.cyan, buttonBackgroundColor: Colors.pink, backgroundColor: Colors.white, animationCurve: Curves.easeInOut, animationDuration: Duration(milliseconds: 200), onTap: (index) { setState(() { _page = index; }); }, )

MyRealExample:

Best Regards

background transparent problem again :/

Where is the problem i cant figure out

here is my code and doctor -v
''curved_navigation_bar: ^0.2.11''

@override
  Widget build(BuildContext context) {
    return Scaffold(
      extendBody: true,
        bottomNavigationBar: CurvedNavigationBar(
          index: 0,
          height: 45.0,
          items: <Widget>[
            Icon(Icons.local_activity, size: 30),
            Icon(Icons.calendar_today, size: 30),
            Icon(Icons.compare_arrows, size: 30),
            Icon(Icons.settings, size: 30),
          ],
          color: Colors.white,
          buttonBackgroundColor: Colors.white,
          backgroundColor: Colors.transparent,
          animationCurve: Curves.easeInOut,
          animationDuration: Duration(milliseconds: 600),
          onTap: (index) => setState(() {
          currentIndex = index;
        }),
          
        ),
     body: _getPage(currentIndex),
    
  );
  }

[✓] Flutter (Channel stable, v1.5.4-hotfix.2, on Linux, locale tr_TR.utf8)

• Flutter version 1.5.4-hotfix.2 at /home/von/Masaüstü/flutter
• Framework revision 7a4c33425d (5 weeks ago), 2019-04-29 11:05:24 -0700
• Engine revision 52c7a1e849
• Dart version 2.3.0 (build 2.3.0-dev.0.5 a1668566e5)

[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
• Android SDK at /home/von/Android/Sdk
• Android NDK location not configured (optional; useful for native profiling
support)
• Platform android-28, build-tools 28.0.3
• Java binary at: /home/von/Masaüstü/android-studio/jre/bin/java
• Java version OpenJDK Runtime Environment (build
1.8.0_152-release-1343-b16-5323222)
• All Android licenses accepted.

[✓] Android Studio (version 3.4)
• Android Studio at /home/von/Masaüstü/android-studio
• Flutter plugin version 35.3.1
• Dart plugin version 183.6270
• Java version OpenJDK Runtime Environment (build
1.8.0_152-release-1343-b16-5323222)

[✓] Connected device (1 available)
• ASUS X008D • H1AXGY063270GZ8 • android-arm64 • Android 7.0 (API 24)

• No issues found!

box shadow

Would be nice to have the possibility to add a box shadow to the navbar in case i want to have both the background and the nav white

How to make the background color transparent

Please how can someone make the Navigation bar background color to be transparent?

I have tried Colors.transparent and .withOpacity(0.0) but they don't work.

Please how can I solve this?

Something like this:
transparent-nav

i cant change the backround to transparent

I have a proble when one of my pages are scrolleable, the effect of curved slide around turns white when i put this code bdw im new on flutter its posible turn transparent for the scrollview?:

Scaffold(

    bottomNavigationBar: CurvedNavigationBar(
      index: pageIndex,
      height: 50.0,
      items: <Widget>[
        Icon(Icons.home, size: 30, color: Colors.greenAccent),
        Icon(Icons.list, size: 30, color: Colors.greenAccent),
        Icon(Icons.calendar_today, size: 30, color: Colors.greenAccent),
        Icon(Icons.map, size: 30, color: Colors.greenAccent),
        Icon(Icons.perm_identity, size: 30, color: Colors.greenAccent),
      ],
      color: Colors.deepPurple,
      buttonBackgroundColor: Colors.deepPurple,
      backgroundColor: Colors.transparent,
      animationCurve: Curves.bounceInOut,
      animationDuration: Duration(milliseconds: 300),
      // onTap para que navegue en las pestañas de buttonnavigatonBar
      onTap: (int tappedIndex) {
        setState(() {
          _showPage = _pageChooser(tappedIndex);
        });
      },
    ),

91007085_638290240286751_1162938983248822272_n

Multiple widgets used the same GlobalKey.

I want to change the CurveNavigatiobar tab programmatically by another stateful widget.
it works but with the following logs
I make Globalkey instance global outside of the class(before the main function).


GlobalKey globalKey = new GlobalKey(debugLabel: 'app_bar_key');

void main() async {

  Crashlytics.instance.enableInDevMode = true;

..........}

and calling this from other stateful widget's tree

                  child: Text('OK'),
                  onPressed: () {
                    Navigator.of(context).pop();
                    final CurvedNavigationBarState nav = globalKey.currentState;
                    nav.setPage(0);
                  },
                ),```


> D/EGL_emulation(18997): eglMakeCurrent: 0x7824cd3f45e0: ver 3 0 (tinfo 0x7824af3234a0)
D/EGL_emulation(18997): eglMakeCurrent: 0x7824cd3f45e0: ver 3 0 (tinfo 0x7824af3234a0)
D/EGL_emulation(18997): eglMakeCurrent: 0x7824cd3f45e0: ver 3 0 (tinfo 0x7824af3234a0)
I/Choreographer(18997): Skipped 44 frames!  The application may be doing too much work on its main thread.
D/EGL_emulation(18997): eglMakeCurrent: 0x7824cd3f45e0: ver 3 0 (tinfo 0x7824af3234a0)

════════ Exception Caught By widgets library ═══════════════════════════════════
The following assertion was thrown building MediaQuery(MediaQueryData(size: Size(411.4, 731.4), devicePixelRatio: 2.6, textScaleFactor: 1.0, platformBrightness: Brightness.light, padding: EdgeInsets.zero, viewPadding: EdgeInsets.zero, viewInsets: EdgeInsets(0.0, 0.0, 0.0, 48.0), alwaysUse24HourFormat: false, accessibleNavigation: false, disableAnimations: false, invertColors: false, boldText: false)):
Multiple widgets used the same GlobalKey.

The key [GlobalKey#2bd5c app_bar_key] was used by multiple widgets. The parents of those widgets were different widgets that both had the following description:
  MediaQuery(MediaQueryData(size: Size(411.4, 731.4), devicePixelRatio: 2.6, textScaleFactor: 1.0, platformBrightness: Brightness.light, padding: EdgeInsets.zero, viewPadding: EdgeInsets.zero, viewInsets: EdgeInsets(0.0, 0.0, 0.0, 48.0), alwaysUse24HourFormat: false, accessibleNavigation: false, disableAnimations: false, invertColors: false, boldText: false))
A GlobalKey can only be specified on one widget at a time in the widget tree.
When the exception was thrown, this was the stack
#0      GlobalKey._debugReserveFor.<anonymous closure> 
package:flutter/…/widgets/framework.dart:177
#1      GlobalKey._debugReserveFor 
package:flutter/…/widgets/framework.dart:189
#2      Element.updateChild.<anonymous closure> 
package:flutter/…/widgets/framework.dart:2858
#3      Element.updateChild 
package:flutter/…/widgets/framework.dart:2861
#4      ComponentElement.performRebuild 
package:flutter/…/widgets/framework.dart:3935
...
════════════════════════════════════════════════════════════════════════════════

════════ Exception Caught By widgets library ═══════════════════════════════════
The following assertion was thrown building MediaQuery(MediaQueryData(size: Size(411.4, 731.4), devicePixelRatio: 2.6, textScaleFactor: 1.0, platformBrightness: Brightness.light, padding: EdgeInsets.zero, viewPadding: EdgeInsets.zero, viewInsets: EdgeInsets(0.0, 0.0, 0.0, 48.0), alwaysUse24HourFormat: false, accessibleNavigation: false, disableAnimations: false, invertColors: false, boldText: false)):

OnSwipe Next tab screen is visible but , tab is not changed.

I have configured curved navigation bar. Ontap the tab is changing and and the content of next tab is visible.

but on swipe the content is changed but current tab is not changed.

`class Dashboard extends StatefulWidget {
@OverRide
_DashboardState createState() => _DashboardState();
}

class _DashboardState extends State {

final int _page = 1;
GlobalKey _bottomNavigationKey = GlobalKey();
final _pageController = PageController(initialPage: 1);

@OverRide
Widget build(BuildContext context) {
return Scaffold(
// backgroundColor: Colors.grey,
appBar: BaseAppBar(
elevation: 0.5,
appBar: AppBar(),
backgroundColor: Colors.white,
// title: ,
),
bottomNavigationBar: CurvedNavigationBar(
key: _bottomNavigationKey,
backgroundColor: Colors.white,
buttonBackgroundColor: Colors.blue[500],
color: Color.fromRGBO(206, 206, 206, 0.5),
index: _page,
items: [
Icon(Icons.terrain, size: 50, color: Colors.grey,),
Icon(Icons.perm_media, size: 50, color: Colors.grey,),
Icon(Icons.local_offer, size: 50, color: Colors.grey,),
Icon(Icons.account_circle, size: 50, color: Colors.grey, ),
],
onTap: (int index) {
setState(() {
_pageController.jumpToPage(index);
});
},
),
body: PageView(
controller: _pageController,
children: [
MoneyPlant(),
Adds(),
Discounts(),
Profile(),
],
onPageChanged: (int index) {
setState(() {
_pageController.jumpToPage(index);
});
}
),
);
}
`

add SafeArea Widget before CurvedNavigationBar

Hi
when i add SafeArea Widget before CurvedNavigationBar the icon appear out of navigation bar and above the safe area bar in iphone xr this appear only when i click icons , i think should prevent icon across the navigation and don't appear outside during transition between icons.... so how to solve this problem.
thank you

backgroundColor should have transparent color

I think if anyhow we can do backgroundColor to transparent then it automatically adapts to screen background color. I tried to assign a backgroundColor to transparent but it still white please implement it.

Screenshot (33)_LI

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.