質問編集履歴
1
コードを提示します
test
CHANGED
File without changes
|
test
CHANGED
@@ -32,11 +32,133 @@
|
|
32
32
|
|
33
33
|
|
34
34
|
|
35
|
-
|
35
|
+
コードを提示します。
|
36
36
|
|
37
|
-
|
37
|
+
よろしくお願いいたします。
|
38
38
|
|
39
|
+
|
40
|
+
|
41
|
+
import 'package:cloud_firestore/cloud_firestore.dart';
|
42
|
+
|
43
|
+
import 'package:flutter/cupertino.dart';
|
44
|
+
|
45
|
+
import 'package:flutter/material.dart';
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
class CalcIlistScreen extends StatefulWidget {
|
50
|
+
|
51
|
+
final index2;
|
52
|
+
|
53
|
+
final index3;
|
54
|
+
|
55
|
+
final index4;
|
56
|
+
|
57
|
+
CalcIlistScreen({@required this.index2, this.index3, this.index4});
|
58
|
+
|
59
|
+
|
60
|
+
|
61
|
+
@override
|
62
|
+
|
63
|
+
createState() => _CalcIlistScreenState();
|
64
|
+
|
65
|
+
}
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
class _CalcIlistScreenState extends State<CalcIlistScreen> {
|
70
|
+
|
71
|
+
@override
|
72
|
+
|
73
|
+
Widget build(BuildContext context) {
|
74
|
+
|
75
|
+
return Scaffold(
|
76
|
+
|
77
|
+
appBar: AppBar(
|
78
|
+
|
79
|
+
title: const Text("入庫一覧"),
|
80
|
+
|
81
|
+
centerTitle: true,
|
82
|
+
|
83
|
+
backgroundColor: Colors.blueAccent,
|
84
|
+
|
85
|
+
leading: IconButton(
|
86
|
+
|
87
|
+
icon: Icon(Icons.arrow_back),
|
88
|
+
|
89
|
+
),
|
90
|
+
|
91
|
+
),
|
92
|
+
|
93
|
+
body: Padding(
|
94
|
+
|
95
|
+
padding: const EdgeInsets.all(8.0),
|
96
|
+
|
97
|
+
child: StreamBuilder<QuerySnapshot>(
|
98
|
+
|
99
|
+
stream: Firestore.instance
|
100
|
+
|
101
|
+
.collection("stock")
|
102
|
+
|
103
|
+
.where("parts-code", isEqualTo: widget.index4) //index4は部品のコードNo.
|
104
|
+
|
105
|
+
.where("category", isEqualTo: "入庫")
|
106
|
+
|
107
|
+
.where("date", isGreaterThan: widget.index2) //index2は日付
|
108
|
+
|
109
|
+
.orderBy("date", descending: true)
|
110
|
+
|
111
|
+
.snapshots(),
|
112
|
+
|
113
|
+
builder:
|
114
|
+
|
115
|
+
(BuildContext context, AsyncSnapshot<QuerySnapshot> snapshot) {
|
116
|
+
|
117
|
+
if (!snapshot.hasData) return const Text("Loading...");
|
118
|
+
|
119
|
+
return ListView(
|
120
|
+
|
121
|
+
children:
|
122
|
+
|
123
|
+
snapshot.data.documents.map((DocumentSnapshot document) {
|
124
|
+
|
125
|
+
return ListTile(
|
126
|
+
|
127
|
+
title: Text(document["qty"]), //qtyは数量
|
128
|
+
|
129
|
+
);
|
130
|
+
|
131
|
+
}).toList(),
|
132
|
+
|
133
|
+
);
|
134
|
+
|
39
|
-
|
135
|
+
}),
|
136
|
+
|
137
|
+
),
|
138
|
+
|
139
|
+
);
|
140
|
+
|
141
|
+
}
|
142
|
+
|
143
|
+
}
|
144
|
+
|
145
|
+
|
146
|
+
|
147
|
+
|
148
|
+
|
149
|
+
表示結果
|
150
|
+
|
151
|
+
|
152
|
+
|
153
|
+
20
|
154
|
+
|
155
|
+
100
|
156
|
+
|
157
|
+
50
|
158
|
+
|
159
|
+
|
160
|
+
|
161
|
+
この合計170を表示(取得)させたいのですが?
|
40
162
|
|
41
163
|
|
42
164
|
|