Skip to content
This repository has been archived by the owner on Jun 23, 2022. It is now read-only.

Anil #25

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Anil #25

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ class _AppState extends State<App> {
bottomSheetWidget: _bottomSheet(),
showBottomSheetAt: 2,
onTabSelected: (index) {
print(index);
setState(() {
_index = index;
});
Expand Down
40 changes: 20 additions & 20 deletions example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,42 +7,42 @@ packages:
name: async
url: "https://pub.dartlang.org"
source: hosted
version: "2.4.2"
version: "2.5.0-nullsafety.1"
boolean_selector:
dependency: transitive
description:
name: boolean_selector
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
version: "2.1.0-nullsafety.1"
characters:
dependency: transitive
description:
name: characters
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.0"
version: "1.1.0-nullsafety.3"
charcode:
dependency: transitive
description:
name: charcode
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.3"
version: "1.2.0-nullsafety.1"
clock:
dependency: transitive
description:
name: clock
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.1"
version: "1.1.0-nullsafety.1"
collection:
dependency: transitive
description:
name: collection
url: "https://pub.dartlang.org"
source: hosted
version: "1.14.13"
version: "1.15.0-nullsafety.3"
cupertino_icons:
dependency: "direct main"
description:
Expand All @@ -56,7 +56,7 @@ packages:
name: fake_async
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
version: "1.2.0-nullsafety.1"
flutter:
dependency: "direct main"
description: flutter
Expand All @@ -73,14 +73,14 @@ packages:
name: matcher
url: "https://pub.dartlang.org"
source: hosted
version: "0.12.8"
version: "0.12.10-nullsafety.1"
meta:
dependency: transitive
description:
name: meta
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.8"
version: "1.3.0-nullsafety.3"
nested:
dependency: transitive
description:
Expand All @@ -94,7 +94,7 @@ packages:
name: path
url: "https://pub.dartlang.org"
source: hosted
version: "1.7.0"
version: "1.8.0-nullsafety.1"
provider:
dependency: transitive
description:
Expand All @@ -113,63 +113,63 @@ packages:
name: source_span
url: "https://pub.dartlang.org"
source: hosted
version: "1.7.0"
version: "1.8.0-nullsafety.2"
ss_bottom_navbar:
dependency: "direct main"
description:
path: ".."
relative: true
source: path
version: "0.0.9"
version: "0.0.10"
stack_trace:
dependency: transitive
description:
name: stack_trace
url: "https://pub.dartlang.org"
source: hosted
version: "1.9.5"
version: "1.10.0-nullsafety.1"
stream_channel:
dependency: transitive
description:
name: stream_channel
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
version: "2.1.0-nullsafety.1"
string_scanner:
dependency: transitive
description:
name: string_scanner
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.5"
version: "1.1.0-nullsafety.1"
term_glyph:
dependency: transitive
description:
name: term_glyph
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
version: "1.2.0-nullsafety.1"
test_api:
dependency: transitive
description:
name: test_api
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.17"
version: "0.2.19-nullsafety.2"
typed_data:
dependency: transitive
description:
name: typed_data
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
version: "1.3.0-nullsafety.3"
vector_math:
dependency: transitive
description:
name: vector_math
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.8"
version: "2.1.0-nullsafety.3"
sdks:
dart: ">=2.9.0-14.0.dev <3.0.0"
dart: ">=2.10.0-110 <2.11.0"
flutter: ">=1.17.0 <2.0.0"
22 changes: 11 additions & 11 deletions lib/service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -103,15 +103,15 @@ class SSBottomNavBarSettings {

SSBottomNavBarSettings(
{this.items,
this.iconSize,
this.backgroundColor,
this.color,
this.selectedColor,
this.unselectedColor,
this.onTabSelected,
this.shadow,
this.selected,
this.isWidthFixed,
this.visible,
this.duration});
this.iconSize,
this.backgroundColor,
this.color,
this.selectedColor,
this.unselectedColor,
this.onTabSelected,
this.shadow,
this.selected,
this.isWidthFixed,
this.visible,
this.duration});
}
90 changes: 48 additions & 42 deletions lib/ss_bottom_navbar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -145,20 +145,20 @@ class BottomNavBar extends StatefulWidget {

BottomNavBar(
{@required this.items,
this.iconSize,
this.backgroundColor,
this.color,
this.selectedColor,
this.unselectedColor,
this.onTabSelected,
this.shadow,
this.selected,
this.isWidthFixed,
this.visible,
this.bottomSheetWidget,
this.showBottomSheetAt,
this.bottomSheetHistory,
this.duration});
this.iconSize,
this.backgroundColor,
this.color,
this.selectedColor,
this.unselectedColor,
this.onTabSelected,
this.shadow,
this.selected,
this.isWidthFixed,
this.visible,
this.bottomSheetWidget,
this.showBottomSheetAt,
this.bottomSheetHistory,
this.duration});

