Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added assets/images/PElogin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/PElogo2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions lib/WelcomePage/calenderPic.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import 'package:flutter/material.dart';

// This class is for the calender picture in the middle of the page
class CalenderPic extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Image(
image: AssetImage('assets/images/PEwelcomeImage.png'),
fit: BoxFit.contain,
height: MediaQuery.of(context).size.height * 0.4,
width: MediaQuery.of(context).size.width * 0.8,
);
}
}
52 changes: 52 additions & 0 deletions lib/WelcomePage/circleOverlays.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import 'package:flutter/material.dart';

class CircleOverlays extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Container(
width: MediaQuery.of(context).size.width,
child: Stack(
textDirection: TextDirection.ltr,
children: [
Positioned(
child: CircleContainer(
assetLocation: 'assets/images/PEcircle2.png',
width: 0.6,
height: 0.33),
left: 0,
),
Positioned(
child: CircleContainer(
assetLocation: 'assets/images/PEcircle1.png',
width: 0.6,
height: 0.216),
right: 0,
)
],
),
);
}
}

// this class is use to hold the circles
class CircleContainer extends StatelessWidget {
final String assetLocation;
final double width;
final double height;

CircleContainer(
{Key key,
@required this.assetLocation,
@required this.width,
@required this.height});

@override
Widget build(BuildContext context) {
return Image(
width: MediaQuery.of(context).size.width * width,
height: MediaQuery.of(context).size.height * height,
image: AssetImage(assetLocation),
fit: BoxFit.contain,
);
}
}
31 changes: 31 additions & 0 deletions lib/WelcomePage/pageTitle.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import 'package:flutter/material.dart';

class PageTitle extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Container(
height: MediaQuery.of(context).size.height * 0.2,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
textDirection: TextDirection.ltr,
children: [
Image(
image: AssetImage('assets/images/PElogo2.png'),
fit: BoxFit.contain,
height: MediaQuery.of(context).size.height * 0.08,
),
Text('Hello!',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 27,
fontFamily: 'Montserrat'),
textDirection: TextDirection.ltr),
Text('Welcome to Poly Event.',
style: TextStyle(fontSize: 20, fontFamily: 'Montserrat'),
textDirection: TextDirection.ltr),
],
),
);
}
}
56 changes: 56 additions & 0 deletions lib/WelcomePage/signInButtons.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import 'package:flutter/material.dart';

class BottomSquareWithButton extends StatelessWidget {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution! I was wondering if there's a better name for this widget. For example, it might be better to call it ButtonContainer.

@override
Widget build(BuildContext context) {
return Container(
height: MediaQuery.of(context).size.height * 0.45,
width: MediaQuery.of(context).size.width,
decoration: BoxDecoration(
//gradient color for the rectangle
gradient: LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
colors: <Color>[
Color.fromARGB(255, 217, 188, 240),
Color.fromARGB(255, 237, 210, 240)
]),
borderRadius: BorderRadius.only(
topLeft: const Radius.circular(25.0),
topRight: const Radius.circular(25.0),
)),
child: Column(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.center,
textDirection: TextDirection.ltr,
children: [
WelcomeButtons(assetLocation: 'assets/images/PEsignup.png'),
WelcomeButtons(assetLocation: 'assets/images/PElogin.png'),
Text('By Poly Team', textDirection: TextDirection.ltr)
],
),
);
}
}

/// Sign up button for the welcome page, use the raised button.
class WelcomeButtons extends StatelessWidget {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution! I'm a bit confused about the naming of this widget. Seems like we are only having one button inside of it, but the name is plural. Would you mind explaining why It's called WelcomeButtons rather than WelcomeButton? 🤔

final String assetLocation;

WelcomeButtons({Key key, @required this.assetLocation});

@override
Widget build(BuildContext context) {
return GestureDetector(
child: Image(
height: MediaQuery.of(context).size.height * 0.1,
width: MediaQuery.of(context).size.width * 0.8,
image: AssetImage(assetLocation),
fit: BoxFit.fitWidth),
Comment on lines +45 to +49
Copy link
Member

@jimmy-lan jimmy-lan Jul 4, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was mentioned on another pull request with @shoko-inori. @shoko-inori Did you find a solution to code this button rather than using an image?

onTap: () {
//Todo: link it to different page up page
print('hi\n');
},
);
}
}
35 changes: 35 additions & 0 deletions lib/WelcomePage/welcomePage.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import 'package:flutter/material.dart';
import 'circleOverlays.dart';
import 'calenderPic.dart';
import 'signInButtons.dart';
import 'pageTitle.dart';

