Flutter 질감 디자인 의 폼 입력
import 'package:flutter/material.dart';
class MyApp extends StatefulWidget {
 @override
 _MyApp createState() => new _MyApp();
}
class _MyApp extends State<MyApp> {
 String _lastName;
 String _firstName;
 GlobalKey<FormState> _formKey = new GlobalKey<FormState>();
 void _showMessage(String name) {
  showDialog<Null>(
   context: context,
   child: new AlertDialog(
    content: new Text(name),
    actions: <Widget>[
     new FlatButton(
      onPressed: () {
       Navigator.pop(context);
      },
      child: new Text('  ')
     )
    ]
   )
  );
 }
 @override
 Widget build(BuildContext context) {
  return new Scaffold(
   appBar: new AppBar(
    title: new Text('    ')
   ),
   // Form:                 
   body: new Form(
    key: _formKey,
    child: new Column(
     children: <Widget> [
      // TextFieldd:         ,          FormField   
      new TextField(
       labelText: '  ',
       // onSaved:   Form.save()          
       onSaved: (InputValue value) {
        _lastName = value.text;
       }
      ),
      new TextField(
       labelText: '  ',
       onSaved: (InputValue value) {
        _firstName = value.text;
       }
      ),
      new Row(
       children: <Widget> [
        new RaisedButton(
         child: new Text('  '),
         onPressed: () {
          // reset():  Form    TextField       
          _formKey.currentState.reset();
          _showMessage('        ');
         }
        ),
        new RaisedButton(
         child: new Text('  '),
         onPressed: () {
          // save():  Form    TextField
          _formKey.currentState.save();
          _showMessage('     '+_lastName+_firstName);
         }
        )
       ]
      )
     ]
    )
   )
  );
 }
}
void main() {
 runApp(new MaterialApp(
  title: 'Flutter Demo',
  home: new MyApp()
 ));
} 
 이상 이 바로 본 고의 모든 내용 입 니 다.여러분 의 학습 에 도움 이 되 고 저 희 를 많이 응원 해 주 셨 으 면 좋 겠 습 니 다.
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
【Flutter】DateTime 전월의 일수를 취득한다달의 일수를 취득할 필요가 있어, 의외로 수요 있을까라고 생각했으므로 비망록 정도에 남겨 둡니다. DateTime 날짜에 0을 입력하면 전월 DateTime이 됩니다. 2021년 3월 0일 = 2021년 2월 28일...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.