Skip to content

Commit

Permalink
Added LandingScreen
Browse files Browse the repository at this point in the history
  • Loading branch information
niloysikdar committed May 2, 2021
1 parent b1a536a commit f562079
Show file tree
Hide file tree
Showing 4 changed files with 131 additions and 2 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/homescreen.dart';
import 'package:plaso_connect/screens/landingScreen.dart';

Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();
Expand All @@ -30,7 +30,7 @@ class MyApp extends StatelessWidget {
primaryColor: kelectronBlue,
iconTheme: IconThemeData(color: kelectronBlue),
),
home: HomeScreen(),
home: LandingScreen(),
);
}
}
121 changes: 121 additions & 0 deletions lib/screens/landingScreen.dart
Original file line number Diff line number Diff line change
@@ -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,
),
),
),
);
}
}
7 changes: 7 additions & 0 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
1 change: 1 addition & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit f562079

Please sign in to comment.