-
Notifications
You must be signed in to change notification settings - Fork 30.1k
Closed
Labels
f: routesNavigator, Router, and related APIs.Navigator, Router, and related APIs.frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.platform-iosiOS applications specificallyiOS applications specifically
Description
Hi,
I'm observing a strange behavior for Hero animations applied to AppBar on iOS devices with notch (such as the iPhone X). Works fine for Android and other iOS devices. During the Hero animation, the content of the AppBar moves up and then down. I would expect it to be fixed since initial and last positions are the same. Also, I'm not sure if I'm doing anything wrong.
Here there is a minimal example to illustrate the problem:
void main() async {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
MyApp({
Key key,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
home: MyHomeScreen(),
);
}
}
Widget _heroAppBar({BuildContext context,String titleText}){
return PreferredSize(
preferredSize: Size.fromHeight(kToolbarHeight),
child: Hero(
tag: 'app_bar',
child: Builder(builder: (BuildContext context) {
return AppBar(title:Text(titleText));
}
),
),
);
}
class MyHomeScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar:_heroAppBar(context:context,titleText:"Home"),
body:Center(
child: IconButton(
iconSize: 100,
icon:Icon(Icons.play_arrow),
onPressed: (){
Navigator.push(context, MaterialPageRoute(builder: (context){
return MyNextScreen();
}));
}
),
)
);
}
}
class MyNextScreen extends StatelessWidget {
Widget build(BuildContext context) {
return Scaffold(
appBar:_heroAppBar(context:context,titleText:"Second"),
body:Center(child:Text("Second Screen")),
);
}
}I also attached a gif illustrating the problem.
Flutter doctor:
[✓] Flutter (Channel beta, v1.1.8, on Mac OS X 10.14.3 18D109, locale en-US)
• Flutter version 1.1.8 at /Users/filipi/Dropbox/flutter
• Framework revision 985ccb6d14 (5 weeks ago), 2019-01-08 13:45:55 -0800
• Engine revision 7112b72cc2
• Dart version 2.1.1 (build 2.1.1-dev.0.1 ec86471ccc)
[!] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
• Android SDK at /Users/filipi/Library/Android/sdk
• Android NDK at /Users/filipi/Library/Android/sdk/ndk-bundle
• Platform android-28, build-tools 28.0.3
• Java binary at: /Applications/Android
Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build
1.8.0_152-release-1136-b06)
! Some Android licenses not accepted. To resolve this, run: flutter doctor
--android-licenses
[✓] iOS toolchain - develop for iOS devices (Xcode 10.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 10.1, Build version 10B61
• ios-deploy 1.9.4
• CocoaPods version 1.5.3
[✓] Android Studio (version 3.2)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin version 31.1.1
• Dart plugin version 181.5656
• Java version OpenJDK Runtime Environment (build
1.8.0_152-release-1136-b06)
[✓] VS Code (version 1.31.0)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 2.22.3
[✓] Connected device (1 available)
• iPhone 7 • E4F4A562-02D4-4217-8F18-91DF4D05CFB2 • ios • iOS 12.1
(simulator)
! Doctor found issues in 1 category.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
f: routesNavigator, Router, and related APIs.Navigator, Router, and related APIs.frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.platform-iosiOS applications specificallyiOS applications specifically

