Skip to content

Commit

Permalink
add: textStyle, margin and borderRadius properties in animatedTextBot…
Browse files Browse the repository at this point in the history
…tomBar

make: text and image property as required in BottomBarItem
  • Loading branch information
jagritjkh committed Mar 17, 2021
1 parent e9ba680 commit a6515a8
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 18 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## [0.0.4] - 2021-03-18

* add textStyle, margin and borderRadius properties in animatedTextBottomBar
* make text and image property as required in BottomBarItem

## [0.0.3] - 2021-03-18

* add activeColor and inactiveColor property to bottom bar item
Expand Down
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ To use this package, add `animation_wrappers` as a [dependency in your pubspec.y
## Add dependency
```
dependencies:
animation_wrappers: ^0.0.3
animation_wrappers: ^0.0.4
```

## Import
Expand Down Expand Up @@ -38,4 +38,8 @@ FadedSlideAnimation(
beginOffset: Offset(0.5, 2),
endOffset: Offset(0.5, 1),
),
```
```

Many more animation wrappers and animated bottom bars will be added soon..!

Made with :heart: by Jagrit
2 changes: 1 addition & 1 deletion example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ packages:
path: ".."
relative: true
source: path
version: "0.0.2"
version: "0.0.3"
async:
dependency: transitive
description:
Expand Down
4 changes: 1 addition & 3 deletions example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,4 @@ dev_dependencies:

flutter:

uses-material-design: true
assets:
- assets/
uses-material-design: true
37 changes: 26 additions & 11 deletions lib/AnimatedBottomNavigationBars/animated_text_bottom_bar.dart
Original file line number Diff line number Diff line change
@@ -1,23 +1,33 @@
import 'package:flutter/material.dart';

///animated bottom navigation bar with animated text
///children: list of bottom navigation bar items which consists of text and icon
///text: the title of the item
///icon: widget(image or icon) of the item
///onBarTap: function performed when a particular child item is pressed
///animatedTextDuration: duration of animated text (default value: Duration(milliseconds: 250))
///animatedTextCurve: curve of animated text (default value: Curves.easeInOut)
///textStyle: styling of animated text
///margin: margin of animated bottom navigation bar (default value: EdgeInsets.zero)
///borderRadius: border radius of animated bottom navigation bar (default value: BorderRadius.zero)
class AnimatedTextBottomBar extends StatefulWidget {
final List<BottomBarItem> children;
final Function onBarTap;
final Duration animatedTextDuration;
final Curve animatedTextCurve;
final TextStyle? textStyle;
final EdgeInsetsGeometry? margin;
final BorderRadiusGeometry? borderRadius;

AnimatedTextBottomBar({
required this.children,
required this.onBarTap,
this.animatedTextDuration = const Duration(milliseconds: 250),
this.animatedTextCurve = Curves.easeInOut,
this.textStyle,
this.margin = EdgeInsets.zero,
this.borderRadius = BorderRadius.zero,
});

@override
Expand All @@ -32,8 +42,10 @@ class _AnimatedTextBottomBarState extends State<AnimatedTextBottomBar>
Widget build(BuildContext context) {
return Material(
elevation: 10.0,
borderRadius: widget.borderRadius!,
child: Container(
padding: EdgeInsets.symmetric(vertical: 10.0),
margin: widget.margin!,
color: Theme.of(context).scaffoldBackgroundColor,
child: Row(
mainAxisSize: MainAxisSize.max,
Expand Down Expand Up @@ -68,22 +80,23 @@ class _AnimatedTextBottomBarState extends State<AnimatedTextBottomBar>
child: Row(
children: <Widget?>[
ImageIcon(
AssetImage(item.image!),
AssetImage(item.image),
color: isSelected
? item.activeColor ?? Theme.of(context).primaryColor
: item.inactiveColor ?? Colors.black12,
: item.inactiveColor ?? Colors.black,
),
SizedBox(width: 10.0),
AnimatedSize(
duration: widget.animatedTextDuration,
curve: widget.animatedTextCurve,
vsync: this,
child: Text(
isSelected ? item.text! : "",
style: Theme.of(context)
.textTheme
.headline2!
.copyWith(fontWeight: FontWeight.w600),
isSelected ? item.text : "",
style: widget.textStyle ??
Theme.of(context)
.textTheme
.headline2!
.copyWith(fontWeight: FontWeight.w600),
),
),
] as List<Widget>,
Expand All @@ -100,15 +113,17 @@ class _AnimatedTextBottomBarState extends State<AnimatedTextBottomBar>
///text: the text to be animated (it will be shown only when the item is selected
///icon: icon shown when the item is selected or unselected
///activeColor: color of image(icon) when the item is selected
///inactiveColor: color of image(icon) when the item is not selected
class BottomBarItem {
final String? text;
final String? image;
final String text;
final String image;
final Color? activeColor;
final Color? inactiveColor;

BottomBarItem({
this.text,
this.image,
required this.text,
required this.image,
this.activeColor,
this.inactiveColor,
});
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: animation_wrappers
description: Animation Wrapper widgets, just wrap the child to be animated with this wrapper widget and that child will be animated.
version: 0.0.3
version: 0.0.4
author: Jagrit Kharbanda<jagritjkh@gmail.com>
homepage: https://github.com/jagritjkh/animation_wrappers

Expand Down

0 comments on commit a6515a8

Please sign in to comment.