diff --git a/lang/en.yml b/lang/en.yml index df29e2b..de173bd 100644 --- a/lang/en.yml +++ b/lang/en.yml @@ -1,5 +1,21 @@ home: emptyList: Add an expense to begin +login: + title: Spend-o-meter + subtitle: Your personal finance app + notice: + line1: "To use this app you need to agree to our " + line2: "Terms of Service" + line3: " and " + line4: "Privacy Policy" + help: + terms: > + This service is provided AS IS and has no current warranty on how the + data and uptime is managed. The final terms will be released when the final version of the app + will be released. + privacy: > + All your data is saved anonymously on Firebase Firestore database and will be remain that way. + no other users will have access to it. add: category: Category today: Today diff --git a/lang/es.yml b/lang/es.yml index 0e5247a..9fdb162 100644 --- a/lang/es.yml +++ b/lang/es.yml @@ -1,5 +1,21 @@ home: emptyList: Agregue un gasto para comenzar +login: + title: Spend-o-meter + subtitle: Tu app de finanzas personales + notice: + line1: "Al usar esta aplicación estás aceptando nuestros " + line2: "Términos de servicio" + line3: " y " + line4: "Política de privacidad" + help: + terms: > + Este servicio se provee "COMO VIENE" y no se da garantía en cómo se manejan + los datos y la disponibillildad del servicio. Los términos y condiciones finales + serán publicados cuando la app se ponga en producción. + privacy: > + Todos tus datos serán guardados anónimamente en Firebase Firestore y permanecerán de esa manera. + Ningún otro usuario tendrá acceso a tus datos. add: category: Categoría today: Hoy diff --git a/lib/others/graph_widget.dart b/lib/others/graph_widget.dart index e421efa..b1637af 100644 --- a/lib/others/graph_widget.dart +++ b/lib/others/graph_widget.dart @@ -70,7 +70,7 @@ class _LinesGraphWidgetState extends State { List> series = [ Series( id: 'Gasto', - colorFn: (_, __) => MaterialPalette.blue.shadeDefault, + colorFn: (_, __) => MaterialPalette.purple.shadeDefault, domainFn: (value, index) => index, measureFn: (value, _) => value, data: widget.data, diff --git a/lib/others/month_widget.dart b/lib/others/month_widget.dart index f49631a..406ec14 100644 --- a/lib/others/month_widget.dart +++ b/lib/others/month_widget.dart @@ -122,14 +122,14 @@ class _MonthWidgetState extends State { ), trailing: Container( decoration: BoxDecoration( - color: Colors.blueAccent.withOpacity(0.2), + color: Theme.of(context).primaryColor.withOpacity(0.2), borderRadius: BorderRadius.circular(5.0), ), child: Padding( padding: const EdgeInsets.all(8.0), child: Text("\$$value", style: TextStyle( - color: Colors.blueAccent, + color: Theme.of(context).primaryColor, fontWeight: FontWeight.w500, fontSize: 16.0, ), diff --git a/lib/pages/add_page.dart b/lib/pages/add_page.dart index 0810fcb..646dc5b 100644 --- a/lib/pages/add_page.dart +++ b/lib/pages/add_page.dart @@ -8,6 +8,7 @@ import 'package:image_picker/image_picker.dart'; import 'package:provider/provider.dart'; import 'package:local_auth/local_auth.dart'; import 'package:yaml/yaml.dart'; +import 'dart:io' show Platform; import '../como_gasto_icons.dart'; import '../expenses_repository.dart'; @@ -29,7 +30,7 @@ class _AddPageState extends State with SingleTickerProviderStateMixin { String category; int value = 0; - String dateStr = null; + String dateStr; DateTime date = DateTime.now(); File _selectedPicture; @@ -42,9 +43,12 @@ class _AddPageState extends State with SingleTickerProviderStateMixin { super.initState(); _localAth = LocalAuthentication(); - _localAth.canCheckBiometrics.then((b) { + _localAth.canCheckBiometrics.then((b) async { + var methods = await _localAth.getAvailableBiometrics(); + var hasFingerprint = Platform.isIOS ? methods.any((m) => m == BiometricType.fingerprint) : true; + setState(() { - _isBiometricAvailable = b; + _isBiometricAvailable = b && hasFingerprint; }); }); @@ -193,7 +197,7 @@ class _AddPageState extends State with SingleTickerProviderStateMixin { "${localizations.t('add.currency')}${realValue.toStringAsFixed(2)}", style: TextStyle( fontSize: 50.0, - color: Colors.blueAccent, + color: Theme.of(context).textTheme.title.color, fontWeight: FontWeight.w500, ), ), diff --git a/lib/pages/details_page_container.dart b/lib/pages/details_page_container.dart index d1a0092..2d0698d 100644 --- a/lib/pages/details_page_container.dart +++ b/lib/pages/details_page_container.dart @@ -12,41 +12,33 @@ class DetailsParams { DetailsParams(this.categoryName, this.month); } -class DetailsPageContainer extends StatefulWidget { +class DetailsPageContainer extends StatelessWidget { final DetailsParams params; const DetailsPageContainer({Key key, this.params}) : super(key: key); - @override - _DetailsPageContainerState createState() => _DetailsPageContainerState(); -} - -class _DetailsPageContainerState extends State { @override Widget build(BuildContext context) { - return Consumer( - builder: (BuildContext context, ExpensesRepository db, Widget child) { - var _query = db.queryByCategory( - widget.params.month + 1, widget.params.categoryName); + final db = Provider.of(context); + final query = db.queryByCategory(params.month + 1, params.categoryName); - return StreamBuilder( - stream: _query, - builder: (BuildContext context, AsyncSnapshot data) { - if (data.hasData) { - return DetailsPage( - categoryName: widget.params.categoryName, - documents: data.data.documents, - onDelete: (documentId) { - db.delete(documentId); - }, - ); - } + return StreamBuilder( + stream: query, + builder: (BuildContext context, AsyncSnapshot data) { + if (data.hasData) { + return DetailsPage( + categoryName: params.categoryName, + documents: data.data.documents, + onDelete: (documentId) { + db.delete(documentId); + }, + ); + } - return Center( - child: CircularProgressIndicator(), - ); - }); + return Center( + child: CircularProgressIndicator(), + ); }, ); } -} \ No newline at end of file +} diff --git a/lib/pages/login_page.dart b/lib/pages/login_page.dart index 66ed99d..e03f31a 100644 --- a/lib/pages/login_page.dart +++ b/lib/pages/login_page.dart @@ -1,3 +1,4 @@ +import 'package:como_gasto/como_gasto_localizations.dart'; import 'package:flare_flutter/flare_actor.dart'; import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; @@ -17,6 +18,8 @@ class _LoginPageState extends State { @override Widget build(BuildContext context) { + ComoGastoLocalizations localizations = ComoGastoLocalizations.of(context); + return Scaffold( body: SafeArea( child: Column( @@ -26,7 +29,7 @@ class _LoginPageState extends State { child: Container(), ), Text( - "Spend-o-meter", + localizations.t('login.title'), style: Theme.of(context).textTheme.display1, ), Padding( @@ -40,7 +43,7 @@ class _LoginPageState extends State { ), ), Text( - "Your personal finance app", + localizations.t('login.subtitle'), style: Theme.of(context).textTheme.caption, ), Expanded( @@ -94,19 +97,19 @@ class _LoginPageState extends State { textAlign: TextAlign.center, text: TextSpan( style: Theme.of(context).textTheme.body1, - text: "To use this app you need to agree to our ", + text: localizations.t('login.notice.line1'), children: [ TextSpan( - text: "Terms of Service", + text: localizations.t('login.notice.line2'), recognizer: _recognizer1, style: Theme.of(context) .textTheme .body1 .copyWith(fontWeight: FontWeight.bold), ), - TextSpan(text: " and "), + TextSpan(text: localizations.t('login.notice.line3')), TextSpan( - text: "Privacy Policy", + text: localizations.t('login.notice.line4'), recognizer: _recognizer2, style: Theme.of(context) .textTheme @@ -128,16 +131,11 @@ class _LoginPageState extends State { _recognizer1 = TapGestureRecognizer() ..onTap = () { - showHelp( - "This service is provided AS IS and has no current warranty on how the" - " data and uptime is managed. The final terms will be released when the final version of the app" - " will be released."); + showHelp(_getTranslatedString('login.help.terms')); }; _recognizer2 = TapGestureRecognizer() ..onTap = () { - showHelp( - "All your data is saved anonymously on Firebase Firestore database and will be remain that way." - " no other users will have access to it."); + showHelp(_getTranslatedString('login.help.privacy')); }; } @@ -148,6 +146,10 @@ class _LoginPageState extends State { _recognizer2.dispose(); } + String _getTranslatedString(String key) { + return ComoGastoLocalizations.of(context).t(key); + } + void showHelp(String s) { showDialog( context: context, diff --git a/lib/pages/settings_page.dart b/lib/pages/settings_page.dart index 8eb323e..24f0fd3 100644 --- a/lib/pages/settings_page.dart +++ b/lib/pages/settings_page.dart @@ -1,4 +1,5 @@ import 'package:como_gasto/como_gasto_localizations.dart'; +import 'package:como_gasto/states/login_state.dart'; import 'package:como_gasto/states/theme_state.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; @@ -41,7 +42,8 @@ class SettingsPage extends StatelessWidget { width: double.infinity, child: RaisedButton( onPressed: () { - //Provider.of(context).logout(); + Provider.of(context).logout(); + Navigator.of(context).pop(); }, child: Text(localizations.t('settings.signout')), ), diff --git a/lib/pages/ui/day_expense_list_tile.dart b/lib/pages/ui/day_expense_list_tile.dart index b7e1e1f..c85f591 100644 --- a/lib/pages/ui/day_expense_list_tile.dart +++ b/lib/pages/ui/day_expense_list_tile.dart @@ -31,7 +31,7 @@ class DayExpenseListTile extends StatelessWidget { ), title: Container( decoration: BoxDecoration( - color: Colors.blueAccent.withOpacity(0.2), + color: Theme.of(context).primaryColor.withOpacity(0.2), borderRadius: BorderRadius.circular(5.0), ), child: Padding( @@ -39,7 +39,7 @@ class DayExpenseListTile extends StatelessWidget { child: Text( "\$${document["value"]}", style: TextStyle( - color: Colors.blueAccent, + color: Theme.of(context).primaryColor, fontWeight: FontWeight.w500, fontSize: 16.0, ), diff --git a/lib/states/theme_state.dart b/lib/states/theme_state.dart index 8fd8a3c..ce8fdd6 100644 --- a/lib/states/theme_state.dart +++ b/lib/states/theme_state.dart @@ -15,7 +15,7 @@ class ThemeState with ChangeNotifier { ), toggleableActiveColor: Colors.red, ) - : ThemeData.light(); + : _getThemeLight(); bool get isDarkModeEnabled => _isDarkModeEnabled; @@ -23,4 +23,12 @@ class ThemeState with ChangeNotifier { _isDarkModeEnabled = b; notifyListeners(); } + + ThemeData _getThemeLight() { + final theme = ThemeData( + primarySwatch: Colors.deepPurple, + ); + + return theme; + } }