You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
책에서는 SecondStatefullPage가 생성이 될 때 뒤에 있는 FirstStatefullPage도 같이 그려진다고 되어 있는데
로그에선 SecondStatefullPage만 그려졌습니다.
어떤 부분이 잘못되었는지 잘 모르겠네요.
확인 좀 부탁드립니다.
class MyApp extends StatelessWidget {
// This widget is the root of your application. @OverRide
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
// This is the theme of your application.
//
// Try running your application with "flutter run". You'll see the
// application has a blue toolbar. Then, without quitting the app, try
// changing the primarySwatch below to Colors.green and then invoke
// "hot reload" (press "r" in the console where you ran "flutter run",
// or simply save your changes to "hot reload" in a Flutter IDE).
// Notice that the counter didn't reset back to zero; the application
// is not restarted.
primarySwatch: Colors.blue,
// This makes the visual density adapt to the platform that you run
// the app on. For desktop platforms, the controls will be smaller and
// closer together (more dense) than on mobile platforms.
visualDensity: VisualDensity.adaptivePlatformDensity,
),
home: FirstStatefulPage(),
);
}
}
저도 방금 확인해 보니 책 내용과 다르게 FirstPage가 다시 그려지지 않았습니다.
그래서 책 집필 당시 버전(1.12.13)으로 다운그레이드 해서 확인 해 보니 책 내용대로 이전 화면도 다시 그려집니다.
현재 버전이 1.17 버전대라서 그 사이에 엄청나게 업데이트되면서 불필요한 동작이 개선된 것 같습니다.
해당 내용에 대해 깃헙에 공지하고 개정시 해당 절은 삭제 조치해야겠네요.
제보 감사드립니다.
현재 6.3.2절의 StatefullWidget 클래스의 동작을 확인하고 있습니다.
코드는 잘 동작합미다만,
책에서는 SecondStatefullPage가 생성이 될 때 뒤에 있는 FirstStatefullPage도 같이 그려진다고 되어 있는데
로그에선 SecondStatefullPage만 그려졌습니다.
어떤 부분이 잘못되었는지 잘 모르겠네요.
확인 좀 부탁드립니다.
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@OverRide
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
// This is the theme of your application.
//
// Try running your application with "flutter run". You'll see the
// application has a blue toolbar. Then, without quitting the app, try
// changing the primarySwatch below to Colors.green and then invoke
// "hot reload" (press "r" in the console where you ran "flutter run",
// or simply save your changes to "hot reload" in a Flutter IDE).
// Notice that the counter didn't reset back to zero; the application
// is not restarted.
primarySwatch: Colors.blue,
// This makes the visual density adapt to the platform that you run
// the app on. For desktop platforms, the controls will be smaller and
// closer together (more dense) than on mobile platforms.
visualDensity: VisualDensity.adaptivePlatformDensity,
),
home: FirstStatefulPage(),
);
}
}
class Person{
String name;
int age;
Person(this.name, this.age);
}
class FirstStatefulPage extends StatefulWidget {
@OverRide
_FirstStatefulPageState createState() => _FirstStatefulPageState();
}
class _FirstStatefulPageState extends State {
@OverRide
Widget build(BuildContext context) {
print('FirstPage build() - ');
return Scaffold(
appBar: AppBar(
title: Text('First'),
),
body: RaisedButton(
child: Text('Move to Next Page'),
onPressed: () {
final person = Person('Peter', 20);
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => SecondStatefulPage(person: person),
)
);
},
)
);
}
}
class SecondStatefulPage extends StatefulWidget {
final Person person;
SecondStatefulPage({Key key, @required this.person}) : super(key: key);
@OverRide
_SecondStatefulPageState createState() => _SecondStatefulPageState();
}
class _SecondStatefulPageState extends State {
@OverRide
Widget build(BuildContext context) {
print('Second Page build() - ');
return Scaffold(
appBar: AppBar(
title: Text('Second Page'),
),
body: RaisedButton(
child: Text('이전 페이지로'),
onPressed: () {
Navigator.pop(context);
},
)
);
}
}
The text was updated successfully, but these errors were encountered: