diff --git a/example/lib/main.dart b/example/lib/main.dart index afd1a6b..e31b1a9 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -193,7 +193,19 @@ class _HomePageState extends ConsumerState { mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ const SizedBox( - width: 100, + width: 60, + ), + FloatingActionButton.extended( + heroTag: 'RandomIndex', + onPressed: () { + int index = Random().nextInt(100); + print('index: $index'); + NavbarNotifier.index = index % 4; + }, + label: const Text("Random Index"), + ), + const SizedBox( + width: 20, ), FloatingActionButton.extended( heroTag: 'showSnackBar', @@ -365,9 +377,7 @@ class _HomeFeedsState extends State { @override Widget build(BuildContext context) { return Scaffold( - appBar: AppBar( - title: const Text('Feeds'), - ), + appBar: AppBar(title: const Text('Feeds')), body: ListView.builder( controller: _scrollController, itemCount: 30, diff --git a/lib/src/navbar_router.dart b/lib/src/navbar_router.dart index 774ee78..b9329d9 100644 --- a/lib/src/navbar_router.dart +++ b/lib/src/navbar_router.dart @@ -352,6 +352,7 @@ class _NavbarRouterState extends State child: AnimatedBuilder( animation: _navbarNotifier, builder: (context, child) { + _handleFadeAnimation(); return Stack( children: [ AnimatedPadding( diff --git a/test/navbar_utils.dart b/test/navbar_utils.dart index 8bd8e33..d87467f 100644 --- a/test/navbar_utils.dart +++ b/test/navbar_utils.dart @@ -93,9 +93,7 @@ class _HomeFeedsState extends State { @override Widget build(BuildContext context) { return Scaffold( - appBar: AppBar( - title: const Text('Feeds'), - ), + appBar: AppBar(title: const Text('Feeds')), body: ListView.builder( controller: _scrollController, itemCount: 30, @@ -131,26 +129,26 @@ 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: const Text( + placeHolderText, + maxLines: 4, + overflow: TextOverflow.ellipsis, + )) ], ), ), @@ -233,6 +231,11 @@ class _ProductListState extends State { super.dispose(); } + @override + void initState() { + super.initState(); + } + @override Widget build(BuildContext context) { return Scaffold( @@ -372,6 +375,17 @@ class UserProfile extends StatefulWidget { class _UserProfileState extends State { final GlobalKey iconKey = GlobalKey(); + final Uri _url = Uri.parse('https://docs.maheshjamdade.com/navbar_router/'); + + Future _launchUrl() async { + throw Exception('Could not launch $_url'); + } + + @override + void initState() { + super.initState(); + } + @override Widget build(BuildContext context) { return Scaffold( @@ -379,6 +393,11 @@ class _UserProfileState extends State { appBar: AppBar( centerTitle: false, actions: [ + IconButton( + tooltip: 'show Docs', + icon: const Icon(Icons.edit_document), + onPressed: _launchUrl, + ), IconButton( key: iconKey, icon: const Icon(Icons.edit), @@ -391,7 +410,7 @@ class _UserProfileState extends State { offset: offset, transitionType: TransitionType.reveal); }, - ) + ), ], title: const Text('Hi User')), body: Center(