Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 | 31 |
Tags
- InkWell
- Networking
- ListView.builder
- Flutter Tutorial
- Snackbar
- node.js
- CrossAxisAlignment
- listview
- ListTile
- Flutter 앱 배포
- Column Widget
- AppBar
- flutter
- sqlite
- Image.network
- Flutter 예제
- WillPopScope
- HTTP
- 반석천
- Row
- Flutter 강좌
- Scaffold
- MainAxisAlignment
- Row Widget
- Hello World
- Cached Image
- FutureBuilder
- Load Image
- Flutter Example
- navigator
Archives
- Today
- Total
꿈꾸는 시스템 디자이너
Flutter Example - Navigation & routing | Return data from a screen 본문
Tutorial/Flutter with App
Flutter Example - Navigation & routing | Return data from a screen
독행소년 2019. 9. 27. 00:40import 'package:flutter/material.dart';
class NaviGetData extends StatelessWidget {
final scaffoldKey = GlobalKey<ScaffoldState>();
@override
Widget build(BuildContext context) {
return Scaffold(
key: scaffoldKey,
appBar: AppBar(title: Text("First Screen")),
body: Center(
child: RaisedButton(
child: Text("Launch Screen"),
onPressed: () {
receiveData(context);
},
),
),
);
}
receiveData(BuildContext context) async {
String result = await Navigator.push(
context, MaterialPageRoute(builder: (context) => NaviReturnData()));
scaffoldKey.currentState
..hideCurrentSnackBar()
..showSnackBar(SnackBar(
content: Text("Received Data: $result"),
));
}
}
class NaviReturnData extends StatelessWidget {
List<String> fruits = ["Apples", "Oranges", "Bananas"];
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: Text("Second Screen")),
body: ListView.builder(
itemCount: fruits.length,
itemBuilder: (context, index) {
return Card(
child: ListTile(
title: Text("${fruits[index]}"),
onTap: () {
Navigator.pop(context, fruits[index]);
},
),
);
},
),
);
}
}
▶ Go to Table of Contents | 강의 목차로 이동
※ This example is also available in the Flutter Code Examples app. | 본 예제는 Flutter Code Examples 앱에서도 제공됩니다.
'Tutorial > Flutter with App' 카테고리의 다른 글
Flutter Example - WillPopScope | Handel back button pressed (0) | 2019.09.27 |
---|---|
Flutter Example - AlertDialog (0) | 2019.09.27 |
Flutter Example - Navigation & routing | Send data to a new screen (0) | 2019.09.27 |
Flutter Example - Navigation & routing | Navigate to a new screen and back (2) | 2019.09.26 |
Flutter Example - Shared Preferences (0) | 2019.09.26 |
Comments