Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…ers- into main
  • Loading branch information
anishsreenivas82 committed Jul 30, 2021
2 parents 02e5581 + 2dddc7e commit 8f6a44e
Show file tree
Hide file tree
Showing 7 changed files with 390 additions and 147 deletions.
43 changes: 29 additions & 14 deletions lib/pages/item_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import 'package:flutterlogindesign/pages/qr.dart';
import 'package:fluttertoast/fluttertoast.dart';

String generatedID;
var address, phoneNumber;

class Itempage extends StatefulWidget {
// const ({ Key? key }) : super(key: key);
Expand All @@ -23,7 +24,7 @@ class _State extends State<Itempage> {
final baby = TextEditingController();

CollectionReference x = FirebaseFirestore.instance.collection('Owners');

CollectionReference y = FirebaseFirestore.instance.collection('Volunteer');
@override
void dispose() {
// Clean up the controller when the widget is disposed.
Expand All @@ -33,6 +34,14 @@ class _State extends State<Itempage> {

@override
Widget build(BuildContext context) {
FirebaseFirestore.instance
.collection('Owners')
.doc(uidDonor)
.get()
.then((DocumentSnapshot documentSnapshot) {
address = documentSnapshot.get('Address').toString();
phoneNumber = documentSnapshot.get('Phone').toString();
});
final height = MediaQuery.of(context).size.height;
final width = MediaQuery.of(context).size.width;
return Scaffold(
Expand Down Expand Up @@ -94,19 +103,25 @@ class _State extends State<Itempage> {
}).then((querySnapshot) {
// Here we call the document just after creation

generatedID = querySnapshot.id.toString() +
uidDonor.toString(); // Here we call the ID of the document
Fluttertoast.showToast(
msg: "Item added.",
toastLength: Toast.LENGTH_LONG,
gravity: ToastGravity.BOTTOM,
timeInSecForIosWeb: 1,
backgroundColor: Colors.red,
textColor: Colors.white,
fontSize: 16.0
);


generatedID = querySnapshot.id.toString() +
uidDonor
.toString(); // Here we call the ID of the document
Fluttertoast.showToast(
msg: "Item added.",
toastLength: Toast.LENGTH_LONG,
gravity: ToastGravity.BOTTOM,
timeInSecForIosWeb: 1,
backgroundColor: Colors.red,
textColor: Colors.white,
fontSize: 16.0);
y
.doc('pending verifications')
.collection('pending verifications')
.add({
'Name': name.text,
'Address': address,
'Phno': phoneNumber,
}).then((value) => null);
});

Navigator.push(
Expand Down
10 changes: 3 additions & 7 deletions lib/pages/pending_orders.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,28 +17,24 @@ class _PendingOrdersState extends State<PendingOrders> {
.collection('items')
.snapshots();



@override
Widget build(BuildContext context) {

double height = MediaQuery.of(context).size.height;
double width = MediaQuery.of(context).size.width;
return Scaffold(
backgroundColor: Colors.amber[100],
appBar: AppBar(title: Text('Pending Verification'),centerTitle: true,backgroundColor: Colors.blue,),
body: SafeArea(
child: StreamBuilder<QuerySnapshot>(
child: StreamBuilder<QuerySnapshot>(
stream: _PendingOrderStream,
builder: (BuildContext context, AsyncSnapshot<QuerySnapshot> snapshot) {
builder:
(BuildContext context, AsyncSnapshot<QuerySnapshot> snapshot) {
if (snapshot.hasError) {
return Text('Something went wrong');
}

if (snapshot.connectionState == ConnectionState.waiting) {
return Text("Loading");
}

return new ListView(
children: snapshot.data.docs.map((DocumentSnapshot document) {
Map<String, dynamic> data =
Expand Down
57 changes: 29 additions & 28 deletions lib/pages/qr.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ class Qrcode extends StatefulWidget {
class _State extends State<Qrcode> {
@override
Widget build(BuildContext context) {
final height = MediaQuery.of(context).size.height;
double height = MediaQuery.of(context).size.height;
return Scaffold(
backgroundColor: Colors.amber[800],
body: SingleChildScrollView(
child: SafeArea(
child: SafeArea(
child: Padding(
padding: EdgeInsets.fromLTRB(0, height*0.3,0, height*0.01),
child: Column(mainAxisAlignment: MainAxisAlignment.center, children: [
Expand All @@ -34,33 +34,34 @@ class _State extends State<Qrcode> {
width: 200,
height: 200,
),
),
),
SizedBox(
height: height*0.2
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
crossAxisAlignment: CrossAxisAlignment.end,
children: [
FloatingActionButton(
onPressed: () {
Navigator.push(context,
MaterialPageRoute(builder: (context) => Itempage()));
},
child: Text('Add'),
),
FloatingActionButton(
onPressed: () {
Navigator.push(context,
MaterialPageRoute(builder: (context) => Donor()));
},
child: Text('Finish'))
],
)
]),
),
)),
SizedBox(height: height*0.2),
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
crossAxisAlignment: CrossAxisAlignment.end,
children: [
FloatingActionButton(
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => Itempage()));
},
child: Text('Add'),
),
FloatingActionButton(
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => Donor()));
},
child: Text('Finish'))
],
)
]),
),
),
));
}
}
1 change: 0 additions & 1 deletion lib/pages/shelter_prev_donations.dart
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ class _Shelter_PrevState extends State<Shelter_Prev> {
width * 0.01, height * 0.01, width * 0.01, height * 0.01),
child: Container(
child: new Card(

elevation: 20,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(width*0.1),
Expand Down
Loading

0 comments on commit 8f6a44e

Please sign in to comment.