Skip to content

Commit

Permalink
Oxygen Upload
Browse files Browse the repository at this point in the history
  • Loading branch information
niloysikdar committed May 1, 2021
1 parent 6059c97 commit 641e7ac
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import 'package:plaso_connect/screens/addoxygen.dart';

Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();
// await Firebase.initializeApp();
await Firebase.initializeApp();
SystemChrome.setPreferredOrientations([
DeviceOrientation.portraitUp,
]).then((val) {
Expand Down
16 changes: 16 additions & 0 deletions lib/screens/addoxygen.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import 'package:flutter/material.dart';
import 'package:plaso_connect/constants/colors.dart';
import 'package:plaso_connect/models/oxygenpostmodel.dart';
import 'package:plaso_connect/services/database.dart';
import 'package:plaso_connect/widgets/formbanner.dart';
import 'package:plaso_connect/widgets/inputfield.dart';

Expand All @@ -16,6 +18,19 @@ class _AddOxygenDetailsState extends State<AddOxygenDetails> {
String headerstring =
"Please ensure all the data that you are providing are from verified sources.\nFeeding any false information or spamming will lead to permanent ban.";

void postPressed() async {
var oxygenPostModel = OxygenPostModel(
title: titlecontroller.text,
description: descriptioncontroller.text,
pin: pincontroller.text,
postedOn: DateTime.now().toString(),
postedBy: "Admin",
postedRole: "Admin",
);
await DatabaseMethod().uploadOxygen(oxygenPostModel);
clearcontrollers();
}

void clearcontrollers() {
titlecontroller.clear();
descriptioncontroller.clear();
Expand Down Expand Up @@ -108,6 +123,7 @@ class _AddOxygenDetailsState extends State<AddOxygenDetails> {
SizedBox(height: 30),
GestureDetector(
onTap: () {
postPressed();
print("Posted");
},
child: doneBtn(),
Expand Down
2 changes: 1 addition & 1 deletion lib/widgets/inputfield.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ Widget inputField({
child: TextFormField(
controller: controller,
keyboardType: textInputType,
maxLines: maxLines,
style: TextStyle(
fontSize: 22,
color: Colors.grey[700],
),
maxLines: maxLines,
decoration: InputDecoration(
filled: true,
fillColor: Color(0xFFEFEEEE),
Expand Down

0 comments on commit 641e7ac

Please sign in to comment.