From 974f981fb5d584f5a03247db833a1fb1daf35224 Mon Sep 17 00:00:00 2001 From: MarsadMaqsood Date: Fri, 24 Nov 2023 12:41:53 +0500 Subject: [PATCH 1/4] updated --- CHANGELOG.md | 8 ++ example/android/app/build.gradle | 2 +- example/lib/main.dart | 9 +- lib/model/options.dart | 9 +- lib/src/anim_nav/animated_nav_tiles.dart | 73 +++++----- lib/src/dot_nav/dot_nav_tile.dart | 133 +++++------------- lib/src/widgets/icon_widget.dart | 2 +- .../{water_drop => widgets}/water_drop.dart | 4 +- pubspec.yaml | 4 +- 9 files changed, 94 insertions(+), 150 deletions(-) rename lib/src/{water_drop => widgets}/water_drop.dart (97%) diff --git a/CHANGELOG.md b/CHANGELOG.md index e65c17f..1d2e48b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,11 @@ +## 1.1.0-beta-2 +- Optimized the performance of `DotBarOptions` style +- Removed redundant code for increased efficiency. + +## 1.1.0-beta +- Added new style `DotBarOptions` +- Added `NotchStyle` + ## 1.0.3 - Fix: badge display issue when using `AnimatedBarOptions` - Removed unnecessary code diff --git a/example/android/app/build.gradle b/example/android/app/build.gradle index b4c1b1d..428d004 100644 --- a/example/android/app/build.gradle +++ b/example/android/app/build.gradle @@ -35,7 +35,7 @@ android { defaultConfig { // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). applicationId "com.example.example" - minSdkVersion 16 + minSdkVersion flutter.minSdkVersion targetSdkVersion 32 versionCode flutterVersionCode.toInteger() versionName flutterVersionName diff --git a/example/lib/main.dart b/example/lib/main.dart index b5ab34d..785ce59 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -31,9 +31,9 @@ class AnimatedBarExample extends StatefulWidget { } class _AnimatedBarExampleState extends State { - dynamic selected; - var heart = false; - PageController controller = PageController(); + int selected = 0; + bool heart = false; + final controller = PageController(); @override void dispose() { @@ -112,9 +112,10 @@ class _AnimatedBarExampleState extends State { ], hasNotch: true, fabLocation: StylishBarFabLocation.end, - currentIndex: selected ?? 0, + currentIndex: selected, notchStyle: NotchStyle.square, onTap: (index) { + if (index == selected) return; controller.jumpToPage(index); setState(() { selected = index; diff --git a/lib/model/options.dart b/lib/model/options.dart index 765940a..509834a 100644 --- a/lib/model/options.dart +++ b/lib/model/options.dart @@ -135,15 +135,11 @@ class DotBarOptions extends BottomBarOption { /// The default color is `Colors.grey`. final Color? inkColor; - /// Specifies the opacity of the navigation bar items' backgrounds. - /// The default value is `0.8`. - final double? opacity; - /// Specifies the style of dot. - + /// /// * **`DotStyle.circle`:** Displays a circular dot. /// * **`DotStyle.tile`:** Displays a tiled dot. - + /// /// The default value is `DotStyle.circle`. final DotStyle dotStyle; @@ -156,7 +152,6 @@ class DotBarOptions extends BottomBarOption { this.padding, this.inkEffect = false, this.inkColor = Colors.grey, - this.opacity = 0.8, this.dotStyle = DotStyle.circle, this.gradient, }); diff --git a/lib/src/anim_nav/animated_nav_tiles.dart b/lib/src/anim_nav/animated_nav_tiles.dart index 4204c3e..5f74027 100644 --- a/lib/src/anim_nav/animated_nav_tiles.dart +++ b/lib/src/anim_nav/animated_nav_tiles.dart @@ -2,7 +2,7 @@ import 'package:flutter/material.dart'; import 'package:stylish_bottom_bar/helpers/constant.dart'; import 'package:stylish_bottom_bar/helpers/enums.dart'; import 'package:stylish_bottom_bar/model/bar_items.dart'; -import 'package:stylish_bottom_bar/src/water_drop/water_drop.dart'; +import 'package:stylish_bottom_bar/src/widgets/water_drop.dart'; class AnimatedNavigationTiles extends StatelessWidget { const AnimatedNavigationTiles( @@ -204,7 +204,7 @@ class AnimatedNavigationTiles extends StatelessWidget { : iconStyle == IconStyle.animated ? [ IconWidget( - items: items, + item: items, selected: selected, iconSize: iconSize, barAnimation: barAnimation, @@ -287,15 +287,14 @@ class AnimatedNavigationTiles extends StatelessWidget { class LabelWidget extends StatelessWidget { const LabelWidget({ - Key? key, + super.key, required this.animation, required this.item, required this.color, required this.iconStyle, - }) : super(key: key); + }); final Animation animation; - // final AnimatedBarItems item; final BottomBarItem item; final Color color; final IconStyle iconStyle; @@ -305,43 +304,41 @@ class LabelWidget extends StatelessWidget { return Align( alignment: Alignment.center, heightFactor: 1.0, - child: Container( - child: iconStyle == IconStyle.Default - ? DefaultTextStyle.merge( + child: iconStyle == IconStyle.Default + ? DefaultTextStyle.merge( + style: TextStyle( + fontSize: activeFontSize, + fontWeight: FontWeight.w600, + color: color, + ), + child: item.title!, + ) + : FadeTransition( + alwaysIncludeSemantics: true, + opacity: animation, + child: DefaultTextStyle.merge( style: TextStyle( fontSize: activeFontSize, fontWeight: FontWeight.w600, color: color, ), child: item.title!, - ) - : FadeTransition( - alwaysIncludeSemantics: true, - opacity: animation, - child: DefaultTextStyle.merge( - style: TextStyle( - fontSize: activeFontSize, - fontWeight: FontWeight.w600, - color: color, - ), - child: item.title!, - ), ), - ), + ), ); } } class IconWidget extends StatefulWidget { - const IconWidget( - {Key? key, - required this.items, - required this.selected, - required this.iconSize, - required this.barAnimation}) - : super(key: key); - // final AnimatedBarItems items; - final BottomBarItem items; + const IconWidget({ + super.key, + required this.item, + required this.selected, + required this.iconSize, + required this.barAnimation, + }); + + final BottomBarItem item; final bool selected; final double iconSize; final BarAnimation barAnimation; @@ -390,8 +387,8 @@ class _IconWidgetState extends State } animationColor = ColorTween( - begin: widget.items.backgroundColor ?? widget.items.unSelectedColor, - end: widget.items.selectedColor, + begin: widget.item.backgroundColor ?? widget.item.unSelectedColor, + end: widget.item.selectedColor, ).animate(animation) ..addListener(() { setState(() {}); @@ -417,12 +414,12 @@ class _IconWidgetState extends State _buildWidget() { return IconTheme( data: IconThemeData( - color: widget.items.backgroundColor ?? + color: widget.item.backgroundColor ?? (widget.selected ? widget.barAnimation == BarAnimation.transform3D - ? widget.items.selectedColor + ? widget.item.selectedColor : animationColor.value - : widget.items.unSelectedColor), + : widget.item.unSelectedColor), size: widget.selected ? widget.iconSize + 4 : widget.iconSize, ), child: widget.selected @@ -432,10 +429,10 @@ class _IconWidgetState extends State // ..setEntry(2, 3, 0.003) ..setEntry(3, 0, 0.002) ..rotateY(0), //..rotateY(0), - child: widget.items.icon!, + child: widget.item.icon!, ) - : widget.items.icon! - : widget.items.icon!, + : widget.item.icon! + : widget.item.icon!, ); } } diff --git a/lib/src/dot_nav/dot_nav_tile.dart b/lib/src/dot_nav/dot_nav_tile.dart index dd909c9..02cdb19 100644 --- a/lib/src/dot_nav/dot_nav_tile.dart +++ b/lib/src/dot_nav/dot_nav_tile.dart @@ -1,10 +1,10 @@ import 'package:flutter/material.dart'; -import 'package:stylish_bottom_bar/helpers/constant.dart'; +import 'package:stylish_bottom_bar/src/widgets/label_widget.dart'; import 'package:stylish_bottom_bar/stylish_bottom_bar.dart'; class DotNavigationTiles extends StatelessWidget { const DotNavigationTiles( - this.items, { + this.item, { super.key, this.onTap, required this.selected, @@ -16,7 +16,7 @@ class DotNavigationTiles extends StatelessWidget { final DotBarOptions options; - final BottomBarItem items; + final BottomBarItem item; ///onTap gesture event final VoidCallback? onTap; @@ -31,37 +31,42 @@ class DotNavigationTiles extends StatelessWidget { Widget build(BuildContext context) { return Expanded( child: Semantics( + enabled: selected, container: true, header: true, + label: indexLabel, selected: selected, child: Padding( padding: options.padding ?? - (items.showBadge + (item.showBadge ? const EdgeInsets.only( top: 6.0, ) : EdgeInsets.zero), child: Badge( - label: items.badge, - isLabelVisible: items.showBadge, - backgroundColor: items.badgeColor, - padding: items.badgePadding, - child: InkWell( - onTap: onTap, - splashColor: - options.inkEffect ? options.inkColor : Colors.transparent, - highlightColor: Colors.transparent, - borderRadius: const BorderRadius.horizontal( - right: Radius.circular(52), - left: Radius.circular(52), - ), - child: Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: selected - ? MainAxisAlignment.spaceEvenly - : MainAxisAlignment.center, - children: _dotItems(), + label: item.badge, + isLabelVisible: item.showBadge, + backgroundColor: item.badgeColor, + padding: item.badgePadding, + child: IgnorePointer( + ignoring: selected, + child: InkWell( + onTap: onTap, + splashColor: + options.inkEffect ? options.inkColor : Colors.transparent, + highlightColor: Colors.transparent, + borderRadius: const BorderRadius.horizontal( + right: Radius.circular(52), + left: Radius.circular(52), + ), + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: selected + ? MainAxisAlignment.spaceEvenly + : MainAxisAlignment.center, + children: _dotItems(), + ), ), ), ), @@ -71,15 +76,17 @@ class DotNavigationTiles extends StatelessWidget { } Color get itemColor => - items.backgroundColor ?? - (selected ? items.selectedColor : items.unSelectedColor); - Color get itemColorOnSelected => items.backgroundColor ?? items.selectedColor; + item.backgroundColor ?? + (selected ? item.selectedColor : item.unSelectedColor); + Color get itemColorOnSelected => item.backgroundColor ?? item.selectedColor; + + Widget get iconChild => + selected && item.selectedIcon != null ? item.selectedIcon! : item.icon!; List _dotItems() { - var label = LabelWidget( + final label = LabelWidget( animation: animation!, - item: items, - color: itemColorOnSelected, + item: item, ); return [ AnimatedCrossFade( @@ -94,9 +101,7 @@ class DotNavigationTiles extends StatelessWidget { color: itemColor, size: options.iconSize, ), - child: selected && items.selectedIcon != null - ? items.selectedIcon! - : items.icon!, + child: iconChild, ), ), duration: const Duration(milliseconds: 600), @@ -127,65 +132,3 @@ class DotNavigationTiles extends StatelessWidget { ]; } } - -class LabelWidget extends StatelessWidget { - const LabelWidget({ - Key? key, - required this.animation, - required this.item, - required this.color, - }) : super(key: key); - - final Animation animation; - final BottomBarItem item; - final Color color; - - @override - Widget build(BuildContext context) { - return Align( - alignment: Alignment.center, - heightFactor: 1.0, - child: FadeTransition( - alwaysIncludeSemantics: true, - opacity: animation, - child: DefaultTextStyle.merge( - style: TextStyle( - fontSize: activeFontSize, - fontWeight: FontWeight.w600, - color: color, - ), - child: item.title!, - ), - ), - ); - } -} - -class IconWidget extends StatelessWidget { - const IconWidget({ - Key? key, - required this.items, - required this.selected, - required this.iconSize, - }) : super(key: key); - - final BottomBarItem items; - final bool selected; - final double iconSize; - - @override - Widget build(BuildContext context) { - return _buildWidget(); - } - - Widget _buildWidget() { - return IconTheme( - data: IconThemeData( - color: items.backgroundColor ?? - (selected ? items.selectedColor : items.unSelectedColor), - size: selected ? iconSize + 4 : iconSize, - ), - child: items.icon!, - ); - } -} diff --git a/lib/src/widgets/icon_widget.dart b/lib/src/widgets/icon_widget.dart index c8dd7b6..fd7fb97 100644 --- a/lib/src/widgets/icon_widget.dart +++ b/lib/src/widgets/icon_widget.dart @@ -20,10 +20,10 @@ class IconWidget extends StatelessWidget { }); final Animation animation; + final BottomBarItem item; final double iconSize; final bool selected; final Color? unselectedIconColor; - final BottomBarItem item; @override Widget build(BuildContext context) { diff --git a/lib/src/water_drop/water_drop.dart b/lib/src/widgets/water_drop.dart similarity index 97% rename from lib/src/water_drop/water_drop.dart rename to lib/src/widgets/water_drop.dart index f648c70..91e7220 100644 --- a/lib/src/water_drop/water_drop.dart +++ b/lib/src/widgets/water_drop.dart @@ -53,8 +53,8 @@ class _WaterDropState extends State { end: end, colors: const [Colors.black, Colors.white], ), - // backgroundBlendMode: BlendMode.overlay, - backgroundBlendMode: BlendMode.colorBurn, + backgroundBlendMode: BlendMode.overlay, + // backgroundBlendMode: BlendMode.colorBurn, ), child: widget.child, ); diff --git a/pubspec.yaml b/pubspec.yaml index a85ef2c..d8d8fe6 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: stylish_bottom_bar description: A collection of stylish bottom navigation bars like animated bottom bar and bubble bottom bar for flutter. -version: 1.1.0-beta +version: 1.1.0-beta-2 #homepage: https://github.com/MarsadMaqsood/Stylish_bottom_bar repository: https://github.com/MarsadMaqsood/Stylish_bottom_bar @@ -13,7 +13,7 @@ dependencies: sdk: flutter dev_dependencies: - flutter_lints: ^2.0.2 + flutter_lints: ^3.0.1 flutter_test: sdk: flutter \ No newline at end of file From 2265843a5dbc15b29f5990fc78d6380ad7894457 Mon Sep 17 00:00:00 2001 From: MarsadMaqsood Date: Fri, 24 Nov 2023 12:45:04 +0500 Subject: [PATCH 2/4] updated --- lib/src/widgets/icon_widget.dart | 8 -------- 1 file changed, 8 deletions(-) diff --git a/lib/src/widgets/icon_widget.dart b/lib/src/widgets/icon_widget.dart index fd7fb97..49b0422 100644 --- a/lib/src/widgets/icon_widget.dart +++ b/lib/src/widgets/icon_widget.dart @@ -1,14 +1,6 @@ import 'package:flutter/material.dart'; import 'package:stylish_bottom_bar/model/bar_items.dart'; -enum BadgeAnimationType { - slide, - fade, - scale, -} - -enum BadgeShape { circle, square } - class IconWidget extends StatelessWidget { const IconWidget({ super.key, From 34d1244686625b391df5e981d6dc4732c29d43af Mon Sep 17 00:00:00 2001 From: MarsadMaqsood Date: Sat, 9 Dec 2023 00:48:55 +0500 Subject: [PATCH 3/4] fixed the issue with the badge positioning --- .gitignore | 3 + CHANGELOG.md | 1 + lib/src/anim_nav/animated_nav_tiles.dart | 220 +++++++++++++---------- lib/src/dot_nav/dot_nav_tile.dart | 85 ++++----- 4 files changed, 169 insertions(+), 140 deletions(-) diff --git a/.gitignore b/.gitignore index 25121ae..4093392 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ +#Test Files +test.*.dart + # Miscellaneous *.class *.log diff --git a/CHANGELOG.md b/CHANGELOG.md index 1d2e48b..b6e1efb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ ## 1.1.0-beta-2 - Optimized the performance of `DotBarOptions` style +- Fixed: `Badge` padding issue [#22](https://github.com/MarsadMaqsood/stylish_bottom_bar/issues/22#issue-2029833633) - Removed redundant code for increased efficiency. ## 1.1.0-beta diff --git a/lib/src/anim_nav/animated_nav_tiles.dart b/lib/src/anim_nav/animated_nav_tiles.dart index 5f74027..a27366e 100644 --- a/lib/src/anim_nav/animated_nav_tiles.dart +++ b/lib/src/anim_nav/animated_nav_tiles.dart @@ -63,31 +63,23 @@ class AnimatedNavigationTiles extends StatelessWidget { top: 6.0, ) : EdgeInsets.zero), - child: Badge( - label: items.badge, - isLabelVisible: items.showBadge, - backgroundColor: items.badgeColor, - padding: items.badgePadding, - child: InkWell( - onTap: onTap, - splashColor: inkEffect! ? inkColor : Colors.transparent, - highlightColor: Colors.transparent, - borderRadius: const BorderRadius.horizontal( - right: Radius.circular(52), - left: Radius.circular(52), - ), - // child: SizedBox( - // height: iconSize <= 26 ? 48 : 48 + (iconSize - 26), - child: Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: selected - ? barAnimation == BarAnimation.liquid - ? MainAxisAlignment.spaceBetween - : MainAxisAlignment.spaceEvenly - : MainAxisAlignment.center, - children: _getBarItems(), - ), + child: InkWell( + onTap: onTap, + splashColor: inkEffect! ? inkColor : Colors.transparent, + highlightColor: Colors.transparent, + borderRadius: const BorderRadius.horizontal( + right: Radius.circular(52), + left: Radius.circular(52), + ), + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: selected + ? barAnimation == BarAnimation.liquid + ? MainAxisAlignment.spaceBetween + : MainAxisAlignment.spaceEvenly + : MainAxisAlignment.center, + children: _getBarItems(), ), ), ), @@ -120,15 +112,21 @@ class AnimatedNavigationTiles extends StatelessWidget { return [ Container( alignment: Alignment.center, - child: IconTheme( - data: IconThemeData( - color: itemColor, - size: iconSize, - // size: selected ? iconSize + 4 : iconSize, + child: Badge( + label: items.badge, + isLabelVisible: items.showBadge, + backgroundColor: items.badgeColor, + padding: items.badgePadding, + child: IconTheme( + data: IconThemeData( + color: itemColor, + size: iconSize, + // size: selected ? iconSize + 4 : iconSize, + ), + child: selected && items.selectedIcon != null + ? items.selectedIcon! + : items.icon!, ), - child: selected && items.selectedIcon != null - ? items.selectedIcon! - : items.icon!, ), ), label, @@ -143,29 +141,36 @@ class AnimatedNavigationTiles extends StatelessWidget { color: itemColorOnSelected, ); return [ - AnimatedCrossFade( - firstChild: Padding( - padding: const EdgeInsets.all(6.0), - child: label, - ), - secondChild: Container( - alignment: Alignment.center, - child: IconTheme( - data: IconThemeData( - color: itemColor, - size: iconSize, + Badge( + label: items.badge, + isLabelVisible: items.showBadge, + backgroundColor: items.badgeColor, + padding: items.badgePadding, + alignment: const Alignment(0.175, -1.0), + child: AnimatedCrossFade( + firstChild: Padding( + padding: const EdgeInsets.all(6.0), + child: label, + ), + secondChild: Container( + alignment: Alignment.center, + child: IconTheme( + data: IconThemeData( + color: itemColor, + size: iconSize, + ), + child: selected && items.selectedIcon != null + ? items.selectedIcon! + : items.icon!, ), - child: selected && items.selectedIcon != null - ? items.selectedIcon! - : items.icon!, ), + duration: const Duration(milliseconds: 600), + sizeCurve: Curves.fastOutSlowIn, + firstCurve: Curves.fastOutSlowIn, + secondCurve: Curves.fastOutSlowIn.flipped, + crossFadeState: + selected ? CrossFadeState.showFirst : CrossFadeState.showSecond, ), - duration: const Duration(milliseconds: 600), - sizeCurve: Curves.fastOutSlowIn, - firstCurve: Curves.fastOutSlowIn, - secondCurve: Curves.fastOutSlowIn.flipped, - crossFadeState: - selected ? CrossFadeState.showFirst : CrossFadeState.showSecond, ), AnimatedCrossFade( //to improve the animation replaced the Container with theSizedBox @@ -203,11 +208,17 @@ class AnimatedNavigationTiles extends StatelessWidget { ? _defaultItems() : iconStyle == IconStyle.animated ? [ - IconWidget( - item: items, - selected: selected, - iconSize: iconSize, - barAnimation: barAnimation, + Badge( + label: items.badge, + isLabelVisible: items.showBadge, + backgroundColor: items.badgeColor, + padding: items.badgePadding, + child: IconWidget( + item: items, + selected: selected, + iconSize: iconSize, + barAnimation: barAnimation, + ), ), AnimatedCrossFade( alignment: const Alignment(0, 0), @@ -225,14 +236,20 @@ class AnimatedNavigationTiles extends StatelessWidget { : [ Container( alignment: Alignment.center, - child: IconTheme( - data: IconThemeData( - color: itemColor, - size: selected ? iconSize + 4 : iconSize, + child: Badge( + label: items.badge, + isLabelVisible: items.showBadge, + backgroundColor: items.badgeColor, + padding: items.badgePadding, + child: IconTheme( + data: IconThemeData( + color: itemColor, + size: selected ? iconSize + 4 : iconSize, + ), + child: selected && items.selectedIcon != null + ? items.selectedIcon! + : items.icon!, ), - child: selected && items.selectedIcon != null - ? items.selectedIcon! - : items.icon!, ), ), ]; @@ -240,46 +257,53 @@ class AnimatedNavigationTiles extends StatelessWidget { List _dropItems() { return [ - AnimatedCrossFade( - firstChild: Container( - alignment: Alignment.center, - child: IconTheme( - data: IconThemeData( - color: itemColor, - size: iconSize, + Badge( + label: items.badge, + isLabelVisible: items.showBadge, + backgroundColor: items.badgeColor, + padding: items.badgePadding, + alignment: const Alignment(0.17, -1.0), + child: AnimatedCrossFade( + firstChild: Container( + alignment: Alignment.center, + child: IconTheme( + data: IconThemeData( + color: itemColor, + size: iconSize, + ), + child: selected && items.selectedIcon != null + ? items.selectedIcon! + : items.icon!, ), - child: selected && items.selectedIcon != null - ? items.selectedIcon! - : items.icon!, ), - ), - secondChild: Align( - alignment: Alignment.center, - child: WaterDrop( - top: 0, - size: const Size(48, 48), - left: 0, - child: Container( - color: items.backgroundColor, - padding: const EdgeInsets.all(12), - child: IconTheme( - data: IconThemeData( - color: itemColor, - size: iconSize, + secondChild: Align( + alignment: Alignment.center, + child: WaterDrop( + top: 0, + size: const Size(48, 48), + left: 0, + child: Container( + color: items.backgroundColor, + padding: const EdgeInsets.all(12), + child: IconTheme( + data: IconThemeData( + color: itemColor, + size: iconSize, + ), + child: selected && items.selectedIcon != null + ? items.selectedIcon! + : items.icon!, ), - child: selected && items.selectedIcon != null - ? items.selectedIcon! - : items.icon!, ), ), ), + duration: const Duration(milliseconds: 300), + sizeCurve: Curves.linear, + firstCurve: Curves.ease, + secondCurve: Curves.fastOutSlowIn.flipped, + crossFadeState: + selected ? CrossFadeState.showSecond : CrossFadeState.showFirst, ), - duration: const Duration(milliseconds: 300), - sizeCurve: Curves.linear, - firstCurve: Curves.ease, - secondCurve: Curves.fastOutSlowIn.flipped, - crossFadeState: - selected ? CrossFadeState.showSecond : CrossFadeState.showFirst, ) ]; } diff --git a/lib/src/dot_nav/dot_nav_tile.dart b/lib/src/dot_nav/dot_nav_tile.dart index 02cdb19..d592808 100644 --- a/lib/src/dot_nav/dot_nav_tile.dart +++ b/lib/src/dot_nav/dot_nav_tile.dart @@ -43,30 +43,24 @@ class DotNavigationTiles extends StatelessWidget { top: 6.0, ) : EdgeInsets.zero), - child: Badge( - label: item.badge, - isLabelVisible: item.showBadge, - backgroundColor: item.badgeColor, - padding: item.badgePadding, - child: IgnorePointer( - ignoring: selected, - child: InkWell( - onTap: onTap, - splashColor: - options.inkEffect ? options.inkColor : Colors.transparent, - highlightColor: Colors.transparent, - borderRadius: const BorderRadius.horizontal( - right: Radius.circular(52), - left: Radius.circular(52), - ), - child: Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: selected - ? MainAxisAlignment.spaceEvenly - : MainAxisAlignment.center, - children: _dotItems(), - ), + child: IgnorePointer( + ignoring: selected, + child: InkWell( + onTap: onTap, + splashColor: + options.inkEffect ? options.inkColor : Colors.transparent, + highlightColor: Colors.transparent, + borderRadius: const BorderRadius.horizontal( + right: Radius.circular(52), + left: Radius.circular(52), + ), + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: selected + ? MainAxisAlignment.spaceEvenly + : MainAxisAlignment.center, + children: _dotItems(), ), ), ), @@ -89,27 +83,34 @@ class DotNavigationTiles extends StatelessWidget { item: item, ); return [ - AnimatedCrossFade( - firstChild: Padding( - padding: const EdgeInsets.all(6.0), - child: label, - ), - secondChild: Container( - alignment: Alignment.center, - child: IconTheme( - data: IconThemeData( - color: itemColor, - size: options.iconSize, + Badge( + label: item.badge, + isLabelVisible: item.showBadge, + backgroundColor: item.badgeColor, + padding: item.badgePadding, + alignment: const Alignment(0.175, -1.0), + child: AnimatedCrossFade( + firstChild: Padding( + padding: const EdgeInsets.all(6.0), + child: label, + ), + secondChild: Container( + alignment: Alignment.center, + child: IconTheme( + data: IconThemeData( + color: itemColor, + size: options.iconSize, + ), + child: iconChild, ), - child: iconChild, ), + duration: const Duration(milliseconds: 600), + sizeCurve: Curves.fastOutSlowIn, + firstCurve: Curves.fastOutSlowIn, + secondCurve: Curves.fastOutSlowIn.flipped, + crossFadeState: + selected ? CrossFadeState.showFirst : CrossFadeState.showSecond, ), - duration: const Duration(milliseconds: 600), - sizeCurve: Curves.fastOutSlowIn, - firstCurve: Curves.fastOutSlowIn, - secondCurve: Curves.fastOutSlowIn.flipped, - crossFadeState: - selected ? CrossFadeState.showFirst : CrossFadeState.showSecond, ), AnimatedCrossFade( firstChild: const SizedBox(), From 189d17ed5635113b6132eb5fee5bb65a8939d761 Mon Sep 17 00:00:00 2001 From: MarsadMaqsood Date: Sat, 9 Dec 2023 00:49:14 +0500 Subject: [PATCH 4/4] updated --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index fc5c95b..c5f7b60 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ A collection of stylish bottom navigation bars like animated bottom bar and bubb ## ⭐ Installing dependencies: - stylish_bottom_bar: ^1.1.0-beta + stylish_bottom_bar: ^1.1.0-beta-2 ## ⚡ Import