質問編集履歴

1

追記

2021/01/23 14:06

投稿

narururu
narururu

スコア170

test CHANGED
File without changes
test CHANGED
@@ -303,3 +303,213 @@
303
303
  どなたかアドバイスいただけませんでしょうか。
304
304
 
305
305
  よろしくお願いいたします。
306
+
307
+
308
+
309
+ ## 追記
310
+
311
+ ```ここに言語を入力
312
+
313
+ //入力画面
314
+
315
+ import 'package:flutter/material.dart';
316
+
317
+
318
+
319
+ void main() {
320
+
321
+ runApp(MyApp());
322
+
323
+ }
324
+
325
+
326
+
327
+ // ignore: must_be_immutable
328
+
329
+ class MyApp extends StatefulWidget {
330
+
331
+ String name;
332
+
333
+ String phone;
334
+
335
+
336
+
337
+ MyApp({Key key, this.name, this.phone}) : super(key: key);
338
+
339
+
340
+
341
+ @override
342
+
343
+ MyAppState createState() => MyAppState();
344
+
345
+ }
346
+
347
+ class MyAppState extends State<MyApp> {
348
+
349
+ Widget build(BuildContext context) {
350
+
351
+ return MaterialApp(
352
+
353
+ theme: ThemeData(
354
+
355
+ primarySwatch: Colors.blue,
356
+
357
+ visualDensity: VisualDensity.adaptivePlatformDensity,
358
+
359
+ ),
360
+
361
+ home: Scaffold(
362
+
363
+ appBar: AppBar(
364
+
365
+ title: Text('入力画面'),
366
+
367
+ ),
368
+
369
+ body: Center(
370
+
371
+ child: Column(
372
+
373
+ mainAxisAlignment: MainAxisAlignment.center,
374
+
375
+ children: [
376
+
377
+ TextField(
378
+
379
+ onChanged: (value) {
380
+
381
+ setState((){
382
+
383
+ name = value;
384
+
385
+ });
386
+
387
+ },
388
+
389
+ decoration: InputDecoration(
390
+
391
+ hintText: 'ここに入力した値を次の画面に渡したい'
392
+
393
+ ),
394
+
395
+ ),
396
+
397
+ TextField(
398
+
399
+ decoration: InputDecoration(
400
+
401
+ hintText: 'ここに入力した値を次の画面に渡したい'
402
+
403
+ ),
404
+
405
+ ),
406
+
407
+ RaisedButton(
408
+
409
+ child: Text('確認画面へ'),
410
+
411
+ onPressed: (){
412
+
413
+ Navigator.push(
414
+
415
+ context,
416
+
417
+ MaterialPageRoute(builder: (context) => NextPage()),
418
+
419
+ );
420
+
421
+ }
422
+
423
+ ),
424
+
425
+ ],
426
+
427
+ ),
428
+
429
+ ),
430
+
431
+ )
432
+
433
+ );
434
+
435
+ }
436
+
437
+ }
438
+
439
+
440
+
441
+ //確認画面
442
+
443
+ class NextPage extends StatefulWidget{
444
+
445
+
446
+
447
+ @override
448
+
449
+ Widget build(BuildContext context) {
450
+
451
+ return MaterialApp(
452
+
453
+ theme: ThemeData(
454
+
455
+ primarySwatch: Colors.blue,
456
+
457
+ visualDensity: VisualDensity.adaptivePlatformDensity,
458
+
459
+ ),
460
+
461
+ home: NextPage2(),
462
+
463
+ );
464
+
465
+ }
466
+
467
+ }
468
+
469
+
470
+
471
+ class NextPage2 extends StatefulWidget{
472
+
473
+ NextPage2({this.name});
474
+
475
+ final String name;
476
+
477
+
478
+
479
+ @override
480
+
481
+ Widget build(BuildContext context){
482
+
483
+ return Scaffold(
484
+
485
+ appBar: AppBar(
486
+
487
+ title: Text('確認画面'),
488
+
489
+ ),
490
+
491
+ body: Center(
492
+
493
+ child: Column(
494
+
495
+ mainAxisAlignment: MainAxisAlignment.center,
496
+
497
+ children: [
498
+
499
+ Text(name),
500
+
501
+ Text(name),
502
+
503
+ ],
504
+
505
+ ),
506
+
507
+ ),
508
+
509
+ );
510
+
511
+ }
512
+
513
+ }
514
+
515
+ ```