質問編集履歴
1
コードを提示します
title
CHANGED
File without changes
|
body
CHANGED
@@ -15,10 +15,71 @@
|
|
15
15
|
|
16
16
|
### 該当のソースコード
|
17
17
|
|
18
|
+
コードを提示します。
|
18
|
-
|
19
|
+
よろしくお願いいたします。
|
19
|
-
ソースコード
|
20
|
-
```
|
21
20
|
|
21
|
+
import 'package:cloud_firestore/cloud_firestore.dart';
|
22
|
+
import 'package:flutter/cupertino.dart';
|
23
|
+
import 'package:flutter/material.dart';
|
24
|
+
|
25
|
+
class CalcIlistScreen extends StatefulWidget {
|
26
|
+
final index2;
|
27
|
+
final index3;
|
28
|
+
final index4;
|
29
|
+
CalcIlistScreen({@required this.index2, this.index3, this.index4});
|
30
|
+
|
31
|
+
@override
|
32
|
+
createState() => _CalcIlistScreenState();
|
33
|
+
}
|
34
|
+
|
35
|
+
class _CalcIlistScreenState extends State<CalcIlistScreen> {
|
36
|
+
@override
|
37
|
+
Widget build(BuildContext context) {
|
38
|
+
return Scaffold(
|
39
|
+
appBar: AppBar(
|
40
|
+
title: const Text("入庫一覧"),
|
41
|
+
centerTitle: true,
|
42
|
+
backgroundColor: Colors.blueAccent,
|
43
|
+
leading: IconButton(
|
44
|
+
icon: Icon(Icons.arrow_back),
|
45
|
+
),
|
46
|
+
),
|
47
|
+
body: Padding(
|
48
|
+
padding: const EdgeInsets.all(8.0),
|
49
|
+
child: StreamBuilder<QuerySnapshot>(
|
50
|
+
stream: Firestore.instance
|
51
|
+
.collection("stock")
|
52
|
+
.where("parts-code", isEqualTo: widget.index4) //index4は部品のコードNo.
|
53
|
+
.where("category", isEqualTo: "入庫")
|
54
|
+
.where("date", isGreaterThan: widget.index2) //index2は日付
|
55
|
+
.orderBy("date", descending: true)
|
56
|
+
.snapshots(),
|
57
|
+
builder:
|
58
|
+
(BuildContext context, AsyncSnapshot<QuerySnapshot> snapshot) {
|
59
|
+
if (!snapshot.hasData) return const Text("Loading...");
|
60
|
+
return ListView(
|
61
|
+
children:
|
62
|
+
snapshot.data.documents.map((DocumentSnapshot document) {
|
63
|
+
return ListTile(
|
64
|
+
title: Text(document["qty"]), //qtyは数量
|
65
|
+
);
|
66
|
+
}).toList(),
|
67
|
+
);
|
68
|
+
}),
|
69
|
+
),
|
70
|
+
);
|
71
|
+
}
|
72
|
+
}
|
73
|
+
|
74
|
+
|
75
|
+
表示結果
|
76
|
+
|
77
|
+
20
|
78
|
+
100
|
79
|
+
50
|
80
|
+
|
81
|
+
この合計170を表示(取得)させたいのですが?
|
82
|
+
|
22
83
|
### 試したこと
|
23
84
|
|
24
85
|
ここに問題に対して試したことを記載してください。
|