回答編集履歴
1
追記
test
CHANGED
@@ -19,3 +19,87 @@
|
|
19
19
|
|
20
20
|
|
21
21
|
あたりが選択肢になるかと思います。
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
以下は 1. の場合の例です。
|
26
|
+
|
27
|
+
|
28
|
+
|
29
|
+
```dart
|
30
|
+
|
31
|
+
// MultiProviderを削除
|
32
|
+
|
33
|
+
class TabbedAppBarSample extends StatelessWidget {
|
34
|
+
|
35
|
+
@override
|
36
|
+
|
37
|
+
Widget build(BuildContext context) {
|
38
|
+
|
39
|
+
return MaterialApp(
|
40
|
+
|
41
|
+
home: DefaultTabController(
|
42
|
+
|
43
|
+
length: 2,
|
44
|
+
|
45
|
+
child: Scaffold( // 以下省略
|
46
|
+
|
47
|
+
```
|
48
|
+
|
49
|
+
|
50
|
+
|
51
|
+
```dart
|
52
|
+
|
53
|
+
// Providerを追加
|
54
|
+
|
55
|
+
class CarPage extends StatelessWidget {
|
56
|
+
|
57
|
+
@override
|
58
|
+
|
59
|
+
Widget build(BuildContext context) {
|
60
|
+
|
61
|
+
return Scaffold(
|
62
|
+
|
63
|
+
body: Column(
|
64
|
+
|
65
|
+
children: [
|
66
|
+
|
67
|
+
ChangeNotifierProvider(
|
68
|
+
|
69
|
+
create: (context) => SameCupertinoSegmentedControlModel(),
|
70
|
+
|
71
|
+
child: SameCupertinoSegmentedControl(
|
72
|
+
|
73
|
+
title: 'タイトル1',
|
74
|
+
|
75
|
+
value: {0: Text('value1'), 1: Text('value2')},
|
76
|
+
|
77
|
+
),
|
78
|
+
|
79
|
+
),
|
80
|
+
|
81
|
+
ChangeNotifierProvider(
|
82
|
+
|
83
|
+
create: (context) => SameCupertinoSegmentedControlModel(),
|
84
|
+
|
85
|
+
child: SameCupertinoSegmentedControl(
|
86
|
+
|
87
|
+
title: 'タイトル2',
|
88
|
+
|
89
|
+
value: {0: Text('value3'), 1: Text('value4')},
|
90
|
+
|
91
|
+
),
|
92
|
+
|
93
|
+
),
|
94
|
+
|
95
|
+
],
|
96
|
+
|
97
|
+
),
|
98
|
+
|
99
|
+
);
|
100
|
+
|
101
|
+
}
|
102
|
+
|
103
|
+
}
|
104
|
+
|
105
|
+
```
|