Git Product home page Git Product logo

frezyx / bottom_bar_with_sheet Goto Github PK

View Code? Open in Web Editor NEW
431.0 7.0 47.0 38.97 MB

:rocket: Flutter custom BottomBar Navigation Widget

Home Page: https://pub.dev/packages/bottom_bar_with_sheet

License: Apache License 2.0

Dart 57.10% Kotlin 0.17% Swift 1.61% Objective-C 0.05% Makefile 0.24% HTML 5.45% CMake 11.02% C++ 23.34% C 1.02%
dart flutter flutter-package flutter-widget flutter-widgets bottomnavigationbar bottomsheet bottomnavigation widget widget-library

bottom_bar_with_sheet's Introduction

Bottom bar with Sheet

Build Status License Pub Stars

Pub likes Pub popularity Pub points

💥Non-standard way to use more space of screens in your application💥
😳Custom bottom Sheet under Bottom Navigation Bar😳
😩Sounds sucks? 😉 First of all look at screens!

Image Image Image Image

Table of Content


Getting Started

Add dependency

dependencies:
  bottom_bar_with_sheet: ^2.4.0

Add import package

import 'package:bottom_bar_with_sheet/bottom_bar_with_sheet.dart';

Easy to use

Create a Scaffold widget and set bottomNavigationBar with BottomBarWithSheet like in the code below

Scaffold(
  bottomNavigationBar: BottomBarWithSheet(
    controller: _bottomBarController,
    bottomBarTheme: const BottomBarTheme(
      decoration: BoxDecoration(color: Colors.white),
      itemIconColor: Colors.grey,
    ),
    items: const [
      BottomBarWithSheetItem(icon: Icons.people),
      BottomBarWithSheetItem(icon: Icons.favorite),
    ],
  ),
);

More examples you can see here


Attributes

Attribute Type Annotation
autoClose bool If true the [BottomBarWithSheetItem]'s DO NOT automatically close the child sheet when pressed
disableMainActionButton bool disable MainActionButton if true , enable if false
sheetChild Widget that displayed on bottom of BottomBarWithSheet when isOpened == true
items List BottomBarWithSheetItem navigation buttons of BottomBarWithSheet
bottomBarTheme BottomBarTheme theme of BottomBarWithSheet
mainActionButtonTheme MainActionButtonTheme theme of Main Action Button
onSelectItem Function Callback Function works by clicking on one of items Return int index of selected button
duration Duration animation time of closing / opening BottomBarWithSheet
curve Curve the style of animation from the suggested ones of Curve
bottomBarMainAxisAlignment MainAxisAlignment The direction in which the widget content will line up
mainActionButtonBuilder MainActionButton Custom version of Main Action Button

Attributes of BottomBarTheme

Attribute Type Annotation
height double BottomBarWithSheet icons line height
heightOpened double BottomBarWithSheet height when isOpened == true
heightClosed double BottomBarWithSheet height when isOpened == false
decoration BoxDecoration decoration of BottomBarWithSheet
contentPadding EdgeInsets create padding between content of widget and sides
backgroundColor Color BottomBarWithSheet background color
selectedItemIconColor Color selected item icon color
itemIconColor Color unselected item icon color
selectedItemTextStyle Color selected item text style
itemTextStyle Color unselected item text style
selectedItemIconSize double size of item icon when item is pressed
mainButtonPosition enum filed that response for the position of MainActionButton position this field have 3 possible values: MainButtonPosition.left, MainButtonPosition.right , MainButtonPosition.Center
isVerticalItemLabel bool makes the labels of the items appear vertically or horizontally

Attributes of MainActionButtonTheme

Attribute Type Annotation
size double size of button
icon Widget icon that displayed in center of MainActionButton
color Color background color of widget circle
splash Color splash color of widget circle
margin EdgeInsets side paddings of Main Action Button
transform Matrix4 This field can set transform location of Main Action Button

For help getting started with Flutter, view our online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.

bottom_bar_with_sheet's People

Contributors

coskuncay avatar frezyx avatar timmaffett 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

bottom_bar_with_sheet's Issues

