diff --git a/assets/graphics/background.jpg b/assets/graphics/background.jpg deleted file mode 100644 index 9be978c..0000000 Binary files a/assets/graphics/background.jpg and /dev/null differ diff --git a/lib/main.dart b/lib/main.dart index f343c10..81393ab 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,10 +1,8 @@ -import 'dart:async'; - import 'package:flutter/material.dart'; import 'package:vikunja_app/global.dart'; import 'package:vikunja_app/pages/home_page.dart'; import 'package:vikunja_app/pages/login_page.dart'; -import 'package:vikunja_app/style.dart'; +import 'package:vikunja_app/theme/theme.dart'; void main() => runApp(VikunjaGlobal( child: new VikunjaApp(home: HomePage()), diff --git a/lib/pages/list_page.dart b/lib/pages/list_page.dart index 4a5a57e..d9ae197 100644 --- a/lib/pages/list_page.dart +++ b/lib/pages/list_page.dart @@ -102,7 +102,7 @@ class _ListPageState extends State { builder: (_) => AddDialog( onAdd: _addItem, decoration: new InputDecoration( - labelText: 'List Item', hintText: 'eg. Milk'))); + labelText: 'Task Name', hintText: 'eg. Milk'))); } _addItem(String name) { diff --git a/lib/pages/login_page.dart b/lib/pages/login_page.dart index 457c64d..4d0673a 100644 --- a/lib/pages/login_page.dart +++ b/lib/pages/login_page.dart @@ -1,6 +1,9 @@ import 'package:flutter/material.dart'; import 'package:vikunja_app/global.dart'; import 'package:vikunja_app/pages/register_page.dart'; +import 'package:vikunja_app/theme/button.dart'; +import 'package:vikunja_app/theme/buttonText.dart'; +import 'package:vikunja_app/theme/constants.dart'; import 'package:vikunja_app/utils/validator.dart'; class LoginPage extends StatefulWidget { @@ -30,7 +33,7 @@ class _LoginPageState extends State { padding: const EdgeInsets.symmetric(horizontal: 16.0), children: [ Padding( - padding: const EdgeInsets.all(8.0), + padding: vStandardVerticalPadding, child: Image( image: AssetImage('assets/vikunja_logo.png'), height: 128.0, @@ -38,37 +41,40 @@ class _LoginPageState extends State { ), ), Padding( - padding: EdgeInsets.all(8.0), + padding: vStandardVerticalPadding, child: TextFormField( onSaved: (serverAddress) => _server = serverAddress, validator: (address) { return isUrl(address) ? null : 'Invalid URL'; }, decoration: new InputDecoration( + border: OutlineInputBorder(), labelText: 'Server Address'), ), ), Padding( - padding: const EdgeInsets.all(8.0), + padding: vStandardVerticalPadding, child: TextFormField( onSaved: (username) => _username = username, decoration: - new InputDecoration(labelText: 'Username'), + new InputDecoration( + border: OutlineInputBorder(), + labelText: 'Username'), ), ), Padding( - padding: const EdgeInsets.all(8.0), + padding: vStandardVerticalPadding, child: TextFormField( onSaved: (password) => _password = password, decoration: - new InputDecoration(labelText: 'Password'), + new InputDecoration( + border: OutlineInputBorder(), + labelText: 'Password'), obscureText: true, ), ), Builder( - builder: (context) => ButtonTheme( - height: _loading ? 55.0 : 36.0, - child: RaisedButton( + builder: (context) => FancyButton( onPressed: !_loading ? () { if (_formKey.currentState @@ -80,21 +86,17 @@ class _LoginPageState extends State { : null, child: _loading ? CircularProgressIndicator() - : Text('Login'), - ))), + : VikunjaButtonText('Login'), + )), Builder( - builder: (context) => ButtonTheme( - height: _loading ? 55.0 : 36.0, - child: RaisedButton( + builder: (context) => FancyButton( onPressed: () => Navigator.push( context, MaterialPageRoute( builder: (context) => RegisterPage())), - child: _loading - ? CircularProgressIndicator() - : Text('Register'), - ))), + child: VikunjaButtonText('Register'), + )), ], )), ), diff --git a/lib/pages/register_page.dart b/lib/pages/register_page.dart index f78b5f7..17a9d49 100644 --- a/lib/pages/register_page.dart +++ b/lib/pages/register_page.dart @@ -1,5 +1,8 @@ import 'package:flutter/material.dart'; import 'package:vikunja_app/global.dart'; +import 'package:vikunja_app/theme/button.dart'; +import 'package:vikunja_app/theme/buttonText.dart'; +import 'package:vikunja_app/theme/constants.dart'; import 'package:vikunja_app/utils/validator.dart'; class RegisterPage extends StatefulWidget { @@ -29,7 +32,7 @@ class _RegisterPageState extends State { padding: const EdgeInsets.symmetric(horizontal: 16.0), children: [ Padding( - padding: const EdgeInsets.all(8.0), + padding: vStandardVerticalPadding, child: Image( image: AssetImage('assets/vikunja_logo.png'), height: 128.0, @@ -37,18 +40,19 @@ class _RegisterPageState extends State { ), ), Padding( - padding: EdgeInsets.all(8.0), + padding: vStandardVerticalPadding, child: TextFormField( onSaved: (serverAddress) => _server = serverAddress, validator: (address) { return isUrl(address) ? null : 'Invalid URL'; }, decoration: new InputDecoration( + border: OutlineInputBorder(), labelText: 'Server Address'), ), ), Padding( - padding: const EdgeInsets.all(8.0), + padding: vStandardVerticalPadding, child: TextFormField( onSaved: (username) => _username = username.trim(), validator: (username) { @@ -56,12 +60,13 @@ class _RegisterPageState extends State { ? null : 'Please specify a username'; }, - decoration: - new InputDecoration(labelText: 'Username'), + decoration: new InputDecoration( + border: OutlineInputBorder(), + labelText: 'Username'), ), ), Padding( - padding: const EdgeInsets.all(8.0), + padding: vStandardVerticalPadding, child: TextFormField( onSaved: (email) => _email = email, validator: (email) { @@ -69,12 +74,13 @@ class _RegisterPageState extends State { ? null : 'Email adress is invalid'; }, - decoration: - new InputDecoration(labelText: 'Email Address'), + decoration: new InputDecoration( + border: OutlineInputBorder(), + labelText: 'Email Address'), ), ), Padding( - padding: const EdgeInsets.all(8.0), + padding: vStandardVerticalPadding, child: TextFormField( controller: passwordController, onSaved: (password) => _password = password, @@ -83,13 +89,14 @@ class _RegisterPageState extends State { ? null : 'Please use at least 8 characters'; }, - decoration: - new InputDecoration(labelText: 'Password'), + decoration: new InputDecoration( + border: OutlineInputBorder(), + labelText: 'Password'), obscureText: true, ), ), Padding( - padding: const EdgeInsets.all(8.0), + padding: vStandardVerticalPadding, child: TextFormField( validator: (password) { return passwordController.text == password @@ -97,14 +104,13 @@ class _RegisterPageState extends State { : 'Passwords don\'t match.'; }, decoration: new InputDecoration( + border: OutlineInputBorder(), labelText: 'Repeat Password'), obscureText: true, ), ), Builder( - builder: (context) => ButtonTheme( - height: _loading ? 55.0 : 36.0, - child: RaisedButton( + builder: (context) => FancyButton( onPressed: !_loading ? () { if (_formKey.currentState @@ -118,8 +124,8 @@ class _RegisterPageState extends State { : null, child: _loading ? CircularProgressIndicator() - : Text('Register'), - ))), + : VikunjaButtonText('Register'), + )), ], )), ), diff --git a/lib/style.dart b/lib/style.dart deleted file mode 100644 index 047173c..0000000 --- a/lib/style.dart +++ /dev/null @@ -1,23 +0,0 @@ -import 'package:flutter/material.dart'; - -const vBlue = Color(0xFF455486); -const vBlueLight = Color(0xFF7480b7); -const vBlueDark = Color(0xFF152c5a); -const vBlack = Color(0xFFFFFFFF); - -ThemeData buildVikunjaTheme() { - var base = ThemeData.light(); - return base.copyWith( - primaryColor: vBlue, - primaryColorLight: vBlueLight, - primaryColorDark: vBlueDark, - textTheme: base.textTheme.copyWith( - headline: base.textTheme.headline.copyWith( - fontFamily: 'Quicksand', - fontSize: 72.0, - ), - title: base.textTheme.title.copyWith( - fontFamily: 'Quicksand', - ), - )); -} diff --git a/lib/theme/button.dart b/lib/theme/button.dart new file mode 100644 index 0000000..a49812b --- /dev/null +++ b/lib/theme/button.dart @@ -0,0 +1,43 @@ +import 'package:flutter/material.dart'; +import 'package:vikunja_app/theme/constants.dart'; + +class FancyButton extends StatelessWidget { + final double width; + final double height; + final Function onPressed; + final Widget child; + + const FancyButton({ + Key key, + @required this.child, + this.width = double.infinity, + this.height = 35, + this.onPressed, + }) : super(key: key); + + @override + Widget build(BuildContext context) { + return Padding( + padding: vStandardVerticalPadding, + child: Container( + width: width, + height: height, + decoration: BoxDecoration(boxShadow: [ + BoxShadow( + color: vButtonShadow, + offset: Offset(-5, 5), + blurRadius: 10, + ), + ]), + child: Material( + borderRadius: BorderRadius.circular(3), + color: vButtonColor, + child: InkWell( + onTap: onPressed, + child: Center( + child: child, + )), + ), + )); + } +} diff --git a/lib/theme/buttonText.dart b/lib/theme/buttonText.dart new file mode 100644 index 0000000..c8010c5 --- /dev/null +++ b/lib/theme/buttonText.dart @@ -0,0 +1,19 @@ +import 'package:flutter/material.dart'; +import 'package:vikunja_app/theme/constants.dart'; + +class VikunjaButtonText extends StatelessWidget { + final String text; + + const VikunjaButtonText( + this.text, { + Key key, + }) : super(key: key); + + @override + Widget build(BuildContext context) { + return Text( + text, + style: TextStyle(color: vButtonTextColor, fontWeight: FontWeight.w600), + ); + } +} diff --git a/lib/theme/constants.dart b/lib/theme/constants.dart new file mode 100644 index 0000000..8272190 --- /dev/null +++ b/lib/theme/constants.dart @@ -0,0 +1,25 @@ +import 'package:flutter/material.dart'; + +///////// +// Colors +////// +const vBlue = Color(0xFF7F23FF); +const vBlueLight = Color(0xFF7480b7); +const vBlueDark = Color(0xFF152c5a); +const vPrimary = Color(0xFF0c86ff); +const vPrimaryDark = Color(0xFF1A73E8); +const vRed = Color(0xFFff4136); +const vOrange = Color(0xFFff851b); +const vWhite = Color(0xFFffffff); +const vGreen = Color(0xFF00CE6E); + +const vButtonColor = vPrimary; +const vButtonTextColor = vWhite; +const vButtonShadow = Color(0xFFb2d9ff); + +/////////// +// Paddings +//////// +const vStandardVerticalPadding = EdgeInsets.symmetric(vertical: 5.0); +const vStandardHorizontalPadding = EdgeInsets.symmetric(horizontal: 5.0); +const vStandardPadding = EdgeInsets.symmetric(horizontal: 5.0, vertical: 5.0); diff --git a/lib/theme/fancyAppBar.dart b/lib/theme/fancyAppBar.dart new file mode 100644 index 0000000..2c241e7 --- /dev/null +++ b/lib/theme/fancyAppBar.dart @@ -0,0 +1,37 @@ +import 'package:flutter/material.dart'; + +class FancyAppBar extends StatelessWidget { + final String title; + final double barHeight = 80.0; + + FancyAppBar(this.title); + + @override + Widget build(BuildContext context) { + return new Container( + height: barHeight, + width: double.infinity, + decoration: new BoxDecoration(color: Colors.blue), + child: new Padding( + padding: EdgeInsets.symmetric(vertical: 38, horizontal: 10), + child: new Text(title, + style: const TextStyle( + color: Colors.white, + fontWeight: FontWeight.w600, + fontFamily: 'Quicksand', + fontSize: 21)), + ), + ); + } +} + +/* +Usage: +return new Scaffold( + body: new Column( + children: [ + new FancyAppBar('Login to Vikunja'), + ], + ), + ); + */ diff --git a/lib/theme/theme.dart b/lib/theme/theme.dart new file mode 100644 index 0000000..55ba656 --- /dev/null +++ b/lib/theme/theme.dart @@ -0,0 +1,34 @@ +import 'package:flutter/material.dart'; +import 'package:vikunja_app/theme/constants.dart'; + +ThemeData buildVikunjaTheme() { + var base = ThemeData.light(); + return base.copyWith( + errorColor: vRed, + primaryColor: vPrimaryDark, + primaryColorLight: vPrimary, + primaryColorDark: vBlueDark, + buttonTheme: base.buttonTheme.copyWith( + buttonColor: vPrimary, + textTheme: ButtonTextTheme.normal, + colorScheme: base.buttonTheme.colorScheme.copyWith( + // Why does this not work? + onSurface: vWhite, + onSecondary: vWhite, + background: vBlue, + ), + ), + textTheme: base.textTheme.copyWith( + headline: base.textTheme.headline.copyWith( + fontFamily: 'Quicksand', + ), + title: base.textTheme.title.copyWith( + fontFamily: 'Quicksand', + ), + button: base.textTheme.button.copyWith( + color: + vWhite, // This does not work, looks like a bug in Flutter: https://github.com/flutter/flutter/issues/19623 + ), + ), + ); +} diff --git a/pubspec.yaml b/pubspec.yaml index b6f5b97..8774e4b 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -32,7 +32,6 @@ flutter_icons: flutter: uses-material-design: true assets: - - assets/graphics/background.jpg - assets/graphics/hypnotize.png - assets/vikunja_logo.png fonts: