Flutter 기초(둘)
목록의 클릭 이벤트
페이지 점프 전송 매개 변수
Widget
return Scaffold(
appBar: AppBar(
// Here we take the value from the MyHomePage object that was created by
// the App.build method, and use it to set our appbar title.
title: Text(widget.title),
centerTitle: true,
backgroundColor: Colors.red,
),
// bottomNavigationBar: BottomNavigationBar(items: null),
// bottomSheet: BottomSheet(onClosing: null, builder: null),
body: Center(
// Center is a layout widget. It takes a single child and positions it
// in the middle of the parent.
child: Column(
// Column is also a layout widget. It takes a list of children and
// arranges them vertically. By default, it sizes itself to fit its
// children horizontally, and tries to be as tall as its parent.
//
// Invoke "debug painting" (press "p" in the console, choose the
// "Toggle Debug Paint" action from the Flutter Inspector in Android
// Studio, or the "Toggle Debug Paint" command in Visual Studio Code)
// to see the wireframe for each widget.
//
// Column has various properties to control how it sizes itself and
// how it positions its children. Here we use mainAxisAlignment to
// center the children vertically; the main axis here is the vertical
// axis because Columns are vertical (the cross axis would be
// horizontal).
mainAxisAlignment: MainAxisAlignment.center,
children: [
RaisedButton(
child: Text("click to listPage"),
onPressed: () {
Navigator.pushNamed(context, "ListPage");
},
),
RaisedButton(
child: Text("click to TestPage"),
onPressed: () {
Navigator.pushNamed(context, "TestTwo");
},
),
Text(
'You have pushed the button this many times:',
),
Text(
'$_counter',
style: Theme.of(context).textTheme.display1,
),
Text('test'),
],
),
),
floatingActionButton: FloatingActionButton(
onPressed: _incrementCounter,
//
// onPressed: () {
// Navigator.push(context, MaterialPageRoute(builder: (context) {
// return ListPage();
// }));
// },
tooltip: 'Increment',
child: Icon(Icons.add),
), // This trailing comma makes auto-formatting nicer for build methods.
);
import 'package:flutter/material.dart';
class ButtonPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("ButtonPage"),
),
body: new Column(
children: [
RaisedButton(
child: Text("raise button"),
onPressed: () {},
),
FlatButton(
child: Text("flat button"),
color: Colors.red,
),
OutlineButton(
child: Text("outline button"),
textColor: Colors.blue,
),
IconButton(
icon: Icon(Icons.add),
),
],
),
);
}
}
import 'package:flutter/material.dart';
class ContainerPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Title(
child: Text("container page"),
color: Colors.red,
),
),
body: Center(
child: new Column(
children: [
Container(
color: Colors.red,
width: 200,
margin: EdgeInsets.only(left: 150),
padding: EdgeInsets.only(right: 150),
height: 200,
//
transform: Matrix4.rotationZ(0.5),
child: Text(
"hello container",
style: TextStyle(fontSize: 30, color: Colors.black),
),
),
Image(
image: NetworkImage(
"https://dss0.bdstatic.com/5aV1bjqh_Q23odCf/static/superman/img/logo/logo_white-d0c9fe2af5.png"),
),
],
)),
);
}
}
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
다양한 언어의 JSONJSON은 Javascript 표기법을 사용하여 데이터 구조를 레이아웃하는 데이터 형식입니다. 그러나 Javascript가 코드에서 이러한 구조를 나타낼 수 있는 유일한 언어는 아닙니다. 저는 일반적으로 '객체'{}...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.