bug fix 1.0 (android logo, old device, firstname, exercise save)
This commit is contained in:
parent
dfe20685d7
commit
9b1d867826
@ -7,8 +7,8 @@
|
||||
FlutterApplication and put your custom class here. -->
|
||||
<application
|
||||
android:name="io.flutter.app.FlutterApplication"
|
||||
android:label="aitrainer_app"
|
||||
android:icon="@mipmap/ic_launcher">
|
||||
android:label="WorkoutTest"
|
||||
android:icon="@mipmap/launcher_icon">
|
||||
<activity
|
||||
android:name="com.aitrainer.aitrainer_app.MainActivity"
|
||||
android:launchMode="singleTop"
|
||||
@ -44,4 +44,4 @@
|
||||
android:name="flutterEmbedding"
|
||||
android:value="2" />
|
||||
</application>
|
||||
</manifest>
|
||||
</manifest>
|
@ -51,7 +51,7 @@ class AitrainerApp extends StatelessWidget {
|
||||
localizationsDelegates: [
|
||||
// ... app-specific localization delegate[s] here
|
||||
AppLocalizations.delegate,
|
||||
GlobalWidgetsLocalizations.delegate,
|
||||
GlobalMaterialLocalizations.delegate,
|
||||
GlobalCupertinoLocalizations.delegate,
|
||||
],
|
||||
supportedLocales: [
|
||||
@ -59,6 +59,21 @@ class AitrainerApp extends StatelessWidget {
|
||||
const Locale('hu', "HU"), // Hungarian
|
||||
// ... other locales the app supports
|
||||
],
|
||||
localeResolutionCallback: (Locale locale, Iterable<Locale> supportedLocales) {
|
||||
//myLocale = deviceLocale ;
|
||||
// here you make your app language similar to device language ,
|
||||
// but you should check whether the localization is supported by your app
|
||||
Locale realSupportedLocale = Locale('en', "US");
|
||||
supportedLocales.forEach((supportedLocale) {
|
||||
if ( supportedLocale.countryCode == locale.countryCode ) {
|
||||
realSupportedLocale = supportedLocale;
|
||||
}
|
||||
});
|
||||
if ( realSupportedLocale.countryCode != locale.countryCode ) {
|
||||
print ("Locale " + locale.countryCode + " not supported on this device :(");
|
||||
}
|
||||
return realSupportedLocale;
|
||||
},
|
||||
routes: {
|
||||
'home': (context) => AitrainerHome(),
|
||||
'loading': (context) => LoadingScreenMain(),
|
||||
|
@ -43,6 +43,7 @@ class Auth {
|
||||
Customer userLoggedIn;
|
||||
bool firstLoad = true;
|
||||
List<ExerciseType> _exerciseTypes;
|
||||
List deviceLanguages;
|
||||
|
||||
factory Auth() {
|
||||
return _singleton;
|
||||
|
@ -1,7 +1,7 @@
|
||||
class Customer {
|
||||
String name;
|
||||
String email;
|
||||
String firstName;
|
||||
String firstname;
|
||||
String sex;
|
||||
int age;
|
||||
String active;
|
||||
@ -18,7 +18,7 @@ class Customer {
|
||||
|
||||
Customer({this.customerId,
|
||||
this.name,
|
||||
this.firstName,
|
||||
this.firstname,
|
||||
this.email,
|
||||
this.sex,
|
||||
this.age,
|
||||
@ -36,7 +36,7 @@ class Customer {
|
||||
Customer.fromJson(Map json) {
|
||||
this.customerId = json['customerId'];
|
||||
this.name = json['name'];
|
||||
this.firstName = json['firstname'];
|
||||
this.firstname = json['firstname'];
|
||||
this.email = json['email'];
|
||||
this.sex = json['sex'];
|
||||
this.age = json['age'];
|
||||
@ -52,7 +52,7 @@ class Customer {
|
||||
Map<String, dynamic> toJson() =>
|
||||
{
|
||||
"name": name,
|
||||
"firstName": firstName,
|
||||
"firstname": firstname,
|
||||
"email": email,
|
||||
"age": age,
|
||||
"sex": sex,
|
||||
|
@ -2,7 +2,8 @@ import 'package:aitrainer_app/localization/app_language.dart';
|
||||
import 'package:aitrainer_app/service/api.dart';
|
||||
import 'package:aitrainer_app/service/customer_service.dart';
|
||||
import 'package:aitrainer_app/service/exercisetype_service.dart';
|
||||
import 'package:aitrainer_app/viewmodel/exercise_type_changing_view_model.dart';
|
||||
import 'package:devicelocale/devicelocale.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
import 'package:aitrainer_app/model/auth.dart';
|
||||
|
||||
@ -19,11 +20,33 @@ class Session {
|
||||
|
||||
if ( _auth.firstLoad ) {
|
||||
_fetchToken(_sharedPreferences, callback);
|
||||
initDeviceLocale();
|
||||
appLanguage.fetchLocale();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Future<void> initDeviceLocale() async {
|
||||
List languages;
|
||||
String currentLocale;
|
||||
|
||||
// Platform messages may fail, so we use a try/catch PlatformException.
|
||||
try {
|
||||
languages = await Devicelocale.preferredLanguages;
|
||||
Auth().deviceLanguages = languages;
|
||||
print("device langs " + languages.toString());
|
||||
|
||||
} on PlatformException {
|
||||
print("Error obtaining preferred languages");
|
||||
}
|
||||
try {
|
||||
currentLocale = await Devicelocale.currentLocale;
|
||||
print("Device currentlocale " + currentLocale);
|
||||
} on PlatformException {
|
||||
print("Error obtaining current locale");
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Auth flow of the user, see auth.dart
|
||||
*/
|
||||
|
@ -77,7 +77,7 @@ class _AccountPagePageState extends State<AccountPage> {
|
||||
children: [
|
||||
Text(_loggedIn ? Auth().userLoggedIn.email + " " +
|
||||
Auth().userLoggedIn.name + " " +
|
||||
Auth().userLoggedIn.firstName : "",
|
||||
Auth().userLoggedIn.firstname : "",
|
||||
style: TextStyle(color: Colors.blue)),
|
||||
Icon(Icons.arrow_forward_ios),
|
||||
]),
|
||||
|
@ -163,7 +163,7 @@ class _CustomerModifyPageState extends State<CustomerModifyPage> {
|
||||
labelText: AppLocalizations.of(context).translate('First Name'),
|
||||
),
|
||||
keyboardType: TextInputType.emailAddress,
|
||||
initialValue: customerChangeModel.customer.customer.firstName,
|
||||
initialValue: customerChangeModel.customer.customer.firstname,
|
||||
onFieldSubmitted: (input) => customerChangeModel.customer.setFirstName(input)
|
||||
)
|
||||
)
|
||||
|
@ -30,7 +30,7 @@ class _ExerciseNewPageState extends State {
|
||||
model.exerciseViewModel.createNew();
|
||||
customerName = model != null && model.customer != null
|
||||
? model.customer.name + " " +
|
||||
model.customer.firstName
|
||||
model.customer.firstname
|
||||
: "Please select a customer";
|
||||
|
||||
exerciseName = model != null &&
|
||||
@ -157,7 +157,7 @@ class _ExerciseNewPageState extends State {
|
||||
inputFormatters: [
|
||||
WhitelistingTextInputFormatter(RegExp(r"[\d.]"))
|
||||
],
|
||||
onFieldSubmitted: (input) => {
|
||||
onChanged: (input) => {
|
||||
print ("UnitQuantity value $input"),
|
||||
model.exerciseViewModel.setUnitQuantity(
|
||||
double.parse(input))
|
||||
@ -193,7 +193,7 @@ class _ExerciseNewPageState extends State {
|
||||
inputFormatters: [
|
||||
WhitelistingTextInputFormatter(RegExp(r"[\d.]"))
|
||||
],
|
||||
onFieldSubmitted: (input) =>
|
||||
onChanged: (input) =>
|
||||
{
|
||||
print ("Quantity value $input"),
|
||||
model.exerciseViewModel.setQuantity(
|
||||
|
@ -11,7 +11,7 @@ class CustomerViewModel {
|
||||
}
|
||||
|
||||
String get firstName {
|
||||
return this.customer.firstName;
|
||||
return this.customer.firstname;
|
||||
}
|
||||
|
||||
String get sex {
|
||||
@ -26,7 +26,7 @@ class CustomerViewModel {
|
||||
this.customer.name = name;
|
||||
}
|
||||
setFirstName(String firstName) {
|
||||
this.customer.firstName = firstName;
|
||||
this.customer.firstname = firstName;
|
||||
}
|
||||
|
||||
setPassword( String password ) {
|
||||
|
72
pubspec.lock
72
pubspec.lock
@ -1,6 +1,20 @@
|
||||
# Generated by pub
|
||||
# See https://dart.dev/tools/pub/glossary#lockfile
|
||||
packages:
|
||||
archive:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: archive
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.0.13"
|
||||
args:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: args
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.6.0"
|
||||
async:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -36,6 +50,20 @@ packages:
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.14.12"
|
||||
convert:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: convert
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.1.1"
|
||||
crypto:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: crypto
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.1.5"
|
||||
cupertino_icons:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
@ -50,6 +78,13 @@ packages:
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.0.0"
|
||||
devicelocale:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: devicelocale
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.3.1"
|
||||
fake_async:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -69,6 +104,13 @@ packages:
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.3.8"
|
||||
flutter_launcher_icons:
|
||||
dependency: "direct dev"
|
||||
description:
|
||||
name: flutter_launcher_icons
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.7.5"
|
||||
flutter_localizations:
|
||||
dependency: "direct main"
|
||||
description: flutter
|
||||
@ -93,6 +135,13 @@ packages:
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "3.1.4"
|
||||
image:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: image
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.1.14"
|
||||
intl:
|
||||
dependency: "direct dev"
|
||||
description:
|
||||
@ -128,6 +177,13 @@ packages:
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.9.0"
|
||||
petitparser:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: petitparser
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "3.0.4"
|
||||
provider:
|
||||
dependency: "direct dev"
|
||||
description:
|
||||
@ -203,6 +259,20 @@ packages:
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.0.8"
|
||||
xml:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: xml
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "4.2.0"
|
||||
yaml:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: yaml
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.2.1"
|
||||
sdks:
|
||||
dart: ">=2.7.0 <3.0.0"
|
||||
flutter: ">=1.0.0 <2.0.0"
|
||||
flutter: ">=1.12.13+hotfix.6 <2.0.0"
|
||||
|
@ -27,6 +27,7 @@ dependencies:
|
||||
# The following adds the Cupertino Icons font to your application.
|
||||
# Use with the CupertinoIcons class for iOS style icons.
|
||||
cupertino_icons: ^0.1.3
|
||||
devicelocale: ^0.3.1
|
||||
|
||||
flutter_localizations:
|
||||
sdk: flutter
|
||||
@ -42,6 +43,11 @@ dev_dependencies:
|
||||
datetime_picker_formfield: ^1.0.0
|
||||
shared_preferences: ^0.4.1
|
||||
|
||||
flutter_launcher_icons: "^0.7.3"
|
||||
|
||||
flutter_icons:
|
||||
android: "launcher_icon"
|
||||
image_path: "asset/icon/icon.png"
|
||||
|
||||
# For information on the generic Dart part of this file, see the
|
||||
# following page: https://dart.dev/tools/pub/pubspec
|
||||
|
Loading…
Reference in New Issue
Block a user