diff --git a/assets/images/PElogin.png b/assets/images/PElogin.png new file mode 100644 index 0000000..a18e474 Binary files /dev/null and b/assets/images/PElogin.png differ diff --git a/assets/images/PElogo2.png b/assets/images/PElogo2.png new file mode 100644 index 0000000..67c6979 Binary files /dev/null and b/assets/images/PElogo2.png differ diff --git a/lib/WelcomePage/calenderPic.dart b/lib/WelcomePage/calenderPic.dart new file mode 100644 index 0000000..9164fcb --- /dev/null +++ b/lib/WelcomePage/calenderPic.dart @@ -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, + ); + } +} diff --git a/lib/WelcomePage/circleOverlays.dart b/lib/WelcomePage/circleOverlays.dart new file mode 100644 index 0000000..cc70ad5 --- /dev/null +++ b/lib/WelcomePage/circleOverlays.dart @@ -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, + ); + } +} diff --git a/lib/WelcomePage/pageTitle.dart b/lib/WelcomePage/pageTitle.dart new file mode 100644 index 0000000..9fd5b06 --- /dev/null +++ b/lib/WelcomePage/pageTitle.dart @@ -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), + ], + ), + ); + } +} diff --git a/lib/WelcomePage/signInButtons.dart b/lib/WelcomePage/signInButtons.dart new file mode 100644 index 0000000..338a167 --- /dev/null +++ b/lib/WelcomePage/signInButtons.dart @@ -0,0 +1,56 @@ +import 'package:flutter/material.dart'; + +class BottomSquareWithButton extends StatelessWidget { + @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.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 { + 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), + onTap: () { + //Todo: link it to different page up page + print('hi\n'); + }, + ); + } +} diff --git a/lib/WelcomePage/welcomePage.dart b/lib/WelcomePage/welcomePage.dart new file mode 100644 index 0000000..bdfb644 --- /dev/null +++ b/lib/WelcomePage/welcomePage.dart @@ -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, + ), + ], + ), + ); + } +} diff --git a/lib/main.dart b/lib/main.dart index d8a0526..bea53c2 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; +import './WelcomePage/welcomePage.dart'; void main() { runApp(MyApp()); @@ -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 { - 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: [ - 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: {}, ); } } diff --git a/pubspec.lock b/pubspec.lock index 81c12d9..88f62e5 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -7,21 +7,21 @@ packages: name: archive url: "https://pub.dartlang.org" source: hosted - version: "3.1.2" + version: "2.0.13" args: dependency: transitive description: name: args url: "https://pub.dartlang.org" source: hosted - version: "2.0.0" + version: "1.6.0" async: dependency: transitive description: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.6.1" + version: "2.5.0" boolean_selector: dependency: transitive description: @@ -57,13 +57,27 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.15.0" + convert: + dependency: transitive + description: + name: convert + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.1" + coverage: + dependency: transitive + description: + name: coverage + url: "https://pub.dartlang.org" + source: hosted + version: "0.14.2" crypto: dependency: transitive description: name: crypto url: "https://pub.dartlang.org" source: hosted - version: "3.0.1" + version: "2.1.5" cupertino_icons: dependency: "direct main" description: @@ -78,6 +92,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.2.0" + file: + dependency: transitive + description: + name: file + url: "https://pub.dartlang.org" + source: hosted + version: "5.2.1" flutter: dependency: "direct main" description: flutter @@ -89,19 +110,61 @@ packages: name: flutter_launcher_icons url: "https://pub.dartlang.org" source: hosted - version: "0.9.0" + version: "0.8.1" flutter_test: dependency: "direct dev" description: flutter source: sdk version: "0.0.0" + glob: + dependency: transitive + description: + name: glob + url: "https://pub.dartlang.org" + source: hosted + version: "1.2.0" image: dependency: transitive description: name: image url: "https://pub.dartlang.org" source: hosted - version: "3.0.2" + version: "2.1.19" + intl: + dependency: transitive + description: + name: intl + url: "https://pub.dartlang.org" + source: hosted + version: "0.17.0" + js: + dependency: transitive + description: + name: js + url: "https://pub.dartlang.org" + source: hosted + version: "0.6.3" + json_annotation: + dependency: transitive + description: + name: json_annotation + url: "https://pub.dartlang.org" + source: hosted + version: "3.1.1" + lcov: + dependency: transitive + description: + name: lcov + url: "https://pub.dartlang.org" + source: hosted + version: "5.7.0" + logging: + dependency: transitive + description: + name: logging + url: "https://pub.dartlang.org" + source: hosted + version: "0.11.4" matcher: dependency: transitive description: @@ -116,6 +179,27 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.3.0" + node_interop: + dependency: transitive + description: + name: node_interop + url: "https://pub.dartlang.org" + source: hosted + version: "1.2.1" + node_io: + dependency: transitive + description: + name: node_io + url: "https://pub.dartlang.org" + source: hosted + version: "1.2.0" + package_config: + dependency: transitive + description: + name: package_config + url: "https://pub.dartlang.org" + source: hosted + version: "1.9.3" path: dependency: transitive description: @@ -123,25 +207,39 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.8.0" + pedantic: + dependency: transitive + description: + name: pedantic + url: "https://pub.dartlang.org" + source: hosted + version: "1.11.1" petitparser: dependency: transitive description: name: petitparser url: "https://pub.dartlang.org" source: hosted - version: "4.1.0" + version: "3.1.0" sky_engine: dependency: transitive description: flutter source: sdk version: "0.0.99" + source_maps: + dependency: transitive + description: + name: source_maps + url: "https://pub.dartlang.org" + source: hosted + version: "0.10.10" source_span: dependency: transitive description: name: source_span url: "https://pub.dartlang.org" source: hosted - version: "1.8.1" + version: "1.8.0" stack_trace: dependency: transitive description: @@ -176,7 +274,14 @@ packages: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.3.0" + version: "0.2.19" + test_coverage: + dependency: "direct main" + description: + name: test_coverage + url: "https://pub.dartlang.org" + source: hosted + version: "0.5.0" typed_data: dependency: transitive description: @@ -191,19 +296,26 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.1.0" + vm_service: + dependency: transitive + description: + name: vm_service + url: "https://pub.dartlang.org" + source: hosted + version: "5.5.0" xml: dependency: transitive description: name: xml url: "https://pub.dartlang.org" source: hosted - version: "5.1.2" + version: "4.5.1" yaml: dependency: transitive description: name: yaml url: "https://pub.dartlang.org" source: hosted - version: "3.1.0" + version: "2.2.1" sdks: dart: ">=2.12.0 <3.0.0" diff --git a/pubspec.yaml b/pubspec.yaml index 15a4bfd..51ba706 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -27,7 +27,8 @@ dependencies: # The following adds the Cupertino Icons font to your application. # Use with the CupertinoIcons class for iOS style icons. cupertino_icons: ^1.0.2 - flutter_launcher_icons: ^0.9.0 + flutter_launcher_icons: ^0.8.1 + test_coverage: ^0.5.0 flutter_icons: android: "flutter_icon" @@ -48,6 +49,8 @@ flutter: # included with your application, so that you can use the icons in # the material Icons class. uses-material-design: true + assets: + - assets/images/ # To add assets to your application, add an assets section, like this: # assets: diff --git a/test/WelcomePage/calenderPic_test.dart b/test/WelcomePage/calenderPic_test.dart new file mode 100644 index 0000000..76d8dd9 --- /dev/null +++ b/test/WelcomePage/calenderPic_test.dart @@ -0,0 +1,14 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:poly_events_mobile/WelcomePage/calenderPic.dart'; + +Widget testWidget = + MediaQuery(data: new MediaQueryData(), child: CalenderPic()); +void main() { + group('calender component test', () { + testWidgets('Test that the picture is there', (WidgetTester tester) async { + await tester.pumpWidget(testWidget); + expect(find.byType(Image), findsOneWidget); + }); + }); +} diff --git a/test/WelcomePage/circleOverlays_test.dart b/test/WelcomePage/circleOverlays_test.dart new file mode 100644 index 0000000..5e3760c --- /dev/null +++ b/test/WelcomePage/circleOverlays_test.dart @@ -0,0 +1,25 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:poly_events_mobile/WelcomePage/circleOverlays.dart'; + +Widget testWidget = + MediaQuery(data: new MediaQueryData(), child: CircleOverlays()); +void main() { + group('circle component component test', () { + testWidgets('Test that there is a stack', (WidgetTester tester) async { + await tester.pumpWidget(testWidget); + expect(find.byType(Stack), findsOneWidget); + }); + + testWidgets('Test that there are two images', (WidgetTester tester) async { + await tester.pumpWidget(testWidget); + expect(find.byType(Image), findsNWidgets(2)); + }); + + testWidgets('Test that there are two positioned component', + (WidgetTester tester) async { + await tester.pumpWidget(testWidget); + expect(find.byType(Positioned), findsNWidgets(2)); + }); + }); +} diff --git a/test/WelcomePage/pageTitle_test.dart b/test/WelcomePage/pageTitle_test.dart new file mode 100644 index 0000000..3951e98 --- /dev/null +++ b/test/WelcomePage/pageTitle_test.dart @@ -0,0 +1,25 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:poly_events_mobile/WelcomePage/pageTitle.dart'; + +Widget testWidget = MediaQuery(data: new MediaQueryData(), child: PageTitle()); +void main() { + group('title page component test', () { + testWidgets('Test that the page title exist', (WidgetTester tester) async { + await tester.pumpWidget(testWidget); + expect(find.byType(Column), findsOneWidget); + }); + + testWidgets('Test that there are two text field', + (WidgetTester tester) async { + await tester.pumpWidget(testWidget); + expect(find.byType(Text), findsNWidgets(2)); + }); + + testWidgets('Test that there is one logo image', + (WidgetTester tester) async { + await tester.pumpWidget(testWidget); + expect(find.byType(Image), findsOneWidget); + }); + }); +} diff --git a/test/WelcomePage/signInButtons_test.dart b/test/WelcomePage/signInButtons_test.dart new file mode 100644 index 0000000..1d5a2da --- /dev/null +++ b/test/WelcomePage/signInButtons_test.dart @@ -0,0 +1,33 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:poly_events_mobile/WelcomePage/signInButtons.dart'; + +Widget testWidget = + MediaQuery(data: new MediaQueryData(), child: BottomSquareWithButton()); +void main() { + group('signin component test', () { + testWidgets('Test that the background is here', + (WidgetTester tester) async { + await tester.pumpWidget(testWidget); + expect(find.byType(DecoratedBox), findsOneWidget); + }); + + testWidgets('Test that there are two GestureDetector is here', + (WidgetTester tester) async { + await tester.pumpWidget(testWidget); + expect(find.byType(GestureDetector), findsNWidgets(2)); + }); + + testWidgets('Test that there is a container for the section', + (WidgetTester tester) async { + await tester.pumpWidget(testWidget); + expect(find.byType(Container), findsNWidgets(1)); + }); + + testWidgets('Test that the background has linear gradient', + (WidgetTester tester) async { + await tester.pumpWidget(testWidget); + expect(find.byType(WelcomeButtons), findsNWidgets(2)); + }); + }); +} diff --git a/test/widget_test.dart b/test/widget_test.dart deleted file mode 100644 index 6665455..0000000 --- a/test/widget_test.dart +++ /dev/null @@ -1,30 +0,0 @@ -// This is a basic Flutter widget test. -// -// To perform an interaction with a widget in your test, use the WidgetTester -// utility that Flutter provides. For example, you can send tap and scroll -// gestures. You can also use WidgetTester to find child widgets in the widget -// tree, read text, and verify that the values of widget properties are correct. - -import 'package:flutter/material.dart'; -import 'package:flutter_test/flutter_test.dart'; - -import 'package:poly_events_mobile/main.dart'; - -void main() { - testWidgets('Counter increments smoke test', (WidgetTester tester) async { - // Build our app and trigger a frame. - await tester.pumpWidget(MyApp()); - - // Verify that our counter starts at 0. - expect(find.text('0'), findsOneWidget); - expect(find.text('1'), findsNothing); - - // Tap the '+' icon and trigger a frame. - await tester.tap(find.byIcon(Icons.add)); - await tester.pump(); - - // Verify that our counter has incremented. - expect(find.text('0'), findsNothing); - expect(find.text('1'), findsOneWidget); - }); -}