Login i18n and color changes
This commit is contained in:
@@ -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,
|
||||
),
|
||||
),
|
||||
|
||||
@@ -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<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
@@ -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,
|
||||
|
||||
@@ -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')),
|
||||
),
|
||||
|
||||
@@ -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,
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user