Using this package with Flame Engine causes Flickering in SetState()

When changing between items and sheets with the index, it requires the setState function to be called in onSelectItem.

However, when the setState is called to change the index to change the sheetChild, it will cause screen flickering. (when using Flame Engine).

I think it could be resolved since opening/closing the sheet does not cause any flickering.

Issue open close sheet

I'm facing with an issue with sheet. At first time sheet open and close correctly but if i use anythings in a sheet it wont close or reopen. This is a link to video that show the problem, https://streamable.com/cuxv2k
The code used
https://nopaste.ml/#XQAAAQCeEQAAAAAAAAAQaZiMp3f2ANWovBBWoCc58NZwPuU3O5XpPKRc8D5Y+9LR0B3WorZH6vo9jcwqN/twqcKFIHaz1MiiVh3HGoNS+duMy1bA5sABT/q2kPd/y91QjwzwK7ohuisWFTyTrxV5YN++JChL6ZNCvvF0M/AAG4fGLXagMi//Xcjggb5yBv/KVmGyaRGbF/9LpLD/A7AJ/DFmPUktnTi2gwlqXkwcRdJ+FxNcB8dNGQ3g9ZtKjDxF33aS3dF7IzT9PFv723o0+YOpjU9yGeEJqOzq0d64+rMTsRIz+GbdfAZYclGCpuP5EYpwqpTbiEQylpoG7/MLy+6y8/T/F62oxU9DOkDswgx+wTQGddIDJJ88RGCqESfhp6AqIukKGAiDQ/KOhvdSOQ1BjoGSq2R1TY7vPssLKdRO+H3ch/t7+t/QUWT6mXNng+2aB26Dytd9DvVUEsOLeZXj+BtXD7Wi7ZIQFTu0POwDiizsEUUirEp9mfXFpbVu2NfBUcl/mhxeQ/3aaw+DrWd2gwojxkOo76ioVajl3PNtEB+TlqTk58C1NpCVSdSa9w76eTq9s6r8nIDEWmejmw/AYM1VH9nxmYNJ+PnZSQHjksrjHHYvJmtSy/Q5l2r+oj8hBC/fvcfAcByOpeqpQ6ve5bcVf5LjTfF4Xpu7sswJ8y2Ns5DDEAAd/rns+4dW0XsCHFghFCKtU+bENYD3AV5JcBn/stZbM5tWJrucd/7xJlqoIYbABW7t2rQ92R1Vil+mpNoUAhk5UioZ6mH5mbAhgGQU9jzP32Rqv1F/alOx7pqdJ3p2iiczR6g+On8g0WLjUR3El/4Mz3D+tCl8UMi0zIaefrnnJ+gpf21zvu3VzNj29R7TaU92jdXLDf75NanHXnUI8sVFelSxIPgSjOyyJwlLG5L9ooPF5YIBJwrssICvsbex1/abWS2/TZYP7qh7iLRskYP4T8b+6J725xnrERHGtH1cW81GJwwrumj8b7sJb4lSqNjgGWoQvVe4sTN5trrwPlkURl56yvtGn4/R9TvAow4sJjAknbAL4MudxDHOds6ZlqZprBvpZ1F+eZVCVSUpw6zC9adSwLRGdzM9yxtent5wqaA8FuIwJkr6NkE5/vzRgMfxAPHfG/KuhwT7AXTHQLuqBYuGp3YaCbXYGaen/O0Z3f8t/AjnvBHUoquu/a4WFNQ9eHM2ASPY96Smq9cpOvth3dfAzNsktg2PGuSD0wG4w4H+OhR0/mTlGpJD0bUdNynIppU0rJv1zgEFS98ds5FLzVjZcJeTuJ6qM+teq8pCAtMcLRDU4Z5j0AZhXvTqlEJp/ZSULazymIUhTVDFT9axx9hoBNmq22PaFTuPsIjBSjQ3Ry3lVoLSuDZuNDrxvE2ydkstLqn9VPnkBUoJi4JSgWXO87IgcKo5BzwipKX9SmKgHQKGJ8VYf09p5lDVdNYoMnC+pWgwY4RN20pIVGeyAhQchZ6b/q/jNSL89bRurfmGDFJb/+RsUXA=

