Last active
March 4, 2021 11:11
-
-
Save NORI-XXXX/1ee577013e9af2d0ef281fb4efb8a326 to your computer and use it in GitHub Desktop.
sinproject提出物です。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void main(){ | |
print ('Hello World'); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void main(){ | |
int i = 1; | |
while(i <= 10){ | |
print ('Hello World'); | |
i++; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void main(){ | |
var sum = 0; | |
for (var i = 1; i < 10; i++){ | |
sum += i; | |
} | |
print(sum); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'dart:math' as math; | |
void main(){ | |
for (var i = 1; i < 10; i++){ | |
var rand = new math.Random(); | |
var i = rand.nextInt(100); | |
switch(i % 2){ | |
case 0: | |
print('$i偶数'); | |
break; | |
case 1: | |
print('$i奇数'); | |
break; | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void main(){ | |
for (var i = 1; i < 101; i++){ | |
if(i % 3 == 0 && i % 5 == 0){ | |
print('FizzBuzz'); | |
}else if (i % 3 == 0){ | |
print('Fizz'); | |
}else if (i % 5 == 0){ | |
print('Buzz'); | |
}else{ | |
print(i); | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
selectFizzBuzz(int $x, int $y){ | |
for (var i = $x; i < $y; i++){ | |
if(i % 3 == 0 && i % 5 == 0){ | |
print('FizzBuzz'); | |
}else if (i % 3 == 0){ | |
print('Fizz'); | |
}else if (i % 5 == 0){ | |
print('Buzz'); | |
}else{ | |
print(i); | |
} | |
} | |
} | |
void main(){ | |
var selectStart = 30; | |
var selectEnd = 55; | |
selectFizzBuzz(selectStart, selectEnd); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void main(){ | |
var list = new List.generate(100, (i)=> i); | |
list.shuffle(); | |
print('$list'); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'dart:math' as math; | |
var rand = new math.Random(); | |
void janken($a, $b, $i) { | |
var choice = ['グー', 'チョキ', 'パー']; | |
var choice_a = choice[$a]; | |
var choice_b = choice[$b]; | |
var match = $i; | |
if ($a == 0 && $b == 1) { | |
print('$match回戦 A:$choice_a B:$choice_b Aの勝ち'); | |
} else if ($a == 1 && $b == 2) { | |
print('$match回戦 A:$choice_a B:$choice_b Aの勝ち'); | |
} else if ($a == 2 && $b == 1) { | |
print('$match回戦 A:$choice_a B:$choice_b Aの勝ち'); | |
} else if ($a == $b) { | |
print('$match回戦 A:$choice_a B:$choice_b 引き分け'); | |
} else if ($b == 0 && $a == 1) { | |
print('$match回戦 A:$choice_a B:$choice_b Bの勝ち'); | |
} else if ($b == 1 && $a == 2) { | |
print('$match回戦 A:$choice_a B:$choice_b Bの勝ち'); | |
} else { | |
print('$match回戦 A:$choice_a B:$choice_b Bの勝ち'); | |
} | |
} | |
void main() { | |
for (var i = 1; i <= 10; i++) { | |
var resultA = rand.nextInt(2); | |
var resultB = rand.nextInt(2); | |
var match = i; | |
janken(resultA, resultB, match); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
|9| Flutterの開発環境構築を行う。 Flutter Setup for Windows | |
~環境構築時つまずいた点~ | |
・開いたままの仮想デバイスがあったため、デバイスをkillしもともとあったAndroidStudioをインストールし直した。 | |
・AndroidStudioを以前利用したことがあるため、SDKマネージャーのAndroidSDKのアップデートができてない箇所があったため、仮想デバイスを構築できなかった。 | |
⇒すべてアップデート。アップデート時にディスクの容量が少なくなったため、ディスクをクリーンアップした。 | |
・OSのUEFIの設定上、AndroidStudioのSDKマネージャーでHAXMインストーラーをインストールできないため、仮想デバイスを構築できなかった。 | |
⇒UEFIの設定で問題があるかどうかをまず判別するため、アプリケーションをインストールし、問題があったため、対処したところ、 | |
HAXMインストーラーをインストールできた。 | |
|10| Flutterチュートリアル「part1」を実施し理解する。 | |
・変数のプライベート化がprivateではなくアンダースコアなのがユニークで面白いと感じました。 | |
・名前付き引数 home: には MaterialAppに表示する内容、ないしアプリケーションに組み込まれるウィジェットを示す。 | |
⇒ ここがbodyになるのかと解釈しました。 | |
~~ウィジェット構造についてまとめ~~~~ | |
StatelessWidget | |
⇓ | |
⇓ | |
MaterialApp >> StatefulWidget | |
~~~~~~~~~~~~~~~~~~~~ | |
・statelessWidgetクラスの基本形<StatelessWidget継承クラス> | |
``` | |
class classname extends StatelessWidget{ | |
@override | |
Widget build(BuildContext context){ | |
return new MaterialApp(); | |
} | |
} | |
``` | |
・statefulWidgetクラスの基本形 | |
``` | |
class widgetclass extends StatefulWidget{ | |
@override | |
stateclass createState() => new stateclass(); | |
} | |
``` | |
・Stateクラスの基本形 | |
``` | |
class stateclass extends State<widgetclass> { | |
@override | |
widget build(BuildContext context){ | |
} | |
} | |
``` | |
【アプリ構造の要約】 | |
①アプリケーションはmain関数として定義。main関数では,runAppでウィジェットのインスタンス(オブジェクト)を実行する。 | |
②runApp関数では、StatelessWidgetもしくはStatefulWidget継承クラスのインスタンス(オブジェクト)を引数に指定する。 | |
(アプリのUI部分) | |
③StatelessWidget継承クラスにはbuildメソッドを用意する。ここでマテリアルデザインのアプリである | |
MaterialAppインスタンス(オブジェクト)を戻り値にする。 | |
④MaterialAppの引数Homeに、実際にアプリ内に常時するウィジェットを設定する。 | |
|11| Flutterチュートリアル「part2」を実施し理解する。 | |
~感想~ | |
ルーティングするウィジェットのひとつであるNavigatorがでてきて実現できることが増えたが理解するのが困難で | |
使いこなすことは難しく感じた。 | |
・戻り値を用意する/しない ⇒ アプリ開発経験が無いため、どのような場合に判別するのか釈然としていない。 | |
・変数修飾子 final/static/const | |
~「復習」~ | |
final:プログラム開始後のある時点で一回だけ初期化され、初期化以降は、代入などを通じて変更されない/できないことが保証される | |
static : クラスのフィールド変数に指定し、その変数がインスタンスごとに保持されるのではなく、クラスで1つの実体を持つことを宣言する | |
const : constな変数の値はプログラムの実行開始に先立って初期化されており、プログラムの実行を通じて不変であることが保証される。 | |
const変数は再代入も不可である。つまり、finalの意味に加え、constな変数が指す先のメモリ領域の内容も変更不可であることを表す。 | |
~~~~~~ | |
|12| Flutterチュートリアル「Building layouts」を実施し理解する。 | |
~感想とポイント要約~ | |
・レイアウトに関することだったが、感覚的にsectionごとに分けたりする点が理解しやすかった。 | |
・「softWrap: true」 とるする事でテキスト単語の境界で折り返す前に列の幅を埋める | |
・ アプリが小さいデバイスで実行されるとき、columnでは機能せず、ListViewがapp bodyのスクロールをサポートしている | |
・ Expandedウィジェットにより縦組みレイアウトでの最大幅に拡張が行われている。 | |
|13| Flutterチュートリアル「Add interactivity」を実施し理解する。 | |
・三項演算子を使用しているのを初めて見てました。(?の左側がtrueなら:の左側を、falseなら右側を返す演算子。) | |
・どこで関数が呼び込まれているのかを理解するのに時間がかかり、 | |
AndroidstudioのウィジェットツリーFlutteroutlineの機能の便利さを実感しました。。 | |
Author
NORI-XXXX
commented
Mar 3, 2021
Flutter tutorial buildinglayoutデモの最終画面
Dartpad ジャンケン処理の表示画面
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment