From cf6753363c10ceda915b8252da81084a10e2e5ef Mon Sep 17 00:00:00 2001 From: Felix Date: Wed, 21 Aug 2019 10:16:46 +0100 Subject: [PATCH] lots of UI and some improvements to logic --- .idea/codeStyles/Project.xml | 116 ++++++++++++++++++ lib/common/functions/customAbout.dart | 6 +- .../widgets/animatedGradientButton.dart | 4 +- lib/common/widgets/organisations_dialog.dart | 22 ++-- lib/pages/login_page.dart | 4 +- lib/pages/more_page.dart | 71 ++++++++--- lib/pages/receipt_page_2.dart | 26 ++-- 7 files changed, 201 insertions(+), 48 deletions(-) create mode 100644 .idea/codeStyles/Project.xml diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml new file mode 100644 index 0000000..681f41a --- /dev/null +++ b/.idea/codeStyles/Project.xml @@ -0,0 +1,116 @@ + + + + + + + +
+ + + + xmlns:android + + ^$ + + + +
+
+ + + + xmlns:.* + + ^$ + + + BY_NAME + +
+
+ + + + .*:id + + http://schemas.android.com/apk/res/android + + + +
+
+ + + + .*:name + + http://schemas.android.com/apk/res/android + + + +
+
+ + + + name + + ^$ + + + +
+
+ + + + style + + ^$ + + + +
+
+ + + + .* + + ^$ + + + BY_NAME + +
+
+ + + + .* + + http://schemas.android.com/apk/res/android + + + ANDROID_ATTRIBUTE_ORDER + +
+
+ + + + .* + + .* + + + BY_NAME + +
+
+
+
+
+
\ No newline at end of file diff --git a/lib/common/functions/customAbout.dart b/lib/common/functions/customAbout.dart index 28f8732..20c3c83 100644 --- a/lib/common/functions/customAbout.dart +++ b/lib/common/functions/customAbout.dart @@ -264,9 +264,13 @@ class AboutDialog extends StatelessWidget { body.add(Expanded( child: Padding( padding: const EdgeInsets.symmetric(horizontal: 24.0), + child: ListBody( children: [ - Text(name, style: Theme.of(context).textTheme.title), + Container( + padding: EdgeInsets.only(top: 10), + child: Text(name, style: Theme.of(context).textTheme.title), + ), Text(version, style: Theme.of(context).textTheme.body1), Text(applicationLegalese ?? '', style: Theme.of(context).textTheme.caption), ], diff --git a/lib/common/widgets/animatedGradientButton.dart b/lib/common/widgets/animatedGradientButton.dart index 6880eb9..9814ac8 100644 --- a/lib/common/widgets/animatedGradientButton.dart +++ b/lib/common/widgets/animatedGradientButton.dart @@ -5,18 +5,20 @@ class AnimatedBackground extends StatelessWidget { final List animateColors; final Color lastColor; final Alignment begin, end; + final int duration; AnimatedBackground( this.animateColors, this.lastColor, this.begin, this.end, + this.duration, ); @override Widget build(BuildContext context) { final tween = MultiTrackTween([ - Track("color1").add(Duration(seconds: 4), + Track("color1").add(Duration(seconds: this.duration), ColorTween(begin: this.animateColors[0], end: this.animateColors[1])), ]); diff --git a/lib/common/widgets/organisations_dialog.dart b/lib/common/widgets/organisations_dialog.dart index 32a69eb..2c921aa 100644 --- a/lib/common/widgets/organisations_dialog.dart +++ b/lib/common/widgets/organisations_dialog.dart @@ -82,7 +82,6 @@ class FindOrganisations { } Future dialog(context) { - var focusNode = new FocusNode(); bool _searchEnabled = false; bool _orgsFetched = false; @@ -106,15 +105,10 @@ class FindOrganisations { barrierDismissible: true, builder: (BuildContext context) { - FocusScope.of(context).requestFocus(focusNode); return StatefulBuilder( builder: (context, setState) { - return -// AnimatedContainer( -// duration: Duration(seconds: 1), -// child : - SimpleDialog( + return SimpleDialog( children: [ Column( children: [ @@ -126,7 +120,7 @@ class FindOrganisations { width: 150, height: 50, child: TextField( - focusNode: focusNode, + autofocus: true, controller: searchBarText, decoration: InputDecoration( hintText: "Payee Name", @@ -157,13 +151,13 @@ class FindOrganisations { child: RaisedButton( onPressed: _searchEnabled ? (() { - SystemChannels.textInput.invokeMethod('TextInput.hide'); - var result = _submitSearch(searchBarText.text); - result.then((_) { - setState(() { - _orgsFetched = true; - }); + SystemChannels.textInput.invokeMethod('TextInput.hide'); + var result = _submitSearch(searchBarText.text); + result.then((_) { + setState(() { + _orgsFetched = true; }); + }); }) : null, child: Icon(Icons.search, color: Colors.white), diff --git a/lib/pages/login_page.dart b/lib/pages/login_page.dart index e05ea28..84f831d 100644 --- a/lib/pages/login_page.dart +++ b/lib/pages/login_page.dart @@ -104,7 +104,7 @@ class LoginPageState extends State { child: PlatformScaffold( body: Stack( children: [ - AnimatedBackground([Colors.blue[50], Colors.lightBlue[50]], Colors.white, Alignment.topRight, Alignment.bottomLeft), + AnimatedBackground([Colors.lightBlue[50], Colors.lightBlue[50]], Colors.white, Alignment.topRight, Alignment.bottomLeft, 3), Container( margin: EdgeInsets.fromLTRB(60,30,60,0), @@ -175,7 +175,7 @@ class LoginPageState extends State { borderRadius: BorderRadius.circular(2), child : Stack( children : [ - AnimatedBackground([Colors.blue, Colors.lightBlue[300]], Colors.lightBlue, Alignment.topRight, Alignment.bottomLeft), + AnimatedBackground([Colors.blue, Colors.lightBlue[300]], Colors.lightBlue, Alignment.bottomRight, Alignment.topLeft, 3), Material( type: MaterialType.transparency, child : InkWell( diff --git a/lib/pages/more_page.dart b/lib/pages/more_page.dart index ae9405b..f467213 100644 --- a/lib/pages/more_page.dart +++ b/lib/pages/more_page.dart @@ -70,12 +70,11 @@ class MorePageState extends State { ), body: Container( - padding: EdgeInsets.fromLTRB(30.0, 0.0, 30.0, 0.0), child: ListView( children: [ Container( - padding: EdgeInsets.fromLTRB(0.0,25,0.0,0.0), + padding: EdgeInsets.fromLTRB(30.0,25,30.0,0.0), child : Text( "Local Spend Tracker", textAlign: TextAlign.center, @@ -88,7 +87,7 @@ class MorePageState extends State { ), Padding( - padding: EdgeInsets.fromLTRB(0.0, 25.0, 0.0, 0.0), + padding: EdgeInsets.fromLTRB(30.0, 25.0, 30.0, 0.0), child: Container( height: 65.0, child: RaisedButton( @@ -98,22 +97,56 @@ class MorePageState extends State { context: context, applicationIcon: new Icon(Icons.receipt), applicationName: "Local Spend Tracker", - children: [ - Text("Pear Trading is a commerce company designed to register and monitor money circulating in the local economy."), - Text("\nContact at test@example.com or +44 01524 64544"), - - Padding( - padding: EdgeInsets.fromLTRB(0,20,0,0), - child: InkWell( - child: Text - ('Developed by Shadowcat Systems', - style: TextStyle( - color: Colors.blue, - ), - ), - onTap: () => launch('https://shadow.cat/') + children: + [ + Text("Pear Trading is a commerce company designed to register and monitor money circulating in the local economy.\n"), + Container( + padding: EdgeInsets.symmetric(horizontal: 10), + height: 35, + child: RaisedButton( + onPressed: () => {}, + child: Text("Contact us", + style: + TextStyle(color: Colors.white, fontSize: 18.0)), + color: Colors.green, ), ), + + Container( + height: 35, + margin: EdgeInsets.fromLTRB(10, 20, 10, 0), + child: RaisedButton( + child: Text + ('Pear Trading', + style: TextStyle( + color: Colors.white, + fontSize: 18.0 + ), + ), + color: Colors.lightGreen, + onPressed: () => launch('http://www.peartrade.org') + ), + ), + + Container( + height: 35, + margin: EdgeInsets.fromLTRB(10, 20, 10, 0), + child: Material( + child: OutlineButton( + child: Text + ('Shadowcat Systems', + style: TextStyle( + color: Colors.black, + fontSize: 18.0 /// I don't know what to do with this button + ), + ), + onPressed: () => launch('https://shadow.cat/'), + ), + color: Colors.lightGreenAccent, + shadowColor: Colors.transparent, + ), + ), + ], ); @@ -127,7 +160,7 @@ class MorePageState extends State { ), Padding( - padding: EdgeInsets.fromLTRB(0.0, 20.0, 0.0, 0.0), + padding: EdgeInsets.fromLTRB(30.0, 20.0, 30.0, 0.0), child: Container( height: 65.0, child: RaisedButton( @@ -150,7 +183,7 @@ class MorePageState extends State { ), // Padding( -// padding: EdgeInsets.fromLTRB(0.0, 20.0, 0.0, 0.0), +// padding: EdgeInsets.fromLTRB(30.0, 20.0, 30.0, 0.0), // child: Container( // height: 65.0, // child: RaisedButton( diff --git a/lib/pages/receipt_page_2.dart b/lib/pages/receipt_page_2.dart index c1381c9..526c33b 100644 --- a/lib/pages/receipt_page_2.dart +++ b/lib/pages/receipt_page_2.dart @@ -98,6 +98,10 @@ class ReceiptPage2State extends State { @override Widget build(BuildContext context) { + var _widgetHeight = MediaQuery.of(context).size.height * 0.06 < 40.0 ? 40.0 : MediaQuery.of(context).size.height * 0.06; + + debugPrint(_widgetHeight.toString()); + if (_categories.length == 0) { Future> _futureCats = getCats(); _categories.add("Fetching categories..."); @@ -136,7 +140,7 @@ class ReceiptPage2State extends State { // doesn't fit the screen properly and looks weird Container( - padding: const EdgeInsets.fromLTRB(15, 17, 0, 0), + padding: EdgeInsets.fromLTRB(MediaQuery.of(context).size.width * 0.025,MediaQuery.of(context).size.height * 0.025,0,0.0), child : Text( "Receipt Details", style: TextStyle( @@ -167,7 +171,7 @@ class ReceiptPage2State extends State { Container( padding: const EdgeInsets.fromLTRB(0, 0, 0, 0), - height: 40.0, + height: _widgetHeight, width: MediaQuery.of(context).size.width * 0.6, child: RaisedButton( onPressed: () { @@ -232,7 +236,7 @@ class ReceiptPage2State extends State { Container( padding: const EdgeInsets.fromLTRB(0, 0, 0, 0), - height: 40.0, + height: _widgetHeight, width: MediaQuery.of(context).size.width * 0.6, child: RaisedButton( onPressed: () { @@ -269,7 +273,7 @@ class ReceiptPage2State extends State { Container( padding: EdgeInsets.fromLTRB(MediaQuery.of(context).size.width * 0.05,15,MediaQuery.of(context).size.width * 0.05,0.0), child: Tooltip( - message: "Transaction recrudescence", + message: "Repeating?", child: Row( children: [ Container( @@ -286,7 +290,7 @@ class ReceiptPage2State extends State { Container( padding: const EdgeInsets.fromLTRB(0, 0, 0, 0), - height: 40.0, + height: _widgetHeight, width: MediaQuery.of(context).size.width * 0.6, child: RaisedButton( onPressed: () { @@ -343,7 +347,7 @@ class ReceiptPage2State extends State { Container( padding: const EdgeInsets.fromLTRB(0, 0, 0, 0), - height: 40.0, + height: _widgetHeight, width: MediaQuery.of(context).size.width * 0.6, child: Tooltip( message: "Category of transaction", @@ -402,7 +406,7 @@ class ReceiptPage2State extends State { ), Container( - height: 40.0, + height: _widgetHeight, width: MediaQuery.of(context).size.width * 0.6, child: Checkbox( value: transaction.isEssential, @@ -437,7 +441,7 @@ class ReceiptPage2State extends State { Container( padding: const EdgeInsets.fromLTRB(0, 0, 0, 0), - height: 40.0, + height: _widgetHeight, width: MediaQuery.of(context).size.width * 0.6, child: TextField( style: TextStyle( @@ -457,18 +461,18 @@ class ReceiptPage2State extends State { ), // Amount picker Padding( - padding: EdgeInsets.fromLTRB(MediaQuery.of(context).size.width * 0.05,15,MediaQuery.of(context).size.width * 0.05,0.0), + padding: EdgeInsets.fromLTRB(MediaQuery.of(context).size.width * 0.05,MediaQuery.of(context).size.height * 0.03,MediaQuery.of(context).size.width * 0.05,15.0), child: Tooltip( message: "Submit receipt", child: Container( - height: 75.0, + height: _widgetHeight * 1.7, child: ClipRRect( borderRadius: BorderRadius.circular(2), child: Opacity( opacity: 1, child: Stack( children: [ - AnimatedBackground([Colors.blue, Colors.lightBlue[300]], Colors.lightBlue, Alignment.topLeft, Alignment.bottomRight), + AnimatedBackground([Colors.blue, Colors.lightBlue[300]], Colors.lightBlue, Alignment.topLeft, Alignment.bottomRight, 4), Material( type: MaterialType.transparency, child: InkWell(