質問編集履歴
3
エラーメッセージ追加
title
CHANGED
File without changes
|
body
CHANGED
@@ -74,4 +74,14 @@
|
|
74
74
|
);
|
75
75
|
}
|
76
76
|
}
|
77
|
-
```
|
77
|
+
```
|
78
|
+
|
79
|
+
実行した時のエラーです。
|
80
|
+
/flutter (11352): [ERROR:flutter/shell/common/shell.cc(181)] Dart Error: Unhandled exception:
|
81
|
+
E/flutter (11352): No MaterialLocalizations found.
|
82
|
+
E/flutter (11352): TabBarDemo widgets require MaterialLocalizations to be provided by a Localizations widget ancestor.
|
83
|
+
E/flutter (11352): Localizations are used to generate many different messages, labels,and abbreviations which are used by the material library.
|
84
|
+
E/flutter (11352): To introduce a MaterialLocalizations, either use a MaterialApp at the root of your application to include them automatically, or add a Localization widget with a MaterialLocalizations delegate.
|
85
|
+
E/flutter (11352): The specific widget that could not find a MaterialLocalizations ancestor was:
|
86
|
+
E/flutter (11352): TabBarDemo
|
87
|
+
E/flutter (11352): The ancestors of this widget were:
|
2
日本語文章修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -1,10 +1,6 @@
|
|
1
1
|
タイトル通りポップアップメニューの項目を選択した時にダイアログ
|
2
2
|
表示を行いたいです。
|
3
|
-
showDialogがcontextを使うようでcontextを渡す必要があると思うのですが、
|
4
|
-
呼び出し元のonSelected: _select,
|
5
|
-
の部分でエラーが出てしまいます。
|
6
|
-
|
3
|
+
ポップアップメニューを選択してもまったくダイアログが表示されません。
|
7
|
-
わかりません。
|
8
4
|
|
9
5
|
```Dart
|
10
6
|
class Choice {
|
1
コードを修正しました
title
CHANGED
File without changes
|
body
CHANGED
@@ -41,16 +41,6 @@
|
|
41
41
|
});
|
42
42
|
}
|
43
43
|
|
44
|
-
void _select(Choice choice, BuildContext context) {
|
45
|
-
// Causes the app to rebuild with the new _selectedChoice.
|
46
|
-
switch (choice.title) {
|
47
|
-
case 'プライバシーポリシー':
|
48
|
-
showBasicDialog(context);
|
49
|
-
break;
|
50
|
-
default:
|
51
|
-
break;
|
52
|
-
}
|
53
|
-
}
|
54
44
|
|
55
45
|
@override
|
56
46
|
Widget build(BuildContext context) {
|
@@ -62,7 +52,15 @@
|
|
62
52
|
actions: <Widget>[
|
63
53
|
// overflow menu
|
64
54
|
PopupMenuButton<Choice>(
|
65
|
-
onSelected:
|
55
|
+
onSelected: (Choice) {
|
56
|
+
switch (Choice.title) {
|
57
|
+
case 'プライバシーポリシー':
|
58
|
+
showBasicDialog(context);
|
59
|
+
break;
|
60
|
+
default:
|
61
|
+
break;
|
62
|
+
}
|
63
|
+
},
|
66
64
|
itemBuilder: (BuildContext context) {
|
67
65
|
return choices.map((Choice choice) {
|
68
66
|
return PopupMenuItem<Choice>(
|