Login i18n and color changes

This commit is contained in:
Ricardo Markiewicz
2020-01-29 21:09:55 -03:00
parent 4f2f7a66ba
commit fd84536bfa
10 changed files with 91 additions and 51 deletions
+16
View File
@@ -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
+16
View File
@@ -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
+1 -1
View File
@@ -70,7 +70,7 @@ class _LinesGraphWidgetState extends State<LinesGraphWidget> {
List<Series<double, num>> series = [
Series<double, int>(
id: 'Gasto',
colorFn: (_, __) => MaterialPalette.blue.shadeDefault,
colorFn: (_, __) => MaterialPalette.purple.shadeDefault,
domainFn: (value, index) => index,
measureFn: (value, _) => value,
data: widget.data,
+2 -2
View File
@@ -122,14 +122,14 @@ class _MonthWidgetState extends State<MonthWidget> {
),
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,
),
+8 -4
View File
@@ -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<AddPage> 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<AddPage> 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<AddPage> 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,
),
),
+18 -26
View File
@@ -12,40 +12,32 @@ 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<DetailsPageContainer> {
@override
Widget build(BuildContext context) {
return Consumer<ExpensesRepository>(
builder: (BuildContext context, ExpensesRepository db, Widget child) {
var _query = db.queryByCategory(
widget.params.month + 1, widget.params.categoryName);
final db = Provider.of<ExpensesRepository>(context);
final query = db.queryByCategory(params.month + 1, params.categoryName);
return StreamBuilder<QuerySnapshot>(
stream: _query,
builder: (BuildContext context, AsyncSnapshot<QuerySnapshot> data) {
if (data.hasData) {
return DetailsPage(
categoryName: widget.params.categoryName,
documents: data.data.documents,
onDelete: (documentId) {
db.delete(documentId);
},
);
}
return StreamBuilder<QuerySnapshot>(
stream: query,
builder: (BuildContext context, AsyncSnapshot<QuerySnapshot> 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(),
);
},
);
}
+15 -13
View File
@@ -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<LoginPage> {
@override
Widget build(BuildContext context) {
ComoGastoLocalizations localizations = ComoGastoLocalizations.of(context);
return Scaffold(
body: SafeArea(
child: Column(
@@ -26,7 +29,7 @@ class _LoginPageState extends State<LoginPage> {
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<LoginPage> {
),
),
Text(
"Your personal finance app",
localizations.t('login.subtitle'),
style: Theme.of(context).textTheme.caption,
),
Expanded(
@@ -94,19 +97,19 @@ class _LoginPageState extends State<LoginPage> {
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<LoginPage> {
_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<LoginPage> {
_recognizer2.dispose();
}
String _getTranslatedString(String key) {
return ComoGastoLocalizations.of(context).t(key);
}
void showHelp(String s) {
showDialog(
context: context,
+3 -1
View File
@@ -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<LoginState>(context).logout();
Provider.of<LoginState>(context).logout();
Navigator.of(context).pop();
},
child: Text(localizations.t('settings.signout')),
),
+2 -2
View File
@@ -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,
),
+9 -1
View File
@@ -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;
}
}