
最近、お仕事でFlutterを使ってアプリ開発しています


UnityよりもFlutterのほうが需要あるしな(汗

もくじ
解説動画もあるよ!

こちらを見ていただけると嬉しいです!

内容自体はあまり進んでないわね

このアプリ制作は前座のつもりだったから1回で終えるはずだったんだけどね

どうしても時間がかかってしまったというわけですね
Githubにプロジェクトをアップロードしてます!
Githubのプロジェクトリンク:https://github.com/Syungetu/text_editor

ソースを見せろ!といった方はGithubにプロジェクトファイルを上げてますのでご確認ください~



動画について補足的解説をします


とはいえ深いところまでは解説は出来ないから勘弁してね


StatelessWidgetとStatefulWidgetの違い

もうちょっと解説させてください

動画内では静的か動的かの違いって説明したわね

ユーザーが操作するとかそういうのも動的って言ったりするしね



本来変化しないような要素が変化するときは「動的」になるといった感じかしらね
動的処理の例
String inputText = “入力なし”;
Widget build(BuildContext context) {
return Scaffold(
body: Column(
children: <Widget>[
// 入力されたテキスト
Text(inputText),
// テキスト入力
onChanged: (String value) {
// 入力されたテキストを反映する
inputText = value;
}
),
// テキスト表示を更新する
TextButton(
onPressed: () {
// 画面を更新する
setState((){});
},
child: Text(“入力確定”),
),
],
),
);
}

とりあえず、上のようなソースコードがあったとするぞ
// テキスト入力
onChanged: (String value) {
// 入力されたテキストを反映する
inputText = value;
}
),

Text(inputText ),


TextButton(
onPressed: () {
// 画面を更新する
setState((){});
},
child: Text(入力確定),
),

ボタンを押したら「setState」を呼ぶようにしてるぞ

とりあえず「Container」で囲っておけ!

// Widget外の余白
margin: EdgeInsets.only(
top: 0,
bottom: 0,
left: 5,
right: 5,
),
// Widget内の余白
padding: EdgeInsets.only(
top: 5,
bottom: 5,
left: 0,
right: 0,
),
child: Text(“位置調整テキスト”),
),

余白や幅や高さを指定しているわね



Imageでの画像表示方法

表示したいときとかよくあるわよね

Image.asset(‘images/UI/hogehoge.png’), // ネットワークから画像を読み込む
Image.network(‘https://hogehoge.com/sample.jpg’),

ただ、ローカルで表示するときにはpubspec.yamlの編集が必要です
pubspec.yamlの編集
assets:
– images/
– images/UserIcon/
– images/UI/
# – images/a_dot_burr.jpeg
# – images/a_dot_ham.jpeg

コンパイル時にココを見てアプリに内包するみたいです
次回はリスト表示や読み込み待ちの処理とかを開設予定です

今回は動画で解説したことが多くて少なくなってしまったわね


“Flutterプログラム解説 簡単なメモアプリを作成してみたよ! その1 UI作成編” への1件の返信