-turned off autocorrect on relevant textfields

-money input field uses number keyboard - validation still required
-added fadein animation to first menu
-added splash screen (white)  (logo looks better on white)
-added (temporary?) navigation menu
-removed access to navigator from login screen
This commit is contained in:
Felix 2019-07-05 13:39:24 +01:00
parent cad91d5fd4
commit f065e3df6a
11 changed files with 132 additions and 27 deletions

View file

@ -4,9 +4,9 @@
<item android:drawable="@android:color/white" /> <item android:drawable="@android:color/white" />
<!-- You can insert your own image assets here --> <!-- You can insert your own image assets here -->
<item> <!--<item>
<bitmap <bitmap
android:gravity="center" android:gravity="center"
android:src="@mipmap/launch_image" /> android:src="@mipmap/launch_image" />
</item> </item>-->
</layer-list> </layer-list>

Binary file not shown.

After

Width:  |  Height:  |  Size: 131 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 131 KiB

View file

@ -18,17 +18,17 @@ class _BasicDrawerState extends State<BasicDrawer> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Drawer( return Drawer(
child: Container( child: Container(
padding: new EdgeInsets.all(32.0), padding: new EdgeInsets.all(32),
child: ListView( child: ListView(
children: <Widget>[ children: <Widget>[
ListTile( ListTile(
title: Text ( title: Text (
"Home", "Home",
style: TextStyle(color: Colors.black, fontSize: 20.0), style: TextStyle(color: Colors.black, fontSize: 20.0),
), ),
onTap: () { onTap: () {
Navigator.of(context).pushNamed('/HomePage'); Navigator.of(context).pushNamed('/HomePage');
} }
), ),
ListTile( ListTile(
title: Text( title: Text(

View file

@ -5,6 +5,7 @@ import 'package:local_spend/pages/receipt_page.dart';
import 'package:local_spend/pages/spash_screen.dart'; import 'package:local_spend/pages/spash_screen.dart';
import 'package:local_spend/pages/about_screen.dart'; import 'package:local_spend/pages/about_screen.dart';
import 'package:local_spend/config.dart'; import 'package:local_spend/config.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
void main() { void main() {
runApp(MyApp()); runApp(MyApp());
@ -15,6 +16,15 @@ class MyApp extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
//var config = ConfigWrapper.of(context); //var config = ConfigWrapper.of(context);
return new MaterialApp( return new MaterialApp(
localizationsDelegates: [
GlobalMaterialLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,
],
supportedLocales: [
Locale("en")
],
title: "Splash and Token Authentication", title: "Splash and Token Authentication",
theme: new ThemeData( theme: new ThemeData(
primarySwatch: Colors.blueGrey, primarySwatch: Colors.blueGrey,

View file

@ -2,6 +2,10 @@ import 'package:flutter/material.dart';
import 'package:local_spend/common/platform/platform_scaffold.dart'; import 'package:local_spend/common/platform/platform_scaffold.dart';
import 'package:local_spend/common/widgets/basic_drawer.dart'; import 'package:local_spend/common/widgets/basic_drawer.dart';
import 'package:shared_preferences/shared_preferences.dart'; import 'package:shared_preferences/shared_preferences.dart';
import 'package:flutter/services.dart';
import 'package:local_spend/common/apifunctions/request_logout_api.dart';
import 'package:local_spend/common/functions/get_token.dart';
import 'package:flutter_fadein/flutter_fadein.dart';
class HomePage extends StatefulWidget { class HomePage extends StatefulWidget {
@override @override
@ -10,6 +14,7 @@ class HomePage extends StatefulWidget {
class _HomePageState extends State<HomePage> { class _HomePageState extends State<HomePage> {
@override @override
void initState() { void initState() {
super.initState(); super.initState();
_saveCurrentRoute("/HomePage"); _saveCurrentRoute("/HomePage");
@ -25,7 +30,7 @@ class _HomePageState extends State<HomePage> {
return PlatformScaffold( return PlatformScaffold(
appBar: AppBar( appBar: AppBar(
title: Text( title: Text(
"Home Page", "Navigation",
style: TextStyle(color: Colors.black), style: TextStyle(color: Colors.black),
), ),
iconTheme: IconThemeData(color: Colors.black), iconTheme: IconThemeData(color: Colors.black),
@ -33,11 +38,54 @@ class _HomePageState extends State<HomePage> {
), ),
drawer: BasicDrawer(), drawer: BasicDrawer(),
body: Container( body: Container(
padding: EdgeInsets.all(32.0), child: FadeIn(
child: Center( duration: Duration(milliseconds: 500),
curve: Curves.easeIn,
child: Column( child: Column(
children: <Widget>[ children: <Widget>[
Text('This is the Home page'),
ListTile(
contentPadding: EdgeInsets.fromLTRB(0, 15, 0, 0),
title: new Center(
child: new Text(
"Submit Receipt",
style: TextStyle(color: Colors.black, fontSize: 20.0),
textAlign: TextAlign.center,
),
),
onTap: () {
// debugPrint('$token');
Navigator.of(context).pushNamed('/ReceiptPage');
},
),
ListTile(
title: new Center(
child: new Text(
"About",
style: TextStyle(color: Colors.black, fontSize: 20.0),
),
),
onTap: () {
SystemChannels.textInput.invokeMethod('TextInput.hide');
Navigator.of(context).pushReplacementNamed('/AboutPage');
},
),
ListTile(
title: new Center(
child: new Text(
"Logout",
style: TextStyle(color: Colors.black, fontSize: 20.0),
),
),
onTap: () {
requestLogoutAPI(context);
Navigator.of(context).pushReplacementNamed('/LoginPage');
},
),
], ],
), ),
), ),

View file

@ -1,5 +1,4 @@
import 'dart:async'; import 'dart:async';
import 'package:flutter/gestures.dart'; import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
@ -58,7 +57,6 @@ class LoginPageState extends State<LoginPage> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
var drawer = Drawer();
return WillPopScope( return WillPopScope(
onWillPop: () { onWillPop: () {
if (Navigator.canPop(context)) { if (Navigator.canPop(context)) {
@ -69,7 +67,7 @@ class LoginPageState extends State<LoginPage> {
} }
}, },
child: PlatformScaffold( child: PlatformScaffold(
drawer: BasicDrawer(), // drawer: BasicDrawer(),
appBar: AppBar( appBar: AppBar(
title: Text( title: Text(
"LOGIN", "LOGIN",

View file

@ -12,6 +12,7 @@ import 'package:intl/intl.dart';
import 'package:datetime_picker_formfield/datetime_picker_formfield.dart'; import 'package:datetime_picker_formfield/datetime_picker_formfield.dart';
const URL = "https://flutter.io/"; const URL = "https://flutter.io/";
const demonstration = true;
class ReceiptPage extends StatefulWidget { class ReceiptPage extends StatefulWidget {
@override @override
@ -127,12 +128,30 @@ class ReceiptPageState extends State<ReceiptPage> {
decoration: InputDecoration( decoration: InputDecoration(
hintText: 'Value in £', hintText: 'Value in £',
), ),
obscureText: true, // obscureText: true,
autocorrect: false,
keyboardType: TextInputType.number,
style: TextStyle( style: TextStyle(
fontSize: 18.0, fontSize: 18.0,
color: Colors.grey[800], color: Colors.grey[800],
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
onSubmitted: (_) {
SystemChannels.textInput.invokeMethod('TextInput.hide');
if (demonstration)
{
showDialogSingleButton(
context,
"Success",
"Recepit successfully submitted.",
"OK");
}
else {
submitReceiptAPI(context, _amountController.text,
_timeController.text);
}
},
), ),
), ),
Padding( Padding(
@ -142,8 +161,19 @@ class ReceiptPageState extends State<ReceiptPage> {
child: RaisedButton( child: RaisedButton(
onPressed: () { onPressed: () {
SystemChannels.textInput.invokeMethod('TextInput.hide'); SystemChannels.textInput.invokeMethod('TextInput.hide');
submitReceiptAPI(context, _amountController.text,
_timeController.text); if (demonstration)
{
showDialogSingleButton(
context,
"Success",
"Recepit successfully submitted.",
"OK");
}
else {
submitReceiptAPI(context, _amountController.text,
_timeController.text);
}
}, },
child: Text("SUBMIT", child: Text("SUBMIT",
style: style:

View file

@ -32,16 +32,17 @@ class _SplashScreenState extends State<SplashScreen> {
return PlatformScaffold( return PlatformScaffold(
drawer: drawer, drawer: drawer,
body: Container( body: Container(
decoration: BoxDecoration(color: Colors.black), decoration: BoxDecoration(color: Colors.white),
child: Column( child: Column(
children: <Widget>[ children: <Widget>[
Expanded( Expanded(
child: Container( child: Container(
decoration: BoxDecoration(color: Colors.black), margin: EdgeInsets.all(15),
alignment: FractionalOffset(0.5, 0.3), alignment: FractionalOffset(0.5, 0.3),
child: Text( decoration: BoxDecoration(
"Local Loop", image: DecorationImage(
style: TextStyle(fontSize: 40.0, color: Colors.white), image: AssetImage('assets/images/launch_image.png')
),
), ),
), ),
), ),
@ -51,7 +52,7 @@ class _SplashScreenState extends State<SplashScreen> {
"© Copyright Statement 2018", "© Copyright Statement 2018",
style: TextStyle( style: TextStyle(
fontSize: 16.0, fontSize: 16.0,
color: Colors.white, color: Colors.black,
), ),
), ),
), ),

View file

@ -160,6 +160,13 @@ packages:
description: flutter description: flutter
source: sdk source: sdk
version: "0.0.0" version: "0.0.0"
flutter_fadein:
dependency: "direct main"
description:
name: flutter_fadein
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.1"
flutter_linkify: flutter_linkify:
dependency: "direct main" dependency: "direct main"
description: description:
@ -167,6 +174,11 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.1.1" version: "1.1.1"
flutter_localizations:
dependency: "direct main"
description: flutter
source: sdk
version: "0.0.0"
flutter_test: flutter_test:
dependency: "direct dev" dependency: "direct dev"
description: flutter description: flutter

View file

@ -15,12 +15,15 @@ environment:
dependencies: dependencies:
flutter: flutter:
sdk: flutter sdk: flutter
flutter_localizations:
sdk: flutter
shared_preferences: ^0.4.2 shared_preferences: ^0.4.2
url_launcher: ^3.0.3 url_launcher: ^3.0.3
json_annotation : ^2.2.0 json_annotation : ^2.2.0
http: ^0.12.0+2 http: ^0.12.0+2
datetime_picker_formfield: ^0.1.8 datetime_picker_formfield: ^0.1.8
flutter_linkify: ^1.0.3 flutter_linkify: ^1.0.3
flutter_fadein: ^1.1.1
# The following adds the Cupertino Icons font to your application. # The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons. # Use with the CupertinoIcons class for iOS style icons.
@ -48,7 +51,10 @@ flutter:
# assets: # assets:
# - images/a_dot_burr.jpeg # - images/a_dot_burr.jpeg
# - images/a_dot_ham.jpeg # - images/a_dot_ham.jpeg
assets:
- assets/
- assets/images/
- assets/images/launch_image.png
# An image asset can refer to one or more resolution-specific "variants", see # An image asset can refer to one or more resolution-specific "variants", see
# https://flutter.io/assets-and-images/#resolution-aware. # https://flutter.io/assets-and-images/#resolution-aware.