質問編集履歴

8

追記コードの部分修正

2021/07/07 20:41

投稿

yuta0113
yuta0113

スコア1

test CHANGED
File without changes
test CHANGED
@@ -522,7 +522,7 @@
522
522
 
523
523
  padding: EdgeInsets.only(left: 15, top: 10, bottom: 10),
524
524
 
525
- child: Text('${doc['Itme1']}',
525
+ child: Text('${doc['Item1']}',
526
526
 
527
527
  style: TextStyle(
528
528
 

7

原因探索の進展

2021/07/07 20:41

投稿

yuta0113
yuta0113

スコア1

test CHANGED
File without changes
test CHANGED
@@ -280,6 +280,302 @@
280
280
 
281
281
  ### 試したこと
282
282
 
283
+ 7/8追記
284
+
285
+ テスト環境AとBを作成し、Navigatorで遷移と同時に値をA→Bへ移すと同様にinitializeAppエラーが発生しました。NavigatorによるA→Bの値の移行により、BのinitializeAppへ影響しているようです。
286
+
287
+
288
+
289
+ デモAページ
290
+
291
+ ```dart
292
+
293
+ //デモA
294
+
295
+
296
+
297
+ import 'package:flutter/material.dart';
298
+
299
+ import 'package:プロジェクト名/demo.dart';
300
+
301
+
302
+
303
+ void main() {
304
+
305
+ runApp(MyApp());
306
+
307
+ }
308
+
309
+
310
+
311
+ class MyApp extends StatelessWidget {
312
+
313
+ @override
314
+
315
+ Widget build(BuildContext context) {
316
+
317
+ return MaterialApp(
318
+
319
+ home: DemoA(
320
+
321
+ ),
322
+
323
+ );
324
+
325
+ }
326
+
327
+ }
328
+
329
+
330
+
331
+ class DemoA extends StatefulWidget{
332
+
333
+ @override
334
+
335
+ _DemoA createState() => _DemoA();
336
+
337
+ }
338
+
339
+
340
+
341
+ class _DemoA extends State<DemoA>{
342
+
343
+
344
+
345
+ final name = 'これをBに届ける';
346
+
347
+
348
+
349
+ @override
350
+
351
+ Widget build(BuildContext context) {
352
+
353
+ return Scaffold(
354
+
355
+ appBar: AppBar(
356
+
357
+ title: Text('Aページ'),
358
+
359
+ ),
360
+
361
+ body: Center(
362
+
363
+ child:Column(
364
+
365
+ children: [
366
+
367
+ Text(name),
368
+
369
+ ElevatedButton(
370
+
371
+ child: Text('ボタン'),
372
+
373
+ onPressed: (){
374
+
375
+ Navigator.push(
376
+
377
+ context, MaterialPageRoute(builder: (context) => SecoundPage(
378
+
379
+ namedata: name,
380
+
381
+ )));
382
+
383
+ },
384
+
385
+ ),
386
+
387
+ ],
388
+
389
+ ),
390
+
391
+ ),
392
+
393
+ );
394
+
395
+ }
396
+
397
+ }
398
+
399
+
400
+
401
+ ```
402
+
403
+
404
+
405
+ デモBページ(demo.dart)
406
+
407
+ ```dart
408
+
409
+ import 'package:flutter/material.dart';
410
+
411
+ import 'package:cloud_firestore/cloud_firestore.dart';
412
+
413
+ import 'package:firebase_core/firebase_core.dart';
414
+
415
+
416
+
417
+ Future<void> main() async {
418
+
419
+ WidgetsFlutterBinding.ensureInitialized();
420
+
421
+ await Firebase.initializeApp();
422
+
423
+ runApp(MyApp());
424
+
425
+ }
426
+
427
+
428
+
429
+ class MyApp extends StatelessWidget {
430
+
431
+ @override
432
+
433
+ Widget build(BuildContext context) {
434
+
435
+ return MaterialApp(
436
+
437
+ debugShowCheckedModeBanner: false,
438
+
439
+ home: SecoundPage(),
440
+
441
+ );
442
+
443
+ }
444
+
445
+ }
446
+
447
+
448
+
449
+ class SecoundPage extends StatefulWidget {
450
+
451
+
452
+
453
+ SecoundPage({this.namedata});
454
+
455
+ final String namedata;
456
+
457
+
458
+
459
+ @override
460
+
461
+ _SecoundPage createState() => _SecoundPage();
462
+
463
+ }
464
+
465
+
466
+
467
+ class _SecoundPage extends State<SecoundPage> {
468
+
469
+
470
+
471
+
472
+
473
+ String namedata;
474
+
475
+ final firedb = FirebaseFirestore.instance;
476
+
477
+
478
+
479
+ @override
480
+
481
+ Widget build(BuildContext context) {
482
+
483
+ return Scaffold(
484
+
485
+ appBar: AppBar(
486
+
487
+ title: Text('Bページ'),
488
+
489
+ ),
490
+
491
+ body: StreamBuilder<QuerySnapshot>(
492
+
493
+ stream: firedb.collection('List').snapshots(),
494
+
495
+ builder: (context, snapshot) {
496
+
497
+ if (!snapshot.hasData) {
498
+
499
+ return Center(
500
+
501
+ child: CircularProgressIndicator(),
502
+
503
+ );
504
+
505
+ } else
506
+
507
+ return ListView(
508
+
509
+ children: snapshot.data.docs.map((doc) {
510
+
511
+ return Card(
512
+
513
+ child: Column(
514
+
515
+ children: <Widget>[
516
+
517
+ Text(namedata),//ここにAの値をいれる
518
+
519
+ Container(
520
+
521
+ width: double.infinity,
522
+
523
+ padding: EdgeInsets.only(left: 15, top: 10, bottom: 10),
524
+
525
+ child: Text('${doc['Itme1']}',
526
+
527
+ style: TextStyle(
528
+
529
+ fontWeight: FontWeight.bold,
530
+
531
+ fontSize: 18,
532
+
533
+ ),
534
+
535
+ textAlign: TextAlign.left,
536
+
537
+ ),
538
+
539
+ ),
540
+
541
+
542
+
543
+ Container(
544
+
545
+ width: double.infinity,
546
+
547
+ padding: EdgeInsets.all(10),
548
+
549
+ child: Text('${doc['Item2']}',
550
+
551
+ textAlign: TextAlign.left,
552
+
553
+ ),
554
+
555
+ ),
556
+
557
+ ],
558
+
559
+ ),
560
+
561
+ );
562
+
563
+ }).toList(),
564
+
565
+ );
566
+
567
+ },
568
+
569
+ ),
570
+
571
+ );
572
+
573
+ }
574
+
575
+ }
576
+
577
+ ```
578
+
283
579
 
284
580
 
285
581
  7/7 追記
@@ -288,169 +584,7 @@
288
584
 
289
585
  親ページから値受け取るために、質問に記載したコードにした際にエラーが返されます。
290
586
 
291
- 以下、テスト環境
587
+ 以下、テスト環境(文字数制限のため削除)
292
-
293
-
294
-
295
- ```dart
296
-
297
- import 'package:flutter/material.dart';
298
-
299
- import 'package:cloud_firestore/cloud_firestore.dart';
300
-
301
- import 'package:firebase_core/firebase_core.dart';
302
-
303
-
304
-
305
- Future<void> main() async {
306
-
307
- WidgetsFlutterBinding.ensureInitialized();
308
-
309
- await Firebase.initializeApp();
310
-
311
- runApp(MyApp());
312
-
313
- }
314
-
315
-
316
-
317
- class MyApp extends StatelessWidget {
318
-
319
- @override
320
-
321
- Widget build(BuildContext context) {
322
-
323
- return MaterialApp(
324
-
325
- debugShowCheckedModeBanner: false,
326
-
327
- home: SecoundPage(),
328
-
329
- );
330
-
331
- }
332
-
333
- }
334
-
335
-
336
-
337
- class SecoundPage extends StatefulWidget {
338
-
339
- @override
340
-
341
- _SecoundPage createState() => _SecoundPage();
342
-
343
- }
344
-
345
-
346
-
347
- class _SecoundPage extends State<SecoundPage> {
348
-
349
-
350
-
351
- final firedb = FirebaseFirestore.instance;
352
-
353
-
354
-
355
- @override
356
-
357
- Widget build(BuildContext context) {
358
-
359
- return Scaffold(
360
-
361
- appBar: AppBar(
362
-
363
- title: Text('SecoundPage'),
364
-
365
- ),
366
-
367
- body: StreamBuilder<QuerySnapshot>(
368
-
369
- stream: firedb.collection('List').snapshots(),
370
-
371
- builder: (context, snapshot) {
372
-
373
- if (!snapshot.hasData) {
374
-
375
- return Center(
376
-
377
- child: CircularProgressIndicator(),
378
-
379
- );
380
-
381
- } else
382
-
383
- return ListView(
384
-
385
- children: snapshot.data.docs.map((doc) {
386
-
387
- return Card(
388
-
389
- child: Column(
390
-
391
- children: <Widget>[
392
-
393
- Container(
394
-
395
- width: double.infinity,
396
-
397
- padding: EdgeInsets.only(left: 15, top: 10, bottom: 10),
398
-
399
- child: Text('${doc['Item1']}',
400
-
401
- style: TextStyle(
402
-
403
- fontWeight: FontWeight.bold,
404
-
405
- fontSize: 18,
406
-
407
- ),
408
-
409
- textAlign: TextAlign.left,
410
-
411
- ),
412
-
413
- ),
414
-
415
-
416
-
417
- Container(
418
-
419
- width: double.infinity,
420
-
421
- padding: EdgeInsets.all(10),
422
-
423
- child: Text('${doc['Item2']}',
424
-
425
- textAlign: TextAlign.left,
426
-
427
- ),
428
-
429
- ),
430
-
431
- ],
432
-
433
- ),
434
-
435
- );
436
-
437
- }).toList(),
438
-
439
- );
440
-
441
- },
442
-
443
- ),
444
-
445
- );
446
-
447
- }
448
-
449
- }
450
-
451
- ```
452
-
453
-
454
588
 
455
589
 
456
590
 

6

記載に誤りがありました。

2021/07/07 20:39

投稿

yuta0113
yuta0113

スコア1

test CHANGED
File without changes
test CHANGED
@@ -292,7 +292,7 @@
292
292
 
293
293
 
294
294
 
295
- ```test.dart
295
+ ```dart
296
296
 
297
297
  import 'package:flutter/material.dart';
298
298
 
@@ -322,7 +322,7 @@
322
322
 
323
323
  return MaterialApp(
324
324
 
325
- debugShowCheckedModeBanner: false,
325
+ debugShowCheckedModeBanner: false,
326
326
 
327
327
  home: SecoundPage(),
328
328
 
@@ -364,171 +364,81 @@
364
364
 
365
365
  ),
366
366
 
367
- body: SingleChildScrollView(
367
+ body: StreamBuilder<QuerySnapshot>(
368
+
368
-
369
+ stream: firedb.collection('List').snapshots(),
370
+
371
+ builder: (context, snapshot) {
372
+
373
+ if (!snapshot.hasData) {
374
+
375
+ return Center(
376
+
377
+ child: CircularProgressIndicator(),
378
+
379
+ );
380
+
381
+ } else
382
+
383
+ return ListView(
384
+
385
+ children: snapshot.data.docs.map((doc) {
386
+
387
+ return Card(
388
+
369
- child: Column(
389
+ child: Column(
370
-
390
+
371
- children: [
391
+ children: <Widget>[
372
-
392
+
373
- Container(
393
+ Container(
394
+
374
-
395
+ width: double.infinity,
396
+
375
- padding: EdgeInsets.only(top:30,bottom:15),
397
+ padding: EdgeInsets.only(left: 15, top: 10, bottom: 10),
398
+
376
-
399
+ child: Text('${doc['Item1']}',
400
+
377
- child:Column(
401
+ style: TextStyle(
378
-
379
- children: [
402
+
380
-
381
- Text('date',style: TextStyle(fontWeight: FontWeight.bold)
403
+ fontWeight: FontWeight.bold,
404
+
405
+ fontSize: 18,
406
+
407
+ ),
408
+
409
+ textAlign: TextAlign.left,
410
+
411
+ ),
412
+
413
+ ),
414
+
415
+
416
+
417
+ Container(
418
+
419
+ width: double.infinity,
420
+
421
+ padding: EdgeInsets.all(10),
422
+
423
+ child: Text('${doc['Item2']}',
424
+
425
+ textAlign: TextAlign.left,
426
+
427
+ ),
428
+
429
+ ),
430
+
431
+ ],
382
432
 
383
433
  ),
384
434
 
385
- Container(
386
-
387
- child: Column(
388
-
389
- children: [
390
-
391
- Row(
392
-
393
- mainAxisAlignment: MainAxisAlignment.center,
394
-
395
- children: [
396
-
397
- Text('paramText1が入るところ'),
398
-
399
- Padding(
400
-
401
- padding: EdgeInsets.all(10),
402
-
403
- ),
435
+ );
404
-
436
+
405
- Text('candidateTime1が入るところ'),
437
+ }).toList(),
406
-
407
- ],
438
+
408
-
409
- ),
439
+ );
410
-
411
- ],
440
+
412
-
413
- ),
414
-
415
- ),
416
-
417
- Text('pref',style: TextStyle(fontWeight: FontWeight.bold)),
418
-
419
- Text('Saga'),
420
-
421
- ElevatedButton(
422
-
423
- style: ElevatedButton.styleFrom(
424
-
425
- primary: Colors.grey,
426
-
427
- ),
428
-
429
- child: Text('Select Pref'),
430
-
431
- onPressed: () {
432
-
433
- Navigator.pop(context);
434
-
435
- },
441
+ },
436
-
437
- ),
438
-
439
- ],
440
-
441
- ),
442
-
443
- ),
444
-
445
- Container(
446
-
447
- padding: EdgeInsets.all(20),
448
-
449
- child: Text('Tittle Text',style: TextStyle(fontWeight: FontWeight.bold)),
450
-
451
- ),
452
-
453
- StreamBuilder<QuerySnapshot>(
454
-
455
- stream: firedb.collection('List').snapshots(),
456
-
457
- builder: (context, snapshot) {
458
-
459
- if (!snapshot.hasData) {
460
-
461
- return Center(
462
-
463
- child: CircularProgressIndicator(),
464
-
465
- );
466
-
467
- } else
468
-
469
- return ListView(
470
-
471
- children: snapshot.data.docs.map((doc) {
472
-
473
- return Card(
474
-
475
- child: Column(
476
-
477
- children: <Widget>[
478
-
479
- Container(
480
-
481
- width: double.infinity,
482
-
483
- padding: EdgeInsets.only(left: 15, top: 10, bottom: 10),
484
-
485
- child: Text('${doc['Item1']}',
486
-
487
- style: TextStyle(
488
-
489
- fontWeight: FontWeight.bold,
490
-
491
- fontSize: 18,
492
-
493
- ),
494
-
495
- textAlign: TextAlign.left,
496
-
497
- ),
498
-
499
- ),
500
-
501
- Container(
502
-
503
- width: double.infinity,
504
-
505
- padding: EdgeInsets.all(10),
506
-
507
- child: Text('${doc['Item2']}',
508
-
509
- textAlign: TextAlign.left,
510
-
511
- ),
512
-
513
- ),
514
-
515
- ],
516
-
517
- ),
518
-
519
- );
520
-
521
- }).toList(),
522
-
523
- );
524
-
525
- },
526
-
527
- ),
528
-
529
- ],
530
-
531
- ),
532
442
 
533
443
  ),
534
444
 

5

追記コードの部分修正

2021/07/07 16:48

投稿

yuta0113
yuta0113

スコア1

test CHANGED
File without changes
test CHANGED
@@ -344,7 +344,7 @@
344
344
 
345
345
 
346
346
 
347
- class _SecoundPage extends State<SagaHouseListDemo> {
347
+ class _SecoundPage extends State<SecoundPage> {
348
348
 
349
349
 
350
350
 
@@ -394,7 +394,7 @@
394
394
 
395
395
  children: [
396
396
 
397
- Text(paramText1),
397
+ Text('paramText1が入るところ'),
398
398
 
399
399
  Padding(
400
400
 
@@ -402,7 +402,7 @@
402
402
 
403
403
  ),
404
404
 
405
- Text(candidateTime1),
405
+ Text('candidateTime1が入るところ'),
406
406
 
407
407
  ],
408
408
 

4

追記コードの部分修正

2021/07/07 16:32

投稿

yuta0113
yuta0113

スコア1

test CHANGED
File without changes
test CHANGED
@@ -128,6 +128,272 @@
128
128
 
129
129
  children: [
130
130
 
131
+ Text('paramText1が入るところ'),
132
+
133
+ Padding(
134
+
135
+ padding: EdgeInsets.all(10),
136
+
137
+ ),
138
+
139
+ Text('candidateTime1が入るところ'),
140
+
141
+ ],
142
+
143
+ ),
144
+
145
+ ],
146
+
147
+ ),
148
+
149
+ ),
150
+
151
+ Text('pref',style: TextStyle(fontWeight: FontWeight.bold)),
152
+
153
+ Text('Saga'),
154
+
155
+ ElevatedButton(
156
+
157
+ style: ElevatedButton.styleFrom(
158
+
159
+ primary: Colors.grey,
160
+
161
+ ),
162
+
163
+ child: Text('Select Pref'),
164
+
165
+ onPressed: () {
166
+
167
+ Navigator.pop(context);
168
+
169
+ },
170
+
171
+ ),
172
+
173
+ ],
174
+
175
+ ),
176
+
177
+ ),
178
+
179
+ Container(
180
+
181
+ padding: EdgeInsets.all(20),
182
+
183
+ child: Text('Tittle Text',style: TextStyle(fontWeight: FontWeight.bold)),
184
+
185
+ ),
186
+
187
+ StreamBuilder<QuerySnapshot>(
188
+
189
+ stream: firedb.collection('List').snapshots(),
190
+
191
+ builder: (context, snapshot) {
192
+
193
+ if (!snapshot.hasData) {
194
+
195
+ return Center(
196
+
197
+ child: CircularProgressIndicator(),
198
+
199
+ );
200
+
201
+ } else
202
+
203
+ return ListView(
204
+
205
+ children: snapshot.data.docs.map((doc) {
206
+
207
+ return Card(
208
+
209
+ child: Column(
210
+
211
+ children: <Widget>[
212
+
213
+ Container(
214
+
215
+ width: double.infinity,
216
+
217
+ padding: EdgeInsets.only(left: 15, top: 10, bottom: 10),
218
+
219
+ child: Text('${doc['Item1']}',
220
+
221
+ style: TextStyle(
222
+
223
+ fontWeight: FontWeight.bold,
224
+
225
+ fontSize: 18,
226
+
227
+ ),
228
+
229
+ textAlign: TextAlign.left,
230
+
231
+ ),
232
+
233
+ ),
234
+
235
+ Container(
236
+
237
+ width: double.infinity,
238
+
239
+ padding: EdgeInsets.all(10),
240
+
241
+ child: Text('${doc['Item2']}',
242
+
243
+ textAlign: TextAlign.left,
244
+
245
+ ),
246
+
247
+ ),
248
+
249
+ ],
250
+
251
+ ),
252
+
253
+ );
254
+
255
+ }).toList(),
256
+
257
+ );
258
+
259
+ },
260
+
261
+ ),
262
+
263
+ ],
264
+
265
+ ),
266
+
267
+ ),
268
+
269
+ );
270
+
271
+ }
272
+
273
+ }
274
+
275
+
276
+
277
+ ```
278
+
279
+
280
+
281
+ ### 試したこと
282
+
283
+
284
+
285
+ 7/7 追記
286
+
287
+ テスト環境(別のdartファイルを立てた)では問題なく動きます。
288
+
289
+ 親ページから値受け取るために、質問に記載したコードにした際にエラーが返されます。
290
+
291
+ 以下、テスト環境
292
+
293
+
294
+
295
+ ```test.dart
296
+
297
+ import 'package:flutter/material.dart';
298
+
299
+ import 'package:cloud_firestore/cloud_firestore.dart';
300
+
301
+ import 'package:firebase_core/firebase_core.dart';
302
+
303
+
304
+
305
+ Future<void> main() async {
306
+
307
+ WidgetsFlutterBinding.ensureInitialized();
308
+
309
+ await Firebase.initializeApp();
310
+
311
+ runApp(MyApp());
312
+
313
+ }
314
+
315
+
316
+
317
+ class MyApp extends StatelessWidget {
318
+
319
+ @override
320
+
321
+ Widget build(BuildContext context) {
322
+
323
+ return MaterialApp(
324
+
325
+ debugShowCheckedModeBanner: false,
326
+
327
+ home: SecoundPage(),
328
+
329
+ );
330
+
331
+ }
332
+
333
+ }
334
+
335
+
336
+
337
+ class SecoundPage extends StatefulWidget {
338
+
339
+ @override
340
+
341
+ _SecoundPage createState() => _SecoundPage();
342
+
343
+ }
344
+
345
+
346
+
347
+ class _SecoundPage extends State<SagaHouseListDemo> {
348
+
349
+
350
+
351
+ final firedb = FirebaseFirestore.instance;
352
+
353
+
354
+
355
+ @override
356
+
357
+ Widget build(BuildContext context) {
358
+
359
+ return Scaffold(
360
+
361
+ appBar: AppBar(
362
+
363
+ title: Text('SecoundPage'),
364
+
365
+ ),
366
+
367
+ body: SingleChildScrollView(
368
+
369
+ child: Column(
370
+
371
+ children: [
372
+
373
+ Container(
374
+
375
+ padding: EdgeInsets.only(top:30,bottom:15),
376
+
377
+ child:Column(
378
+
379
+ children: [
380
+
381
+ Text('date',style: TextStyle(fontWeight: FontWeight.bold)
382
+
383
+ ),
384
+
385
+ Container(
386
+
387
+ child: Column(
388
+
389
+ children: [
390
+
391
+ Row(
392
+
393
+ mainAxisAlignment: MainAxisAlignment.center,
394
+
395
+ children: [
396
+
131
397
  Text(paramText1),
132
398
 
133
399
  Padding(
@@ -272,276 +538,10 @@
272
538
 
273
539
  }
274
540
 
275
-
276
-
277
541
  ```
278
542
 
279
543
 
280
544
 
281
- ### 試したこと
282
-
283
-
284
-
285
- 7/7 追記
286
-
287
- テスト環境(別のdartファイルを立てた)では問題なく動きます。
288
-
289
- 親ページから値受け取るために、質問に記載したコードにした際にエラーが返されます。
290
-
291
- 以下、テスト環境
292
-
293
-
294
-
295
- ```test.dart
296
-
297
- import 'package:flutter/material.dart';
298
-
299
- import 'package:cloud_firestore/cloud_firestore.dart';
300
-
301
- import 'package:firebase_core/firebase_core.dart';
302
-
303
-
304
-
305
- Future<void> main() async {
306
-
307
- WidgetsFlutterBinding.ensureInitialized();
308
-
309
- await Firebase.initializeApp();
310
-
311
- runApp(MyApp());
312
-
313
- }
314
-
315
-
316
-
317
- class MyApp extends StatelessWidget {
318
-
319
- @override
320
-
321
- Widget build(BuildContext context) {
322
-
323
- return MaterialApp(
324
-
325
- debugShowCheckedModeBanner: false,
326
-
327
- home: SecoundPage(),
328
-
329
- );
330
-
331
- }
332
-
333
- }
334
-
335
-
336
-
337
- class SecoundPage extends StatefulWidget {
338
-
339
- @override
340
-
341
- _SecoundPage createState() => _SecoundPage();
342
-
343
- }
344
-
345
-
346
-
347
- class _SecoundPage extends State<SagaHouseListDemo> {
348
-
349
-
350
-
351
- final firedb = FirebaseFirestore.instance;
352
-
353
-
354
-
355
- @override
356
-
357
- Widget build(BuildContext context) {
358
-
359
- return Scaffold(
360
-
361
- appBar: AppBar(
362
-
363
- title: Text('SecoundPage'),
364
-
365
- ),
366
-
367
- body: SingleChildScrollView(
368
-
369
- child: Column(
370
-
371
- children: [
372
-
373
- Container(
374
-
375
- padding: EdgeInsets.only(top:30,bottom:15),
376
-
377
- child:Column(
378
-
379
- children: [
380
-
381
- Text('date',style: TextStyle(fontWeight: FontWeight.bold)
382
-
383
- ),
384
-
385
- Container(
386
-
387
- child: Column(
388
-
389
- children: [
390
-
391
- Row(
392
-
393
- mainAxisAlignment: MainAxisAlignment.center,
394
-
395
- children: [
396
-
397
- Text(paramText1),
398
-
399
- Padding(
400
-
401
- padding: EdgeInsets.all(10),
402
-
403
- ),
404
-
405
- Text(candidateTime1),
406
-
407
- ],
408
-
409
- ),
410
-
411
- ],
412
-
413
- ),
414
-
415
- ),
416
-
417
- Text('pref',style: TextStyle(fontWeight: FontWeight.bold)),
418
-
419
- Text('Saga'),
420
-
421
- ElevatedButton(
422
-
423
- style: ElevatedButton.styleFrom(
424
-
425
- primary: Colors.grey,
426
-
427
- ),
428
-
429
- child: Text('Select Pref'),
430
-
431
- onPressed: () {
432
-
433
- Navigator.pop(context);
434
-
435
- },
436
-
437
- ),
438
-
439
- ],
440
-
441
- ),
442
-
443
- ),
444
-
445
- Container(
446
-
447
- padding: EdgeInsets.all(20),
448
-
449
- child: Text('Tittle Text',style: TextStyle(fontWeight: FontWeight.bold)),
450
-
451
- ),
452
-
453
- StreamBuilder<QuerySnapshot>(
454
-
455
- stream: firedb.collection('List').snapshots(),
456
-
457
- builder: (context, snapshot) {
458
-
459
- if (!snapshot.hasData) {
460
-
461
- return Center(
462
-
463
- child: CircularProgressIndicator(),
464
-
465
- );
466
-
467
- } else
468
-
469
- return ListView(
470
-
471
- children: snapshot.data.docs.map((doc) {
472
-
473
- return Card(
474
-
475
- child: Column(
476
-
477
- children: <Widget>[
478
-
479
- Container(
480
-
481
- width: double.infinity,
482
-
483
- padding: EdgeInsets.only(left: 15, top: 10, bottom: 10),
484
-
485
- child: Text('${doc['Item1']}',
486
-
487
- style: TextStyle(
488
-
489
- fontWeight: FontWeight.bold,
490
-
491
- fontSize: 18,
492
-
493
- ),
494
-
495
- textAlign: TextAlign.left,
496
-
497
- ),
498
-
499
- ),
500
-
501
- Container(
502
-
503
- width: double.infinity,
504
-
505
- padding: EdgeInsets.all(10),
506
-
507
- child: Text('${doc['Item2']}',
508
-
509
- textAlign: TextAlign.left,
510
-
511
- ),
512
-
513
- ),
514
-
515
- ],
516
-
517
- ),
518
-
519
- );
520
-
521
- }).toList(),
522
-
523
- );
524
-
525
- },
526
-
527
- ),
528
-
529
- ],
530
-
531
- ),
532
-
533
- ),
534
-
535
- );
536
-
537
- }
538
-
539
- }
540
-
541
- ```
542
-
543
-
544
-
545
545
 
546
546
 
547
547
  *******************

3

追記コードの追加

2021/07/07 12:19

投稿

yuta0113
yuta0113

スコア1

test CHANGED
File without changes
test CHANGED
@@ -346,7 +346,197 @@
346
346
 
347
347
  class _SecoundPage extends State<SagaHouseListDemo> {
348
348
 
349
+
350
+
351
+ final firedb = FirebaseFirestore.instance;
352
+
353
+
354
+
355
+ @override
356
+
357
+ Widget build(BuildContext context) {
358
+
359
+ return Scaffold(
360
+
361
+ appBar: AppBar(
362
+
363
+ title: Text('SecoundPage'),
364
+
365
+ ),
366
+
367
+ body: SingleChildScrollView(
368
+
369
+ child: Column(
370
+
371
+ children: [
372
+
373
+ Container(
374
+
375
+ padding: EdgeInsets.only(top:30,bottom:15),
376
+
377
+ child:Column(
378
+
379
+ children: [
380
+
381
+ Text('date',style: TextStyle(fontWeight: FontWeight.bold)
382
+
383
+ ),
384
+
385
+ Container(
386
+
387
+ child: Column(
388
+
389
+ children: [
390
+
349
- ・・・
391
+ Row(
392
+
393
+ mainAxisAlignment: MainAxisAlignment.center,
394
+
395
+ children: [
396
+
397
+ Text(paramText1),
398
+
399
+ Padding(
400
+
401
+ padding: EdgeInsets.all(10),
402
+
403
+ ),
404
+
405
+ Text(candidateTime1),
406
+
407
+ ],
408
+
409
+ ),
410
+
411
+ ],
412
+
413
+ ),
414
+
415
+ ),
416
+
417
+ Text('pref',style: TextStyle(fontWeight: FontWeight.bold)),
418
+
419
+ Text('Saga'),
420
+
421
+ ElevatedButton(
422
+
423
+ style: ElevatedButton.styleFrom(
424
+
425
+ primary: Colors.grey,
426
+
427
+ ),
428
+
429
+ child: Text('Select Pref'),
430
+
431
+ onPressed: () {
432
+
433
+ Navigator.pop(context);
434
+
435
+ },
436
+
437
+ ),
438
+
439
+ ],
440
+
441
+ ),
442
+
443
+ ),
444
+
445
+ Container(
446
+
447
+ padding: EdgeInsets.all(20),
448
+
449
+ child: Text('Tittle Text',style: TextStyle(fontWeight: FontWeight.bold)),
450
+
451
+ ),
452
+
453
+ StreamBuilder<QuerySnapshot>(
454
+
455
+ stream: firedb.collection('List').snapshots(),
456
+
457
+ builder: (context, snapshot) {
458
+
459
+ if (!snapshot.hasData) {
460
+
461
+ return Center(
462
+
463
+ child: CircularProgressIndicator(),
464
+
465
+ );
466
+
467
+ } else
468
+
469
+ return ListView(
470
+
471
+ children: snapshot.data.docs.map((doc) {
472
+
473
+ return Card(
474
+
475
+ child: Column(
476
+
477
+ children: <Widget>[
478
+
479
+ Container(
480
+
481
+ width: double.infinity,
482
+
483
+ padding: EdgeInsets.only(left: 15, top: 10, bottom: 10),
484
+
485
+ child: Text('${doc['Item1']}',
486
+
487
+ style: TextStyle(
488
+
489
+ fontWeight: FontWeight.bold,
490
+
491
+ fontSize: 18,
492
+
493
+ ),
494
+
495
+ textAlign: TextAlign.left,
496
+
497
+ ),
498
+
499
+ ),
500
+
501
+ Container(
502
+
503
+ width: double.infinity,
504
+
505
+ padding: EdgeInsets.all(10),
506
+
507
+ child: Text('${doc['Item2']}',
508
+
509
+ textAlign: TextAlign.left,
510
+
511
+ ),
512
+
513
+ ),
514
+
515
+ ],
516
+
517
+ ),
518
+
519
+ );
520
+
521
+ }).toList(),
522
+
523
+ );
524
+
525
+ },
526
+
527
+ ),
528
+
529
+ ],
530
+
531
+ ),
532
+
533
+ ),
534
+
535
+ );
536
+
537
+ }
538
+
539
+ }
350
540
 
351
541
  ```
352
542
 

2

追記コードの部分修正

2021/07/07 12:14

投稿

yuta0113
yuta0113

スコア1

test CHANGED
File without changes
test CHANGED
@@ -296,8 +296,6 @@
296
296
 
297
297
  import 'package:flutter/material.dart';
298
298
 
299
- import 'package:carousel_slider/carousel_slider.dart';
300
-
301
299
  import 'package:cloud_firestore/cloud_firestore.dart';
302
300
 
303
301
  import 'package:firebase_core/firebase_core.dart';

1

類似環境での正常動作は確認しています。その詳細を追記します。

2021/07/07 11:48

投稿

yuta0113
yuta0113

スコア1

test CHANGED
File without changes
test CHANGED
@@ -38,8 +38,6 @@
38
38
 
39
39
  import 'package:flutter/material.dart';
40
40
 
41
- import 'package:first.dart';
42
-
43
41
  import 'package:cloud_firestore/cloud_firestore.dart';
44
42
 
45
43
  import 'package:firebase_core/firebase_core.dart';
@@ -284,12 +282,90 @@
284
282
 
285
283
 
286
284
 
285
+ 7/7 追記
286
+
287
+ テスト環境(別のdartファイルを立てた)では問題なく動きます。
288
+
289
+ 親ページから値受け取るために、質問に記載したコードにした際にエラーが返されます。
290
+
291
+ 以下、テスト環境
292
+
293
+
294
+
295
+ ```test.dart
296
+
297
+ import 'package:flutter/material.dart';
298
+
299
+ import 'package:carousel_slider/carousel_slider.dart';
300
+
301
+ import 'package:cloud_firestore/cloud_firestore.dart';
302
+
303
+ import 'package:firebase_core/firebase_core.dart';
304
+
305
+
306
+
307
+ Future<void> main() async {
308
+
309
+ WidgetsFlutterBinding.ensureInitialized();
310
+
311
+ await Firebase.initializeApp();
312
+
313
+ runApp(MyApp());
314
+
315
+ }
316
+
317
+
318
+
319
+ class MyApp extends StatelessWidget {
320
+
321
+ @override
322
+
323
+ Widget build(BuildContext context) {
324
+
325
+ return MaterialApp(
326
+
327
+ debugShowCheckedModeBanner: false,
328
+
329
+ home: SecoundPage(),
330
+
331
+ );
332
+
333
+ }
334
+
335
+ }
336
+
337
+
338
+
339
+ class SecoundPage extends StatefulWidget {
340
+
341
+ @override
342
+
343
+ _SecoundPage createState() => _SecoundPage();
344
+
345
+ }
346
+
347
+
348
+
349
+ class _SecoundPage extends State<SagaHouseListDemo> {
350
+
351
+ ・・・
352
+
353
+ ```
354
+
355
+
356
+
357
+
358
+
359
+ *******************
360
+
287
361
  https://qiita.com/edasan/items/f32bc58a4afd0ca92432
288
362
 
289
363
  に掲載された内容を試しました。
290
364
 
291
365
 
292
366
 
367
+
368
+
293
369
  ### 補足情報(FW/ツールのバージョンなど)
294
370
 
295
371