@override
_BottomNavBarState createState() => _BottomNavBarState();
Expand Down Expand Up @@ -199,11 +199,12 @@ class _BottomNavBarState extends State<BottomNavBar> {
rect1['y'] + rect1['height'] > rect2['y']) {
Navigator.maybePop(context);
_service.clickedIndex = index;

var condition = index == widget.showBottomSheetAt && widget.bottomSheetHistory;

_updateIndex(condition ? _tempIndex : index);
if (condition) _service.clickedIndex = _tempIndex;
setState(() {
_tempIndex=index;
});
_updateIndex(index);
_service.clickedIndex = _tempIndex;
}
}
}
Expand Down Expand Up @@ -277,25 +278,29 @@ class _BottomNavBarState extends State<BottomNavBar> {
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: _service.items
.map((e) => NavItem(
e,
onTab: () {
var index = _service.items.indexOf(e);

if (index == widget.showBottomSheetAt)
SSBottomSheet.show(
context: context,
child: widget.bottomSheetWidget,
onPressed: _onPressed,
dismissedByAnimation: _dismissedByAnimation);
else
_tempIndex = index;

_service.clickedIndex = index;

if (_service.settings.selected == null) _service.setSelected(index);
_updateIndex(index);
},
))
e,
onTab: () {
var index = _service.items.indexOf(e);
if (index == widget.showBottomSheetAt) {
SSBottomSheet.show(
context: context,
child: widget.bottomSheetWidget,
onPressed: _onPressed,
dismissedByAnimation: _dismissedByAnimation);
}
else
{
_tempIndex = index;

}
_service.clickedIndex = index;

if (_service.settings.selected == null) {
_service.setSelected(index);
}
_updateIndex(index);
},
))
.toList()),
)
],
Expand Down Expand Up @@ -331,11 +336,11 @@ class SSBottomSheet extends StatefulWidget {

static show(
{@required BuildContext context,
@required child,
backgroundColor = const Color(0xb3212121),
double bottomMargin,
ValueChanged<bool> dismissedByAnimation,
ValueChanged<Offset> onPressed}) {
@required child,
backgroundColor = const Color(0xb3212121),
double bottomMargin,
ValueChanged<bool> dismissedByAnimation,
ValueChanged<Offset> onPressed}) {
Navigator.of(context, rootNavigator: true).push(PageRouteBuilder(
pageBuilder: (_, __, ___) {
return SSBottomSheet(
Expand Down Expand Up @@ -367,6 +372,7 @@ class _SSBottomSheetState extends State<SSBottomSheet> with SingleTickerProvider
super.initState();

_animationController = AnimationController(vsync: this, duration: Duration(milliseconds: 200));

_animation = Tween<double>(begin: 1, end: 0).animate(_animationController);

_animationController.addStatusListener((status) {
Expand Down
6 changes: 3 additions & 3 deletions lib/views/slide_box.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ class _SlideBoxState extends State<SlideBox> with TickerProviderStateMixin {
var _sizeX = _service.items[_service.selected].isIconOnly
? _service.sizes[_service.selected].dx
: _service.settings.isWidthFixed
? _service.sizesBig.reduce((curr, next) => curr.dx > next.dx ? curr : next).dx
: _service.state == SSBottomNavBarState.text ? _service.sizesBig[_service.selected].dx : _service.sizes[_service.selected].dx;
? _service.sizesBig.reduce((curr, next) => curr.dx > next.dx ? curr : next).dx
: _service.state == SSBottomNavBarState.text ? _service.sizesBig[_service.selected].dx : _service.sizes[_service.selected].dx;
var _posX = _service.state == SSBottomNavBarState.text ? _service.positionsBig[_service.selected].dx : _service.positions[_service.selected].dx;

var _width = _sizeX + _sizeFactor * 2;
Expand All @@ -42,7 +42,7 @@ class _SlideBoxState extends State<SlideBox> with TickerProviderStateMixin {
color: _service.settings.color,
borderRadius: BorderRadius.all(Radius.circular(5)),
boxShadow:
_service.settings.shadow ?? [BoxShadow(offset: Offset(0, 3), blurRadius: 6, color: const Color(0xff000000).withOpacity(0.16))]),
_service.settings.shadow ?? [BoxShadow(offset: Offset(0, 3), blurRadius: 6, color: const Color(0xff000000).withOpacity(0.16))]),
child: AnimatedSize(
curve: Curves.ease,
child: new Container(
Expand Down
Loading