diff --git a/assets/icons/logo.png b/assets/icons/logo.png new file mode 100644 index 0000000..132f262 Binary files /dev/null and b/assets/icons/logo.png differ diff --git a/lib/main.dart b/lib/main.dart index 05ec130..f812d65 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -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/showOxygenposts.dart'; +import 'package:plaso_connect/screens/landingScreen.dart'; Future main() async { WidgetsFlutterBinding.ensureInitialized(); @@ -30,7 +30,7 @@ class MyApp extends StatelessWidget { primaryColor: kelectronBlue, iconTheme: IconThemeData(color: kelectronBlue), ), - home: ShowOxygenPosts(), + home: LandingScreen(), ); } } diff --git a/lib/screens/homescreen.dart b/lib/screens/homescreen.dart new file mode 100644 index 0000000..818a3a4 --- /dev/null +++ b/lib/screens/homescreen.dart @@ -0,0 +1,97 @@ +import 'package:flutter/material.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/widgets/boxdecoration.dart'; +import 'package:plaso_connect/widgets/logowidget.dart'; + +class HomeScreen extends StatelessWidget { + @override + Widget build(BuildContext context) { + Size size = MediaQuery.of(context).size; + return SafeArea( + child: Scaffold( + body: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + logoWidget(size: size), + Padding( + padding: const EdgeInsets.only(left: 30, bottom: 15), + child: Text( + "What are you looking for ?", + style: TextStyle( + color: kelectronBlue, + fontSize: 22, + fontWeight: FontWeight.w600, + ), + ), + ), + homeButton( + text: "Latest COVID Stats", + onTap: () { + Navigator.push( + context, + MaterialPageRoute(builder: (context) { + return TotalStatsDashboard(); + }), + ); + }, + ), + homeButton( + text: "Plasma/Blood", + onTap: () { + Navigator.push( + context, + MaterialPageRoute(builder: (context) { + return SelectPlasma(); + }), + ); + }, + ), + homeButton( + text: "Oxygen and support", + onTap: () { + Navigator.push( + context, + MaterialPageRoute(builder: (context) { + return SelectOxygen(); + }), + ); + }, + ), + homeButton( + text: "More", + onTap: () {}, + ), + ], + ), + ), + ); + } + + Widget homeButton({ + required String text, + required Function onTap, + }) { + return GestureDetector( + onTap: onTap as void Function()?, + child: Container( + margin: EdgeInsets.symmetric(horizontal: 30, vertical: 15), + padding: EdgeInsets.all(15), + decoration: newboxDecoration(), + child: Center( + child: Text( + text, + style: TextStyle( + color: kelectronBlue, + fontSize: 20, + fontWeight: FontWeight.w600, + ), + ), + ), + ), + ); + } +} diff --git a/lib/screens/landingScreen.dart b/lib/screens/landingScreen.dart new file mode 100644 index 0000000..7b8db34 --- /dev/null +++ b/lib/screens/landingScreen.dart @@ -0,0 +1,121 @@ +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/widgets/boxdecoration.dart'; + +class LandingScreen extends StatelessWidget { + final List images = [ + "assets/images/banner1.jpg", + "assets/images/banner2.png", + "assets/images/banner3.png", + ]; + + @override + Widget build(BuildContext context) { + Size size = MediaQuery.of(context).size; + return SafeArea( + child: Scaffold( + body: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox(height: 20), + topCarousel(size: size), + SizedBox(height: 40), + Padding( + padding: const EdgeInsets.only(left: 30, bottom: 15), + child: Text( + "Register as :", + style: TextStyle( + color: kelectronBlue, + fontSize: 25, + fontWeight: FontWeight.w600, + ), + ), + ), + selectButton( + text: "Individual\n(Normal/Volunteer)", + onTap: () { + Navigator.pushReplacement( + context, + MaterialPageRoute(builder: (context) { + return HomeScreen(); + }), + ); + }, + ), + selectButton( + text: "Hospital or\nHealthcare Center", + onTap: () { + Navigator.pushReplacement( + context, + MaterialPageRoute(builder: (context) { + return HomeScreen(); + }), + ); + }, + ), + ], + ), + ), + ); + } + + Widget topCarousel({required Size size}) { + return Padding( + padding: EdgeInsets.all(10), + child: CarouselSlider( + options: CarouselOptions( + height: size.height * 0.25, + enableInfiniteScroll: true, + autoPlay: true, + autoPlayInterval: Duration(seconds: 3), + viewportFraction: 1, + ), + items: images.map((image) { + return Builder( + builder: (BuildContext context) { + return Container( + width: size.width, + margin: EdgeInsets.symmetric(horizontal: 7), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(20), + image: DecorationImage( + image: AssetImage(image), + fit: BoxFit.fill, + ), + ), + ); + }, + ); + }).toList(), + ), + ); + } + + Widget selectButton({ + required String text, + required Function onTap, + }) { + return GestureDetector( + onTap: onTap as void Function()?, + child: Container( + margin: EdgeInsets.symmetric(horizontal: 30, vertical: 15), + padding: EdgeInsets.all(15), + decoration: newboxDecoration(), + child: Center( + child: Text( + text, + style: TextStyle( + color: kelectronBlue, + fontSize: 20, + fontWeight: FontWeight.w600, + ), + textAlign: TextAlign.center, + ), + ), + ), + ); + } +} diff --git a/lib/screens/selectoxygen.dart b/lib/screens/selectoxygen.dart new file mode 100644 index 0000000..445d33e --- /dev/null +++ b/lib/screens/selectoxygen.dart @@ -0,0 +1,78 @@ +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/widgets/boxdecoration.dart'; + +class SelectOxygen extends StatelessWidget { + @override + Widget build(BuildContext context) { + 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, + ), + ), + ), + selectOxygenButton( + text: "Add a Source", + onTap: () { + Navigator.push( + context, + MaterialPageRoute(builder: (context) { + return AddOxygenDetails(); + }), + ); + }, + ), + selectOxygenButton( + text: "Avaible Sources", + onTap: () { + Navigator.push( + context, + MaterialPageRoute(builder: (context) { + return ShowOxygenPosts(); + }), + ); + }, + ), + ], + ), + ), + ); + } + + Widget selectOxygenButton({ + required String text, + required Function onTap, + }) { + return GestureDetector( + onTap: onTap as void Function()?, + child: Container( + margin: EdgeInsets.symmetric(horizontal: 30, vertical: 15), + padding: EdgeInsets.all(15), + decoration: newboxDecoration(), + child: Center( + child: Text( + text, + style: TextStyle( + color: kelectronBlue, + fontSize: 20, + fontWeight: FontWeight.w600, + ), + ), + ), + ), + ); + } +} diff --git a/lib/screens/selectplasma.dart b/lib/screens/selectplasma.dart new file mode 100644 index 0000000..0a2813f --- /dev/null +++ b/lib/screens/selectplasma.dart @@ -0,0 +1,76 @@ +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/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, + ), + ), + ), + 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(); + }), + ); + }, + ), + ], + ), + ); + } + + Widget selectPlasmaButton({ + required String text, + required Function onTap, + }) { + return GestureDetector( + onTap: onTap as void Function()?, + child: Container( + margin: EdgeInsets.symmetric(horizontal: 30, vertical: 15), + padding: EdgeInsets.all(15), + decoration: newboxDecoration(), + child: Center( + child: Text( + text, + style: TextStyle( + color: kelectronBlue, + fontSize: 20, + fontWeight: FontWeight.w600, + ), + ), + ), + ), + ); + } +} diff --git a/lib/widgets/logowidget.dart b/lib/widgets/logowidget.dart new file mode 100644 index 0000000..079ab39 --- /dev/null +++ b/lib/widgets/logowidget.dart @@ -0,0 +1,30 @@ +import 'package:flutter/material.dart'; +import 'package:plaso_connect/constants/colors.dart'; + +Widget logoWidget({required Size size}) { + return Container( + margin: EdgeInsets.symmetric(vertical: 30), + height: size.width * 0.35, + width: size.width * 0.35, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(1000), + image: DecorationImage( + image: AssetImage("assets/icons/logo.png"), + fit: BoxFit.fill, + ), + boxShadow: [ + BoxShadow( + color: klightShadowForLight, + offset: Offset(-4.0, -4.0), + blurRadius: 7.0, + ), + BoxShadow( + color: kdarkShadowForLight, + offset: Offset(4.0, 4.0), + blurRadius: 7.0, + ), + ], + color: Color(0xFFEFEEEE), + ), + ); +} diff --git a/pubspec.lock b/pubspec.lock index 821f093..4155791 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -15,6 +15,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.1.0" + carousel_slider: + dependency: "direct main" + description: + name: carousel_slider + url: "https://pub.dartlang.org" + source: hosted + version: "4.0.0-nullsafety.0" characters: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 7f616e0..e12779d 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -30,6 +30,7 @@ dependencies: firebase_core: ^1.1.0 firebase_auth: ^1.1.2 cloud_firestore: ^1.0.7 + carousel_slider: ^4.0.0-nullsafety.0 # The following adds the Cupertino Icons font to your application. # Use with the CupertinoIcons class for iOS style icons. @@ -53,6 +54,7 @@ flutter: # To add assets to your application, add an assets section, like this: assets: - assets/images/ + - assets/icons/ # An image asset can refer to one or more resolution-specific "variants", see # https://flutter.dev/assets-and-images/#resolution-aware.