class WelcomePage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
body: Stack(
textDirection: TextDirection.ltr,
children: [
Positioned(
child: CircleOverlays(),
),
Positioned(
child: BottomSquareWithButton(),
bottom: 0,
),
Positioned(
child: CalenderPic(),
bottom: MediaQuery.of(context).size.height * 0.35,
left: MediaQuery.of(context).size.width * 0.1,
),
Positioned(
child: PageTitle(),
left: MediaQuery.of(context).size.width * 0.07,
top: MediaQuery.of(context).size.height * 0.07,
),
],
),
);
}
}
89 changes: 3 additions & 86 deletions lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
import './WelcomePage/welcomePage.dart';

void main() {
runApp(MyApp());
Expand All @@ -22,92 +23,8 @@ class MyApp extends StatelessWidget {
// is not restarted.
primarySwatch: Colors.blue,
),
home: MyHomePage(title: 'Flutter Demo Home Page'),
);
}
}

class MyHomePage extends StatefulWidget {
MyHomePage({Key key, this.title}) : super(key: key);

// This widget is the home page of your application. It is stateful, meaning
// that it has a State object (defined below) that contains fields that affect
// how it looks.

// This class is the configuration for the state. It holds the values (in this
// case the title) provided by the parent (in this case the App widget) and
// used by the build method of the State. Fields in a Widget subclass are
// always marked "final".

final String title;

@override
_MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
int _counter = 0;

void _incrementCounter() {
setState(() {
// This call to setState tells the Flutter framework that something has
// changed in this State, which causes it to rerun the build method below
// so that the display can reflect the updated values. If we changed
// _counter without calling setState(), then the build method would not be
// called again, and so nothing would appear to happen.
_counter++;
});
}

@override
Widget build(BuildContext context) {
// This method is rerun every time setState is called, for instance as done
// by the _incrementCounter method above.
//
// The Flutter framework has been optimized to make rerunning build methods
// fast, so that you can just rebuild anything that needs updating rather
// than having to individually change instances of widgets.
return Scaffold(
appBar: AppBar(
// Here we take the value from the MyHomePage object that was created by
// the App.build method, and use it to set our appbar title.
title: Text(widget.title),
),
body: Center(
// Center is a layout widget. It takes a single child and positions it
// in the middle of the parent.
child: Column(
// Column is also a layout widget. It takes a list of children and
// arranges them vertically. By default, it sizes itself to fit its
// children horizontally, and tries to be as tall as its parent.
//
// Invoke "debug painting" (press "p" in the console, choose the
// "Toggle Debug Paint" action from the Flutter Inspector in Android
// Studio, or the "Toggle Debug Paint" command in Visual Studio Code)
// to see the wireframe for each widget.
//
// Column has various properties to control how it sizes itself and
// how it positions its children. Here we use mainAxisAlignment to
// center the children vertically; the main axis here is the vertical
// axis because Columns are vertical (the cross axis would be
// horizontal).
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text(
'You have pushed the button this many times:',
),
Text(
'$_counter',
style: Theme.of(context).textTheme.headline4,
),
],
),
),
floatingActionButton: FloatingActionButton(
onPressed: _incrementCounter,
tooltip: 'Increment',
child: Icon(Icons.add),
), // This trailing comma makes auto-formatting nicer for build methods.
home: WelcomePage(), // becomes the route named '/'
routes: <String, WidgetBuilder>{},
);
}
}
Loading