Skip to content

Commit

Permalink
Merge pull request #10 from niloysikdar/style
Browse files Browse the repository at this point in the history
Style
  • Loading branch information
niloysikdar authored May 2, 2021
2 parents 5b6e93d + 6aa12a0 commit e690ae6
Show file tree
Hide file tree
Showing 11 changed files with 143 additions and 66 deletions.
4 changes: 2 additions & 2 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:plaso_connect/constants/colors.dart';
import 'package:plaso_connect/screens/landingScreen.dart';
import 'package:plaso_connect/screens/signup.dart';

Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();
Expand All @@ -30,7 +30,7 @@ class MyApp extends StatelessWidget {
primaryColor: kelectronBlue,
iconTheme: IconThemeData(color: kelectronBlue),
),
home: LandingScreen(),
home: SignUpPage(),
);
}
}
21 changes: 21 additions & 0 deletions lib/screens/addoxygen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,15 @@ class _AddOxygenDetailsState extends State<AddOxygenDetails> {
late TextEditingController descriptioncontroller;
late TextEditingController pincontroller;

bool isUploading = false;

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 {
setState(() {
isUploading = true;
});
var oxygenPostModel = OxygenPostModel(
title: titlecontroller.text,
description: descriptioncontroller.text,
Expand All @@ -29,6 +34,8 @@ class _AddOxygenDetailsState extends State<AddOxygenDetails> {
);
await DatabaseMethod().uploadOxygen(oxygenPostModel);
clearcontrollers();
isUploading = false;
setState(() {});
}

void clearcontrollers() {
Expand Down Expand Up @@ -132,6 +139,20 @@ class _AddOxygenDetailsState extends State<AddOxygenDetails> {
),
),
),
(isUploading)
? Container(
height: double.infinity,
width: double.infinity,
color: Colors.grey.withOpacity(0.5),
child: Center(
child: SizedBox(
height: size.width * 0.2,
width: size.width * 0.2,
child: CircularProgressIndicator(),
),
),
)
: Container(height: 0, width: 0),
],
),
),
Expand Down
26 changes: 16 additions & 10 deletions lib/screens/homescreen.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import 'package:flutter/material.dart';
import 'package:fluttertoast/fluttertoast.dart';
import 'package:plaso_connect/constants/colors.dart';
import 'package:plaso_connect/screens/selectoxygen.dart';
import 'package:plaso_connect/screens/selectplasma.dart';
import 'package:plaso_connect/screens/statdashboard.dart';
import 'package:plaso_connect/services/transitions.dart';
import 'package:plaso_connect/widgets/boxdecoration.dart';
import 'package:plaso_connect/widgets/logowidget.dart';

Expand Down Expand Up @@ -33,9 +35,7 @@ class HomeScreen extends StatelessWidget {
onTap: () {
Navigator.push(
context,
MaterialPageRoute(builder: (context) {
return TotalStatsDashboard();
}),
SlideLeftRoute(page: TotalStatsDashboard()),
);
},
),
Expand All @@ -44,9 +44,7 @@ class HomeScreen extends StatelessWidget {
onTap: () {
Navigator.push(
context,
MaterialPageRoute(builder: (context) {
return SelectPlasma();
}),
SlideLeftRoute(page: SelectPlasma()),
);
},
),
Expand All @@ -55,15 +53,23 @@ class HomeScreen extends StatelessWidget {
onTap: () {
Navigator.push(
context,
MaterialPageRoute(builder: (context) {
return SelectOxygen();
}),
SlideLeftRoute(page: SelectOxygen()),
);
},
),
homeButton(
text: "More",
onTap: () {},
onTap: () {
Fluttertoast.showToast(
msg: "Coming Soon",
toastLength: Toast.LENGTH_SHORT,
gravity: ToastGravity.BOTTOM,
timeInSecForIosWeb: 1,
backgroundColor: Colors.red,
textColor: Colors.white,
fontSize: 18.0,
);
},
),
],
),
Expand Down
9 changes: 3 additions & 6 deletions lib/screens/landingScreen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'package:carousel_slider/carousel_slider.dart';
import 'package:flutter/material.dart';
import 'package:plaso_connect/constants/colors.dart';
import 'package:plaso_connect/screens/homescreen.dart';
import 'package:plaso_connect/services/transitions.dart';
import 'package:plaso_connect/widgets/boxdecoration.dart';

class LandingScreen extends StatelessWidget {
Expand Down Expand Up @@ -39,9 +40,7 @@ class LandingScreen extends StatelessWidget {
onTap: () {
Navigator.pushReplacement(
context,
MaterialPageRoute(builder: (context) {
return HomeScreen();
}),
SlideLeftRoute(page: HomeScreen()),
);
},
),
Expand All @@ -50,9 +49,7 @@ class LandingScreen extends StatelessWidget {
onTap: () {
Navigator.pushReplacement(
context,
MaterialPageRoute(builder: (context) {
return HomeScreen();
}),
SlideLeftRoute(page: HomeScreen()),
);
},
),
Expand Down
21 changes: 21 additions & 0 deletions lib/screens/plasmaform.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ class _PlasmaDonateState extends State<PlasmaDonate> {
String covidquestion = "Have you ever tested covid positive ?";
int covidStatus = 1;

bool isUploading = false;

@override
void initState() {
super.initState();
Expand All @@ -46,6 +48,9 @@ class _PlasmaDonateState extends State<PlasmaDonate> {
}

void donePressed() async {
setState(() {
isUploading = true;
});
var donorModel = DonorModel(
name: namecontroller.text,
phone: phonecontroller.text,
Expand All @@ -59,6 +64,8 @@ class _PlasmaDonateState extends State<PlasmaDonate> {
);
await DatabaseMethod().uploadDonor(donorModel);
clearInput();
isUploading = false;
setState(() {});
}

void clearInput() {
Expand Down Expand Up @@ -379,6 +386,20 @@ class _PlasmaDonateState extends State<PlasmaDonate> {
),
),
),
(isUploading)
? Container(
height: double.infinity,
width: double.infinity,
color: Colors.grey.withOpacity(0.5),
child: Center(
child: SizedBox(
height: size.width * 0.2,
width: size.width * 0.2,
child: CircularProgressIndicator(),
),
),
)
: Container(height: 0, width: 0),
],
),
),
Expand Down
9 changes: 3 additions & 6 deletions lib/screens/selectoxygen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
import 'package:plaso_connect/constants/colors.dart';
import 'package:plaso_connect/screens/addoxygen.dart';
import 'package:plaso_connect/screens/showOxygenposts.dart';
import 'package:plaso_connect/services/transitions.dart';
import 'package:plaso_connect/widgets/boxdecoration.dart';

