Skip to content

Commit

Permalink
Merge pull request #37 from maheshmnj/issue-6
Browse files Browse the repository at this point in the history
Fixes Fade Transition is not smooth #6
  • Loading branch information
maheshj01 authored Dec 9, 2023
2 parents a965c5a + cbcdfe1 commit 1e55546
Show file tree
Hide file tree
Showing 9 changed files with 178 additions and 161 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ jobs:
channel: stable
- run: flutter pub get
- run: flutter test
- run: flutter drive --driver=test_driver/integration_test.dart --target=integration_test/app_test.dart
# - run: flutter drive --driver=test_driver/integration_test.dart --target=integration_test/app_test.dart
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## [0.7.0] Dec 08, 2023

- Fixes: [Issue #6](https://github.com/maheshmnj/navbar_router/issues/6) Fade Transition is not smooth

## [0.6.3] Nov 14, 2023

- Add a method to programmatically push a route to the NavigatorStack
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## **navbar_router v0.6.3**
## **navbar_router v0.7.0**

<a href="https://pub.dev/packages/navbar_router"><img src="https://img.shields.io/pub/v/navbar_router.svg" alt="Pub"></a>

Expand Down Expand Up @@ -139,10 +139,10 @@ defaults to

```dart
destinationAnimationCurve: Curves.fastOutSlowIn,
destinationAnimationDuration: 700,
destinationAnimationDuration: 600,
```

<img src="https://miro.medium.com/max/600/1*08wCOOPCe1C1l_2uqIYEEg.gif">
<img width="300" src="https://github.com/flutter/flutter/assets/31410839/90e2d176-cd62-4e0f-8b3c-6afa64c96330">

## Hide or show bottomNavigationBar

Expand Down Expand Up @@ -236,7 +236,7 @@ Each DestinationRouter specifies a List of Destinations, initialRoute, and the n

**_destinationAnimationCurve_**: Curve for the destination animation when the user taps a navbar item. Defaults to `Curves.fastOutSlowIn`.

**_destinationAnimationDuration_**: The duration in milliseconds of the animation of the destination. Defaults to 700ms.
**_destinationAnimationDuration_**: The duration in milliseconds of the animation of the destination. Defaults to 300ms.

**_errorBuilder_**: A WidgetBuilder to show the user when the user tried to navigate to a route that does not exist in the [destinations].

Expand Down
Binary file modified docs/assets/switch-destination.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
39 changes: 19 additions & 20 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -120,19 +120,19 @@ class _HomePageState extends State<HomePage> {
DateTime newTime = DateTime.now();

/// This is only for demo purposes
void simulateTabChange() {
void simulateTabChange({int times = 2, int delayInMs = 1000}) {
WidgetsBinding.instance.addPostFrameCallback((timeStamp) async {
for (int i = 0; i < items.length * 2; i++) {
for (int i = 0; i < items.length * times; i++) {
NavbarNotifier.index = i % items.length;
await Future.delayed(const Duration(milliseconds: 1000));
await Future.delayed(Duration(milliseconds: delayInMs));
}
});
}

@override
void initState() {
super.initState();
// simulateTabChange();
// simulateTabChange(times: 1, delayInMs: 2000);
NavbarNotifier.addIndexChangeListener((x) {
log('NavbarNotifier.indexChangeListener: $x');
});
Expand Down Expand Up @@ -360,26 +360,25 @@ class FeedTile extends StatelessWidget {
margin: const EdgeInsets.symmetric(horizontal: 8.0, vertical: 8),
color: Theme.of(context).colorScheme.surface,
child: Card(
child: Stack(
child: Column(
children: [
Positioned(
top: 4,
right: 4,
left: 4,
child: Container(
height: 180,
margin:
const EdgeInsets.symmetric(horizontal: 8.0, vertical: 8),
Container(
height: 180,
margin: const EdgeInsets.symmetric(horizontal: 8.0, vertical: 12),
alignment: Alignment.center,
decoration: BoxDecoration(
color: Theme.of(context).colorScheme.secondary,
alignment: Alignment.center,
child: Text('Feed $index card'),
borderRadius: BorderRadius.circular(8.0),
),
child: Text('Feed $index card'),
),
Positioned(
bottom: 12,
right: 12,
left: 12,
child: Text(placeHolderText.substring(0, 200)))
Container(
padding: const EdgeInsets.symmetric(horizontal: 8.0),
alignment: Alignment.center,
child: Text(
placeHolderText.substring(0, 200),
textAlign: TextAlign.justify,
))
],
),
),
Expand Down
2 changes: 1 addition & 1 deletion example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ packages:
path: ".."
relative: true
source: path
version: "0.6.3"
version: "0.7.0"
path:
dependency: transitive
description:
Expand Down
Loading

0 comments on commit 1e55546

Please sign in to comment.