質問編集履歴
3
修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -384,6 +384,8 @@
|
|
384
384
|
|
385
385
|
|
386
386
|
|
387
|
+
// ignore: must_be_immutable
|
388
|
+
|
387
389
|
class MyHomePage extends StatefulWidget {
|
388
390
|
|
389
391
|
MyHomePage({Key key, this.title}) : super(key: key);
|
@@ -504,6 +506,16 @@
|
|
504
506
|
|
505
507
|
class ChangeClass extends StatefulWidget {
|
506
508
|
|
509
|
+
ChangeClassPage createState() => ChangeClassPage();
|
510
|
+
|
511
|
+
}
|
512
|
+
|
513
|
+
|
514
|
+
|
515
|
+
class ChangeClassPage extends State<ChangeClass> {
|
516
|
+
|
517
|
+
|
518
|
+
|
507
519
|
int _counter = 0;
|
508
520
|
|
509
521
|
|
@@ -550,7 +562,13 @@
|
|
550
562
|
|
551
563
|
'$_counter',
|
552
564
|
|
553
|
-
style: Theme
|
565
|
+
style: Theme
|
566
|
+
|
567
|
+
.of(context)
|
568
|
+
|
569
|
+
.textTheme
|
570
|
+
|
571
|
+
.headline4,
|
554
572
|
|
555
573
|
),
|
556
574
|
|
@@ -574,8 +592,8 @@
|
|
574
592
|
|
575
593
|
}
|
576
594
|
|
577
|
-
|
578
|
-
|
579
|
-
}
|
595
|
+
}
|
596
|
+
|
597
|
+
|
580
598
|
|
581
599
|
```
|
2
追記修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -396,7 +396,7 @@
|
|
396
396
|
|
397
397
|
@override
|
398
398
|
|
399
|
-
|
399
|
+
MyHomePageState createState() => MyHomePageState();
|
400
400
|
|
401
401
|
}
|
402
402
|
|
@@ -410,7 +410,7 @@
|
|
410
410
|
|
411
411
|
static List<Widget> _widgetOptions = <Widget>[
|
412
412
|
|
413
|
-
|
413
|
+
ChangeClass(),
|
414
414
|
|
415
415
|
Text(
|
416
416
|
|
@@ -502,7 +502,7 @@
|
|
502
502
|
|
503
503
|
}
|
504
504
|
|
505
|
-
class
|
505
|
+
class ChangeClass extends StatefulWidget {
|
506
506
|
|
507
507
|
int _counter = 0;
|
508
508
|
|
@@ -528,7 +528,7 @@
|
|
528
528
|
|
529
529
|
appBar: AppBar(
|
530
530
|
|
531
|
-
title: Text(
|
531
|
+
title: Text('narururu'),
|
532
532
|
|
533
533
|
),
|
534
534
|
|
1
追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -339,3 +339,243 @@
|
|
339
339
|
どなたかアドバイスいただけますと幸いです。
|
340
340
|
|
341
341
|
よろしくお願いいたします。
|
342
|
+
|
343
|
+
|
344
|
+
|
345
|
+
## 追記
|
346
|
+
|
347
|
+
```ここに言語を入力
|
348
|
+
|
349
|
+
import 'package:flutter/material.dart';
|
350
|
+
|
351
|
+
|
352
|
+
|
353
|
+
void main() {
|
354
|
+
|
355
|
+
runApp(CountApp());
|
356
|
+
|
357
|
+
}
|
358
|
+
|
359
|
+
|
360
|
+
|
361
|
+
class CountApp extends StatelessWidget {
|
362
|
+
|
363
|
+
@override
|
364
|
+
|
365
|
+
Widget build(BuildContext context) {
|
366
|
+
|
367
|
+
return MaterialApp(
|
368
|
+
|
369
|
+
title: 'CountApp',
|
370
|
+
|
371
|
+
theme: ThemeData(
|
372
|
+
|
373
|
+
visualDensity: VisualDensity.adaptivePlatformDensity,
|
374
|
+
|
375
|
+
),
|
376
|
+
|
377
|
+
home: MyHomePage(title: 'Flutter Demo Home Page'),
|
378
|
+
|
379
|
+
);
|
380
|
+
|
381
|
+
}
|
382
|
+
|
383
|
+
}
|
384
|
+
|
385
|
+
|
386
|
+
|
387
|
+
class MyHomePage extends StatefulWidget {
|
388
|
+
|
389
|
+
MyHomePage({Key key, this.title}) : super(key: key);
|
390
|
+
|
391
|
+
|
392
|
+
|
393
|
+
String title;
|
394
|
+
|
395
|
+
|
396
|
+
|
397
|
+
@override
|
398
|
+
|
399
|
+
_MyHomePageState createState() => _MyHomePageState();
|
400
|
+
|
401
|
+
}
|
402
|
+
|
403
|
+
|
404
|
+
|
405
|
+
|
406
|
+
|
407
|
+
class MyHomePageState extends State<MyHomePage> {
|
408
|
+
|
409
|
+
int _selectedIndex = 0;
|
410
|
+
|
411
|
+
static List<Widget> _widgetOptions = <Widget>[
|
412
|
+
|
413
|
+
MyHomePage(),
|
414
|
+
|
415
|
+
Text(
|
416
|
+
|
417
|
+
'Index 1: Business',
|
418
|
+
|
419
|
+
),
|
420
|
+
|
421
|
+
Text(
|
422
|
+
|
423
|
+
'Index 2: School',
|
424
|
+
|
425
|
+
),
|
426
|
+
|
427
|
+
];
|
428
|
+
|
429
|
+
|
430
|
+
|
431
|
+
void _onItemTapped(int index) {
|
432
|
+
|
433
|
+
setState(() {
|
434
|
+
|
435
|
+
_selectedIndex = index;
|
436
|
+
|
437
|
+
});
|
438
|
+
|
439
|
+
}
|
440
|
+
|
441
|
+
|
442
|
+
|
443
|
+
@override
|
444
|
+
|
445
|
+
Widget build(BuildContext context) {
|
446
|
+
|
447
|
+
return Scaffold(
|
448
|
+
|
449
|
+
appBar: AppBar(
|
450
|
+
|
451
|
+
title: const Text('BottomNavigationBar Sample'),
|
452
|
+
|
453
|
+
),
|
454
|
+
|
455
|
+
body: Center(
|
456
|
+
|
457
|
+
child: _widgetOptions.elementAt(_selectedIndex),
|
458
|
+
|
459
|
+
),
|
460
|
+
|
461
|
+
bottomNavigationBar: BottomNavigationBar(
|
462
|
+
|
463
|
+
items: const <BottomNavigationBarItem>[
|
464
|
+
|
465
|
+
BottomNavigationBarItem(
|
466
|
+
|
467
|
+
icon: Icon(Icons.home),
|
468
|
+
|
469
|
+
label: 'Home',
|
470
|
+
|
471
|
+
),
|
472
|
+
|
473
|
+
BottomNavigationBarItem(
|
474
|
+
|
475
|
+
icon: Icon(Icons.business),
|
476
|
+
|
477
|
+
label: 'Business',
|
478
|
+
|
479
|
+
),
|
480
|
+
|
481
|
+
BottomNavigationBarItem(
|
482
|
+
|
483
|
+
icon: Icon(Icons.school),
|
484
|
+
|
485
|
+
label: 'School',
|
486
|
+
|
487
|
+
),
|
488
|
+
|
489
|
+
],
|
490
|
+
|
491
|
+
currentIndex: _selectedIndex,
|
492
|
+
|
493
|
+
selectedItemColor: Colors.amber[800],
|
494
|
+
|
495
|
+
onTap: _onItemTapped,
|
496
|
+
|
497
|
+
),
|
498
|
+
|
499
|
+
);
|
500
|
+
|
501
|
+
}
|
502
|
+
|
503
|
+
}
|
504
|
+
|
505
|
+
class _MyHomePageState extends State<MyHomePage> {
|
506
|
+
|
507
|
+
int _counter = 0;
|
508
|
+
|
509
|
+
|
510
|
+
|
511
|
+
void _incrementCounter() {
|
512
|
+
|
513
|
+
setState(() {
|
514
|
+
|
515
|
+
_counter++;
|
516
|
+
|
517
|
+
});
|
518
|
+
|
519
|
+
}
|
520
|
+
|
521
|
+
|
522
|
+
|
523
|
+
@override
|
524
|
+
|
525
|
+
Widget build(BuildContext context) {
|
526
|
+
|
527
|
+
return Scaffold(
|
528
|
+
|
529
|
+
appBar: AppBar(
|
530
|
+
|
531
|
+
title: Text(widget.title),
|
532
|
+
|
533
|
+
),
|
534
|
+
|
535
|
+
body: Center(
|
536
|
+
|
537
|
+
child: Column(
|
538
|
+
|
539
|
+
mainAxisAlignment: MainAxisAlignment.center,
|
540
|
+
|
541
|
+
children: <Widget>[
|
542
|
+
|
543
|
+
Text(
|
544
|
+
|
545
|
+
'You have pushed the button this many times:',
|
546
|
+
|
547
|
+
),
|
548
|
+
|
549
|
+
Text(
|
550
|
+
|
551
|
+
'$_counter',
|
552
|
+
|
553
|
+
style: Theme.of(context).textTheme.headline4,
|
554
|
+
|
555
|
+
),
|
556
|
+
|
557
|
+
],
|
558
|
+
|
559
|
+
),
|
560
|
+
|
561
|
+
),
|
562
|
+
|
563
|
+
floatingActionButton: FloatingActionButton(
|
564
|
+
|
565
|
+
onPressed: _incrementCounter,
|
566
|
+
|
567
|
+
tooltip: 'Increment',
|
568
|
+
|
569
|
+
child: Icon(Icons.add),
|
570
|
+
|
571
|
+
), // This trailing comma makes auto-formatting nicer for build methods.
|
572
|
+
|
573
|
+
);
|
574
|
+
|
575
|
+
}
|
576
|
+
|
577
|
+
|
578
|
+
|
579
|
+
}
|
580
|
+
|
581
|
+
```
|