class SelectOxygen extends StatelessWidget {
Expand Down Expand Up @@ -29,9 +30,7 @@ class SelectOxygen extends StatelessWidget {
onTap: () {
Navigator.push(
context,
MaterialPageRoute(builder: (context) {
return AddOxygenDetails();
}),
SlideLeftRoute(page: AddOxygenDetails()),
);
},
),
Expand All @@ -40,9 +39,7 @@ class SelectOxygen extends StatelessWidget {
onTap: () {
Navigator.push(
context,
MaterialPageRoute(builder: (context) {
return ShowOxygenPosts();
}),
SlideLeftRoute(page: ShowOxygenPosts()),
);
},
),
Expand Down
73 changes: 36 additions & 37 deletions lib/screens/selectplasma.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,50 +2,49 @@ import 'package:flutter/material.dart';
import 'package:plaso_connect/constants/colors.dart';
import 'package:plaso_connect/screens/donorlist.dart';
import 'package:plaso_connect/screens/plasmaform.dart';
import 'package:plaso_connect/services/transitions.dart';
import 'package:plaso_connect/widgets/boxdecoration.dart';

class SelectPlasma extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
body: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: const EdgeInsets.only(left: 30, bottom: 15),
child: Text(
"Choose an option :",
style: TextStyle(
color: kelectronBlue,
fontSize: 22,
fontWeight: FontWeight.w600,
return SafeArea(
child: Scaffold(
body: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: const EdgeInsets.only(left: 30, bottom: 15),
child: Text(
"Choose an option :",
style: TextStyle(
color: kelectronBlue,
fontSize: 22,
fontWeight: FontWeight.w600,
),
),
),
),
selectPlasmaButton(
text: "Donate Plasma/Blood",
onTap: () {
Navigator.push(
context,
MaterialPageRoute(builder: (context) {
return PlasmaDonate();
}),
);
},
),
selectPlasmaButton(
text: "Availbe Donors",
onTap: () {
Navigator.push(
context,
MaterialPageRoute(builder: (context) {
return DonorList();
}),
);
},
),
],
selectPlasmaButton(
text: "Donate Plasma/Blood",
onTap: () {
Navigator.push(
context,
SlideLeftRoute(page: PlasmaDonate()),
);
},
),
selectPlasmaButton(
text: "Availbe Donors",
onTap: () {
Navigator.push(
context,
SlideLeftRoute(page: DonorList()),
);
},
),
],
),
),
);
}
Expand Down
11 changes: 6 additions & 5 deletions lib/screens/signup.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import 'package:plaso_connect/screens/plasmaform.dart';
import 'package:plaso_connect/screens/landingScreen.dart';
import 'package:plaso_connect/services/transitions.dart';
import 'package:plaso_connect/widgets/inputfield.dart';
import 'package:plaso_connect/widgets/loginbutton.dart';
import 'package:plaso_connect/widgets/loginheader.dart';
Expand Down Expand Up @@ -61,11 +62,11 @@ class _SignUpPageState extends State<SignUpPage> {
text: "Sign In/Up",
onTap: () {
print("Done");
Navigator.push(
Navigator.pushReplacement(
context,
MaterialPageRoute(builder: (context) {
return PlasmaDonate();
}),
SlideLeftRoute(
page: LandingScreen(),
),
);
},
),
Expand Down
27 changes: 27 additions & 0 deletions lib/services/transitions.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import 'package:flutter/material.dart';

class SlideLeftRoute extends PageRouteBuilder {
final Widget page;
SlideLeftRoute({required this.page})
: super(
pageBuilder: (
BuildContext context,
Animation<double> animation,
Animation<double> secondaryAnimation,
) =>
page,
transitionsBuilder: (
BuildContext context,
Animation<double> animation,
Animation<double> secondaryAnimation,
Widget child,
) =>
SlideTransition(
position: Tween<Offset>(
begin: const Offset(1, 0),
end: Offset.zero,
).animate(animation),
child: child,
),
);
}
7 changes: 7 additions & 0 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,13 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
fluttertoast:
dependency: "direct main"
description:
name: fluttertoast
url: "https://pub.dartlang.org"
source: hosted
version: "8.0.6"
google_fonts:
dependency: "direct main"
description:
Expand Down
1 change: 1 addition & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ dependencies:
firebase_auth: ^1.1.2
cloud_firestore: ^1.0.7
carousel_slider: ^4.0.0-nullsafety.0
fluttertoast: ^8.0.6

# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
Expand Down

0 comments on commit e690ae6

Please sign in to comment.