diff --git a/MobileClient/meta.txt b/MobileClient/meta.txt deleted file mode 100644 index 1a01128dd28b911acd199a3945690757fc96bf23..0000000000000000000000000000000000000000 --- a/MobileClient/meta.txt +++ /dev/null @@ -1 +0,0 @@ -Testing branch now mojitha \ No newline at end of file diff --git a/MobileClient/mobile_client/lib/main.dart b/MobileClient/mobile_client/lib/main.dart index 11655b668ba1bae286b1fd31f1234cdec0b46d36..72debba933d75a62d3dee67465048b9555625c08 100644 --- a/MobileClient/mobile_client/lib/main.dart +++ b/MobileClient/mobile_client/lib/main.dart @@ -1,117 +1,18 @@ import 'package:flutter/material.dart'; +import 'package:mobile_client/screens/login.dart'; +import 'screens/login.dart'; void main() { runApp(MyApp()); } class MyApp extends StatelessWidget { - // This widget is the root of your application. @override Widget build(BuildContext context) { return MaterialApp( - title: 'Flutter Demo', - theme: ThemeData( - // This is the theme of your application. - // - // Try running your application with "flutter run". You'll see the - // application has a blue toolbar. Then, without quitting the app, try - // changing the primarySwatch below to Colors.green and then invoke - // "hot reload" (press "r" in the console where you ran "flutter run", - // or simply save your changes to "hot reload" in a Flutter IDE). - // Notice that the counter didn't reset back to zero; the application - // is not restarted. - primarySwatch: Colors.blue, - // This makes the visual density adapt to the platform that you run - // the app on. For desktop platforms, the controls will be smaller and - // closer together (more dense) than on mobile platforms. - visualDensity: VisualDensity.adaptivePlatformDensity, - ), - 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. + theme: ThemeData( + primaryColor: Colors.blue[700], fontFamily: 'Montserrat'), + home: LogInForm() ); } } diff --git a/MobileClient/mobile_client/lib/screens/home.dart b/MobileClient/mobile_client/lib/screens/home.dart new file mode 100644 index 0000000000000000000000000000000000000000..a5fe0d9b043b60866676533859234a2714cdf9e1 --- /dev/null +++ b/MobileClient/mobile_client/lib/screens/home.dart @@ -0,0 +1,39 @@ +import 'package:flutter/material.dart'; + +class FirstRoute extends StatelessWidget { + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text('First Route'), + ), + body: Center( + child: ElevatedButton( + child: Text('Open route'), + onPressed: () { + // Navigate to second route when tapped. + }, + ), + ), + ); + } +} + +class SecondRoute extends StatelessWidget { + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text("Second Route"), + ), + body: Center( + child: ElevatedButton( + onPressed: () { + // Navigate back to first route when tapped. + }, + child: Text('Go back!'), + ), + ), + ); + } +} diff --git a/MobileClient/mobile_client/lib/screens/login.dart b/MobileClient/mobile_client/lib/screens/login.dart new file mode 100644 index 0000000000000000000000000000000000000000..554af48becd4353cc7d2c790b558a036cd648a37 --- /dev/null +++ b/MobileClient/mobile_client/lib/screens/login.dart @@ -0,0 +1,118 @@ +import 'package:flutter/material.dart'; + +// Create a Form widget. +class LogInForm extends StatefulWidget { + @override + LogInFormState createState() { + return LogInFormState(); + } +} + +// Create a corresponding State class. +// This class holds data related to the form. +class LogInFormState extends State { + // Create a global key that uniquely identifies the Form widget + // and allows validation of the form. + final _formKey = GlobalKey(); + + // text inputs + String email = '', password = ''; + + // set initial widget state + @override + void initState() { + super.initState(); + } + + @override + Widget build(BuildContext context) { + // Build a Form widget using the _formKey created above. + return + Scaffold( + resizeToAvoidBottomInset: false, + backgroundColor: Colors.white, + appBar: AppBar( + title: Text('Log In', style: TextStyle(fontSize: 24)), + flexibleSpace: Container( + decoration: new BoxDecoration( + gradient: new LinearGradient( + colors: [ + Colors.black, + Colors.black, + ], + begin: const FractionalOffset(0.0, 0.0), + end: const FractionalOffset(1.0, 0.0), + stops: [0.0, 1.0], + tileMode: TileMode.clamp), + ), + ), + ), + body: Form( + key: _formKey, + child: Center( + heightFactor: 300, + child: Stack(children: [ + SingleChildScrollView( + child: Column(children: [ + Container( + margin: EdgeInsets.fromLTRB(16.0, 8.0, 16.0, 8.0), + child: TextFormField( + textInputAction: TextInputAction.next, + decoration: InputDecoration( + hintText: 'Email', + // helperText: 'max 50 chars.', + contentPadding: EdgeInsets.all(8.0), + border: UnderlineInputBorder(), + filled: true, + fillColor: Colors.white10, + ), + style: TextStyle( + fontWeight: FontWeight.normal, + fontSize: 18, + color: Colors.blueGrey, + ), + onChanged: (value) { + setState(() => email = value); + }, + )), + Container( + margin: EdgeInsets.fromLTRB(16.0, 8.0, 16.0, 8.0), + child: TextFormField( + + textInputAction: TextInputAction.next, + decoration: InputDecoration( + hintText: 'Password', + // helperText: 'max 50 chars.', + contentPadding: EdgeInsets.all(8.0), + border: UnderlineInputBorder(), + filled: true, + fillColor: Colors.white10, + ), + style: TextStyle( + fontWeight: FontWeight.normal, + fontSize: 18, + color: Colors.blueGrey, + ), + onChanged: (value) { + setState(() => password = value); + }, + )), + Container( + margin: EdgeInsets.fromLTRB(16.0, 8.0, 16.0, 8.0), + child: TextButton( + child: Container( + margin: EdgeInsets.all(16.0), + child: Text( + 'Log In', + style: TextStyle(color: Colors.blueGrey, fontSize: 18), + ), + ), + onPressed: () => { }, + )) + ])) + ]) + ), + ) + ); + } +} \ No newline at end of file diff --git a/MobileClient/mobile_client/lib/screens/signUp.dart b/MobileClient/mobile_client/lib/screens/signUp.dart new file mode 100644 index 0000000000000000000000000000000000000000..93cf210f54e5bd7606fe28ba32015a75d3a8750f --- /dev/null +++ b/MobileClient/mobile_client/lib/screens/signUp.dart @@ -0,0 +1,259 @@ +import 'dart:io'; +import 'dart:convert'; +import 'package:flutter/material.dart'; + +// Create a Form widget. +class SignUpForm extends StatefulWidget { + @override + SignUpFormState createState() { + return SignUpFormState(); + } +} + +// Create a corresponding State class. +// This class holds data related to the form. +class SignUpFormState extends State { + // Create a global key that uniquely identifies the Form widget + // and allows validation of the form. + final _formKey = GlobalKey(); + + // picture parameters + Future file; + String status = ''; + String base64Image; + File tmpFile; + String errMessage = 'Error Uploading Image'; + + // text inputs + String picture = '', + firstName = '', + lastName = '', + emailAddress = '', + nICNumber = '', + contactNo = '', + address = ''; + + // set initial widget state + @override + void initState() { + super.initState(); + } + + @override + Widget build(BuildContext context) { + // Build a Form widget using the _formKey created above. + return + Scaffold( + resizeToAvoidBottomInset: false, + backgroundColor: Colors.white, + appBar: AppBar( + title: Text('Sign Up', style: TextStyle(fontSize: 24)), + flexibleSpace: Container( + decoration: new BoxDecoration( + gradient: new LinearGradient( + colors: [ + Colors.black, + Colors.black, + ], + begin: const FractionalOffset(0.0, 0.0), + end: const FractionalOffset(1.0, 0.0), + stops: [0.0, 1.0], + tileMode: TileMode.clamp), + ), + ), + ), + body: + Form( + key: _formKey, + child: Stack(children: [ + SingleChildScrollView( + child: Column(children: [ + Container( + margin: EdgeInsets.fromLTRB(16.0, 32.0, 16.0, 16.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Container( + margin: EdgeInsets.all(8.0), + child: FutureBuilder( + future: file, + builder: (BuildContext context, + AsyncSnapshot snapshot) { + if (snapshot.connectionState == + ConnectionState.done && + null != snapshot.data) { + tmpFile = snapshot.data; + base64Image = + base64Encode(snapshot.data.readAsBytesSync()); + return Flexible( + child: ClipOval( + child: Image.file( + snapshot.data, + fit: BoxFit.fill, + width: 96.0, + height: 96.0, + ), + )); + } else if (null != snapshot.error) { + return const Text( + 'Error Picking Image', + textAlign: TextAlign.center, + ); + } else { + return const CircleAvatar( + backgroundColor: Colors.lightBlueAccent, + minRadius: 48.0, + child: Text('MA', + style: TextStyle(color: Colors.white)), + ); + } + }, + ), + ), + ], + )), + Container( + margin: EdgeInsets.fromLTRB(16.0, 8.0, 16.0, 8.0), + child: TextFormField( + textInputAction: TextInputAction.next, + decoration: InputDecoration( + hintText: 'FirstName', + // helperText: 'max 50 chars.', + contentPadding: EdgeInsets.all(8.0), + border: UnderlineInputBorder(), + filled: true, + fillColor: Colors.white10, + ), + style: TextStyle( + fontWeight: FontWeight.normal, + fontSize: 18, + color: Colors.blueGrey, + ), + onChanged: (value) { + setState(() => firstName = value); + }, + )), + Container( + margin: EdgeInsets.fromLTRB(16.0, 8.0, 16.0, 8.0), + child: TextFormField( + textInputAction: TextInputAction.next, + decoration: InputDecoration( + hintText: 'LastName', + // helperText: 'max 50 chars.', + contentPadding: EdgeInsets.all(8.0), + border: UnderlineInputBorder(), + filled: true, + fillColor: Colors.white, + ), + style: TextStyle( + fontWeight: FontWeight.normal, + fontSize: 18, + color: Colors.blueGrey, + ), + onChanged: (value) { + setState(() => lastName = value); + }, + )), + Container( + margin: EdgeInsets.fromLTRB(16.0, 8.0, 16.0, 8.0), + child: TextFormField( + textInputAction: TextInputAction.next, + decoration: InputDecoration( + hintText: 'Email Address', + // helperText: 'max 30 chars.', + contentPadding: EdgeInsets.all(8.0), + border: UnderlineInputBorder(), + filled: true, + fillColor: Colors.white10, + ), + style: TextStyle( + fontWeight: FontWeight.normal, + fontSize: 18, + color: Colors.blueGrey, + ), + onChanged: (value) { + setState(() => emailAddress = value); + }, + )), + Container( + margin: EdgeInsets.fromLTRB(16.0, 8.0, 16.0, 8.0), + child: TextFormField( + textInputAction: TextInputAction.next, + decoration: InputDecoration( + hintText: 'NIC No.', + // helperText: 'max 30 chars.', + contentPadding: EdgeInsets.all(8.0), + border: UnderlineInputBorder(), + filled: true, + fillColor: Colors.white10, + ), + style: TextStyle( + fontWeight: FontWeight.normal, + fontSize: 18, + color: Colors.blueGrey, + ), + onChanged: (value) { + setState(() => nICNumber = value); + }, + )), + Container( + margin: EdgeInsets.fromLTRB(16.0, 8.0, 16.0, 8.0), + child: TextFormField( + textInputAction: TextInputAction.next, + decoration: InputDecoration( + hintText: 'Contact No.', + // helperText: 'max 10 chars.', + contentPadding: EdgeInsets.all(8.0), + border: UnderlineInputBorder(), + filled: true, + fillColor: Colors.white10, + ), + style: TextStyle( + fontWeight: FontWeight.normal, + fontSize: 18, + color: Colors.blueGrey, + ), + onChanged: (value) { + setState(() => contactNo = value); + }, + )), + Container( + margin: EdgeInsets.fromLTRB(16.0, 8.0, 16.0, 8.0), + child: TextFormField( + maxLines: 4, + decoration: InputDecoration( + hintText: 'Address', + // helperText: 'max 100 chars.', + contentPadding: EdgeInsets.all(8.0), + border: UnderlineInputBorder(), + filled: true, + fillColor: Colors.white10, + ), + style: TextStyle( + fontWeight: FontWeight.normal, + fontSize: 18, + color: Colors.blueGrey, + ), + onChanged: (value) { + setState(() => address = value); + }, + )), + Container( + margin: EdgeInsets.fromLTRB(16.0, 8.0, 16.0, 8.0), + child: TextButton( + child: Container( + margin: EdgeInsets.all(16.0), + child: Text( + 'Sign Up', + style: TextStyle(color: Colors.blueGrey, fontSize: 18), + ), + ), + onPressed: () => { }, + ) + ) + ])) + ]) + ) + ); + } +} \ No newline at end of file diff --git a/MobileClient/mobile_client/pubspec.lock b/MobileClient/mobile_client/pubspec.lock index f628010e7cbba68d8b587162fa392226c6fceb39..86a23f4e1af45dd681da5a99460ccfd48af5ed55 100644 --- a/MobileClient/mobile_client/pubspec.lock +++ b/MobileClient/mobile_client/pubspec.lock @@ -7,42 +7,42 @@ packages: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.5.0-nullsafety.1" + version: "2.5.0" boolean_selector: dependency: transitive description: name: boolean_selector url: "https://pub.dartlang.org" source: hosted - version: "2.1.0-nullsafety.1" + version: "2.1.0" characters: dependency: transitive description: name: characters url: "https://pub.dartlang.org" source: hosted - version: "1.1.0-nullsafety.3" + version: "1.1.0" charcode: dependency: transitive description: name: charcode url: "https://pub.dartlang.org" source: hosted - version: "1.2.0-nullsafety.1" + version: "1.2.0" clock: dependency: transitive description: name: clock url: "https://pub.dartlang.org" source: hosted - version: "1.1.0-nullsafety.1" + version: "1.1.0" collection: dependency: transitive description: name: collection url: "https://pub.dartlang.org" source: hosted - version: "1.15.0-nullsafety.3" + version: "1.15.0" cupertino_icons: dependency: "direct main" description: @@ -56,7 +56,7 @@ packages: name: fake_async url: "https://pub.dartlang.org" source: hosted - version: "1.2.0-nullsafety.1" + version: "1.2.0" flutter: dependency: "direct main" description: flutter @@ -73,21 +73,21 @@ packages: name: matcher url: "https://pub.dartlang.org" source: hosted - version: "0.12.10-nullsafety.1" + version: "0.12.10" meta: dependency: transitive description: name: meta url: "https://pub.dartlang.org" source: hosted - version: "1.3.0-nullsafety.3" + version: "1.3.0" path: dependency: transitive description: name: path url: "https://pub.dartlang.org" source: hosted - version: "1.8.0-nullsafety.1" + version: "1.8.0" sky_engine: dependency: transitive description: flutter @@ -99,55 +99,55 @@ packages: name: source_span url: "https://pub.dartlang.org" source: hosted - version: "1.8.0-nullsafety.2" + version: "1.8.0" stack_trace: dependency: transitive description: name: stack_trace url: "https://pub.dartlang.org" source: hosted - version: "1.10.0-nullsafety.1" + version: "1.10.0" stream_channel: dependency: transitive description: name: stream_channel url: "https://pub.dartlang.org" source: hosted - version: "2.1.0-nullsafety.1" + version: "2.1.0" string_scanner: dependency: transitive description: name: string_scanner url: "https://pub.dartlang.org" source: hosted - version: "1.1.0-nullsafety.1" + version: "1.1.0" term_glyph: dependency: transitive description: name: term_glyph url: "https://pub.dartlang.org" source: hosted - version: "1.2.0-nullsafety.1" + version: "1.2.0" test_api: dependency: transitive description: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.2.19-nullsafety.2" + version: "0.2.19" typed_data: dependency: transitive description: name: typed_data url: "https://pub.dartlang.org" source: hosted - version: "1.3.0-nullsafety.3" + version: "1.3.0" vector_math: dependency: transitive description: name: vector_math url: "https://pub.dartlang.org" source: hosted - version: "2.1.0-nullsafety.3" + version: "2.1.0" sdks: - dart: ">=2.10.0-110 <2.11.0" + dart: ">=2.12.0-0.0 <3.0.0"