Same...

The opening/closing fab doesn't work

setState not updating the Icon

Describe the bug
I have a variable in my AppState, and I would like to change an icon depending on this variable, after a setState().
It seems the icon is changing only if I go to another page...

To Reproduce
Steps to reproduce the behavior:

  1. Have a variable in your AppState (here it's List<Message> newMessages)
  2. Have an Icon based on this variable :
    List<BottomBarWithSheetItem> lstItems = [
      BottomBarWithSheetItem(
          icon: container.state.newMessages?.isEmpty ? Icons.mail_outline : Icons.mark_email_unread_outlined,
          label: 'MESSAGES'),
      //...
    ];
    return SafeArea(
      child: BottomBarWithSheet(
        controller: _bottomBarController,
       // ...
        items: lstItems,
      )
  1. Have an action to update your variable, and setState()
  void checkNewMessages() async {
      //...
          this.setState(() {
            state.newMessages.add(msg);
          });
  }

Expected behavior
After calling checkNewMessages, the Icon should be mark_email_unread_outlined, but it says mail_outline.

Maybe it's not a bug, maybe It's my code the bug, but I've not find anything in your documentation regarding this...

Thanks

Overwork of mandatory elements

Right now these parameters are mandatory in BottomBarWithSheet:

  • bottomBarTheme
  • sheetChild
  • onSelectItem
    and also the MainActionButtonTheme requires an icon.

From my point of view the MainActionButtonTheme (and MainActionButton) should orientate more on the FloatingActionButton which has no required field. If there is no icon provided this does not matter, as the FAB is there but just without an icon.
Also the bottomBarTheme must not be required as the package should provide default settings based on the Theme.of(context) values or internal default values.

icon size didn't resize

Hello ...
first: thank you for developing awesome lib

I have a weird issue about icon size
I can't resize it !!

note : I'm using Getx lib .

my code is

bottomBarTheme: BottomBarTheme(
  height: 60,
  heightClosed: 60,
  heightOpened: 300,
  backgroundColor: Colors.blueGrey.shade900,
  mainButtonPosition: MainButtonPosition.left,
  selectedItemIconColor: Colors.white,
  itemIconColor: Colors.blueGrey.shade300,

  itemIconSize: 30,  //  <- here
  selectedItemIconSize: 35,  //  <- here
),

I have even tried to change lib source code but to no avail

class BottomBarTheme {
  // ...........................
  /// [double] size of item icon when item is pressed
  final double selectedItemIconSize;

  /// [double] size of item icon when item is not selected
  final double itemIconSize;

  BottomBarTheme({
    this.contentPadding = _kDefaultContentPadding,
    this.height = 75,
    this.heightOpened = 400,
    this.heightClosed = 75,
    this.backgroundColor,
    this.selectedItemIconColor,
    this.itemIconColor,
    this.selectedItemTextStyle,
    this.itemTextStyle,
    this.mainButtonPosition = MainButtonPosition.middle,
    this.decoration,
    this.itemIconSize = 30,
    this.selectedItemIconSize = 35,
  });
}

also when trying to change size based on screen width .. it only take the initial size with no more change even for small screen width
like this :

mainActionButtonTheme: MainActionButtonTheme(
  size: (context.width > 500) ? 50 : 35,
  color: Colors.blueGrey.shade400,
  splash: Colors.white,
  icon: Icon(
    Icons.add,
    color: Colors.white,
    size: (context.width > 500) ? 35 : 25,
  ),
),

what I want is to resize icon size based on screen width
this is my full code :

bottomNavigationBar: GetBuilder<SheetController>(
  init: SheetController(),
  builder: (value) => BottomBarWithSheet(
    controller: BottomBarWithSheetController(
      initialIndex: value.selectedIndex,
    ),
    selectedIndex: value.selectedIndex,
    sheetChild: Container(),
    bottomBarTheme: BottomBarTheme(
      height: 60,
      heightClosed: 60,
      heightOpened: 300,
      backgroundColor: Colors.blueGrey.shade900,
      mainButtonPosition: MainButtonPosition.left,
      selectedItemIconColor: Colors.white,
      itemIconColor: Colors.blueGrey.shade300,
      itemIconSize: 30,
      selectedItemIconSize: 35,
    ),
    mainActionButtonTheme: MainActionButtonTheme(
      size: (context.width > 500) ? 50 : 35,
      color: Colors.blueGrey.shade400,
      splash: Colors.white,
      icon: Icon(
        Icons.add,
        color: Colors.white,
        size: (context.width > 500) ? 35 : 25,
      ),
    ),
    onSelectItem: (item) => Get.find<SheetController>().setIndex(item),
    items: [
      BottomBarWithSheetItem(icon: Icons.home_rounded),
      BottomBarWithSheetItem(icon: Icons.shopping_cart),
      BottomBarWithSheetItem(icon: Icons.settings),
      BottomBarWithSheetItem(icon: Icons.favorite),
      BottomBarWithSheetItem(icon: Icons.donut_large),
      BottomBarWithSheetItem(icon: Icons.bar_chart_sharp),
      BottomBarWithSheetItem(icon: Icons.backup_rounded),
      BottomBarWithSheetItem(icon: Icons.camera_alt),
    ],
  ),
),

so is there any idea ?

Feature request: FAB outside bottom bar

Amazing work on the bottom_bar_with_sheet!

Would it be possible to add a fourth option to the placement of the FAB, in order to place the FAB outside the bottom bar?
This would allow for hiding the bottom bar completely (height 0), and the bottom bar could be opened by clicking the FAB.

Inspiration:
This piece by Eike Drescher, UpLabs

image

Programmatically Close sheet

I am unable to open/ close the sheet programmatically.

Use case:
I am embedding a List view menu into my sheet. When an item is selected I want to close the sheet and navigate to the selected page.

Issue:
Changing the value of my isMenuOpen variable does not toggle the sheet.

Code snippet:
`class _RootScreenState extends State {
final _scaffoldKey = GlobalKey();
int _selectedIndex = 0;
bool _isMenuOpen = true;

@OverRide
Widget build(BuildContext context) {
return Scaffold(
key: _scaffoldKey,
bottomNavigationBar: BottomBarWithSheet(
selectedIndex: _selectedIndex,
duration: Duration(milliseconds: 250),

   //OPEN BY DEFAULT FOR DEMO
    isOpened: _isMenuOpen,

    sheetChild: Container(
      child: ListView(
        children: [
          ListTile(
            title: Text(
              'Settings',
              style: TextStyle(
                color: Colors.white,
              ),
            ),

           // SHOULD CLOSE SHEET
            onTap: () => setState(() {
              _isMenuOpen = false;
            }),
          ),`

Demo:
sheetBug

heightOpened

He,it's possible to specify the height of Sheet in percentage of the height of the screen ?

Increase item touch area

I noticed that the item gesture detector only runs after tapping inside the icon. Unlike default TabBar where there is an touchable area around.

In my usage experience, sometimes I have to tap again. I believe if increasing the touch area would solve this problem.

Real life usage

The widget looks interesting. Are there some people who can provide real life examples where this is used? How does it help that the area is opened below navigation?

Close Sheet onTap outside

Basically the title.
When the user touches something outside the expanded BottomBar, the bar should collapse again.

BottomBarWithSheetItem splash issues

I noticed that the build of BottomBarWithSheetItem leads to a few inconveniences.

  1. the icon on select pushes the label down. I think this is because the splash in nonexistent beforehand.

  2. The area that excepts input is way to small. For the bottom bar I would expect the touchable area to fill the whole the whole Column/Row.

@Frezyx I would be happy to assist you also in this project, but please add a few more comments beforehand 🙈

Peek.2021-04-19.12-48.mp4

Divider between Appbar and Content

Rn the content is hard to visually seperate when the background color for the AppBar and the content is both white.
The addition of a Divider() between them might come in useful here.

image

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.