목록Flutter (19)
HIT해
String _message = '안녕 world'; // _ 붙이면 private 변수명 앞에 _를 붙이면 private이고 사용할때고 _를 붙인 변수명을 적어주어야한다. 귀찮
Flutter에서는 int 변수를 문자열로 인식한다 class _HelloPageState extends State { String _message = '안녕 world'; // _ 붙이면 private int _counter = 0; @override Widget build(BuildContext context) { return Scaffold( floatingActionButton: FloatingActionButton( child: Icon(Icons.add), onPressed: () => _changeMessage()), appBar: AppBar(title: Text(widget.title),), body: Center(child: Column( children: [ Text(_message ..
import 'package:flutter/material.dart'; void main() { runApp(const MyApp()); } class MyApp extends StatelessWidget { // 상태를 가질 수 없는 위젯 const MyApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp( title: 'Flutter Demo', theme: ThemeData( primarySwatch: Colors.blue, ), home: HelloPage('Helloo World') ); } } // 상태를 변경하는 방법 // StatefulWidget을 만든 다음에 // 상속받은 State 안에다가..