import 'package:flutter/material.dart';
class FirstPage extends StatefulWidget {
const FirstPage({super.key});
State<FirstPage> createState() => _FirstPageState();
}
class _FirstPageState extends State<FirstPage> {
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('FirstPage'),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
ElevatedButton(onPressed: (){
}, child: Text('Go To SecondPage')),
],
),
),
);
}
}
import 'package:flutter/material.dart';
class SecondPage extends StatefulWidget {
const SecondPage({super.key});
State<SecondPage> createState() => _SecondPageState();
}
class _SecondPageState extends State<SecondPage> {
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('SecondPage'),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
ElevatedButton(onPressed: (){
}, child: Text('Go To FirstPage')),
],
),
),
);
}
}
Navigator.push(context, MaterialPageRoute(builder: (context) => SecondPage()));
Navigator.pop(context);
import 'package:flutter/material.dart';
import 'package:testpage/secondPage.dart';
class FirstPage extends StatefulWidget {
const FirstPage({super.key});
State<FirstPage> createState() => _FirstPageState();
}
class _FirstPageState extends State<FirstPage> {
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('FirstPage'),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
ElevatedButton(onPressed: (){
Navigator.push(context, MaterialPageRoute(builder: (context) => SecondPage()));
}, child: Text('Go To SecondPage')),
],
),
),
);
}
}
import 'package:flutter/material.dart';
class SecondPage extends StatefulWidget {
const SecondPage({super.key});
State<SecondPage> createState() => _SecondPageState();
}
class _SecondPageState extends State<SecondPage> {
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('SecondPage'),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
ElevatedButton(onPressed: (){
Navigator.pop(context);
}, child: Text('Go To FirstPage')),
],
),
),
);
}
}
가치 있는 정보 공유해주셔서 감사합니다.