Reputation: 4394
I have an app with a list of tile, when one of them is pressed this page push is triggered :
Navigator.push(
context,
MaterialPageRoute(
builder: (context) =>
ExistingAppointment(appointment: _appointment)));
When I push for the first time, the animation does not trigger or "freeze". Further navigation animates properly. I made a video here :
The initial scaffold is as follow :
@override
Widget build(BuildContext context) {
return Scaffold(
body: tabs[_selectedIndex],
bottomNavigationBar: BottomNavigationBar(
selectedItemColor: Theme.of(context).primaryColor,
unselectedItemColor: Colors.grey,
showUnselectedLabels: true,
items: [
BottomNavigationBarItem(
icon: Icon(Icons.calendar_today), label: 'Agenda'),
BottomNavigationBarItem(icon: Icon(Icons.people), label: 'Patients'),
BottomNavigationBarItem(
icon: Icon(Icons.account_balance_wallet), label: 'Comptabilité'),
BottomNavigationBarItem(
icon: Icon(Icons.settings), label: 'Paramètres'),
],
currentIndex: _selectedIndex,
onTap: _onItemTapped,
),
);
}
}
Upvotes: 4
Views: 2328
Reputation: 6029
Did you check this open issue on Flutter Git
There are a couple workarounds suggested by some users here
Please check if the above mentioned workaround in the following code solves your issue:
Future<Widget> buildPageAsync() async { return Future.microtask(() { return HeavyDetailPage(); }); }
How to use this:
var page = await buildPageAsync(); var route = MaterialPageRoute(builder: (_) => page); Navigator.push(context, route);
Upvotes: 1