質問編集履歴

3

エラーメッセージ追加

2018/11/06 08:17

投稿

luckyclock
luckyclock

スコア73

test CHANGED
File without changes
test CHANGED
@@ -151,3 +151,23 @@
151
151
  }
152
152
 
153
153
  ```
154
+
155
+
156
+
157
+ 実行した時のエラーです。
158
+
159
+ /flutter (11352): [ERROR:flutter/shell/common/shell.cc(181)] Dart Error: Unhandled exception:
160
+
161
+ E/flutter (11352): No MaterialLocalizations found.
162
+
163
+ E/flutter (11352): TabBarDemo widgets require MaterialLocalizations to be provided by a Localizations widget ancestor.
164
+
165
+ E/flutter (11352): Localizations are used to generate many different messages, labels,and abbreviations which are used by the material library.
166
+
167
+ 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.
168
+
169
+ E/flutter (11352): The specific widget that could not find a MaterialLocalizations ancestor was:
170
+
171
+ E/flutter (11352): TabBarDemo
172
+
173
+ E/flutter (11352): The ancestors of this widget were:

2

日本語文章修正

2018/11/06 08:17

投稿

luckyclock
luckyclock

スコア73

test CHANGED
File without changes
test CHANGED
@@ -2,15 +2,7 @@
2
2
 
3
3
  表示を行いたいです。
4
4
 
5
- showDialogがcontextを使うようでcontextを渡す必要があると思うのですが、
6
-
7
- 呼び出し元のonSelected: _select,
8
-
9
- の部分でエラーが出てしまいます。
10
-
11
- どうすればエラーが消えるのか(どういう記述をすばcontexを渡るのか)
5
+ ポップアップメニュを選択してもまったくダイアログ表示さん。
12
-
13
- わかりません。
14
6
 
15
7
 
16
8
 

1

コードを修正しました

2018/11/06 07:51

投稿

luckyclock
luckyclock

スコア73

test CHANGED
File without changes
test CHANGED
@@ -84,26 +84,6 @@
84
84
 
85
85
 
86
86
 
87
- void _select(Choice choice, BuildContext context) {
88
-
89
- // Causes the app to rebuild with the new _selectedChoice.
90
-
91
- switch (choice.title) {
92
-
93
- case 'プライバシーポリシー':
94
-
95
-      showBasicDialog(context);
96
-
97
- break;
98
-
99
- default:
100
-
101
- break;
102
-
103
- }
104
-
105
- }
106
-
107
87
 
108
88
 
109
89
  @override
@@ -126,7 +106,23 @@
126
106
 
127
107
  PopupMenuButton<Choice>(
128
108
 
129
- onSelected: _select,
109
+ onSelected: (Choice) {
110
+
111
+ switch (Choice.title) {
112
+
113
+ case 'プライバシーポリシー':
114
+
115
+ showBasicDialog(context);
116
+
117
+ break;
118
+
119
+ default:
120
+
121
+ break;
122
+
123
+ }
124
+
125
+ },
130
126
 
131
127
  itemBuilder: (BuildContext context) {
132
128