-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
40 changed files
with
1,096 additions
and
229 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
bdd717abda10237c2fa465b7a097dac7 | ||
f4a445f069a0b2de2c728ed6b4490eda |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
lib/screens/intro/slider/widgets/turn_internet_on_dialog.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
|
||
import 'package:easy_localization/easy_localization.dart'; | ||
import 'package:flutter/material.dart'; | ||
|
||
void showTurnInternetOnDialog(BuildContext context) { | ||
showDialog( | ||
context: context, | ||
builder: (context) => AlertDialog( | ||
backgroundColor: Colors.black45, | ||
title: | ||
Text('other_trauma_title'.tr(), | ||
style: Theme.of(context).textTheme.subtitle2.copyWith( | ||
fontSize: 16, | ||
color: Colors.white, | ||
),), | ||
content: | ||
Text('trauma_explained_txt'.tr(), | ||
style: Theme.of(context).textTheme.subtitle2.copyWith( | ||
fontSize: 12, | ||
color: Colors.white, | ||
),), | ||
actions: [ | ||
FlatButton( | ||
child: Text('close'.tr(), | ||
style: Theme.of(context).textTheme.subtitle2.copyWith( | ||
fontSize: 10, | ||
color: Colors.white, | ||
),), | ||
onPressed: () => Navigator.pop(context), | ||
) | ||
], | ||
), | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,153 @@ | ||
|
||
import 'dart:async'; | ||
import 'dart:convert'; | ||
import 'dart:io'; | ||
|
||
import 'package:balance_app/manager/preference_manager.dart'; | ||
import 'package:balance_app/screens/issues/widgets/custom_form_field.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:easy_localization/easy_localization.dart'; | ||
import 'package:http/http.dart'; | ||
import 'package:package_info/package_info.dart'; | ||
|
||
class IssuesScreen extends StatefulWidget { | ||
@override | ||
_IssuesScreenState createState() => _IssuesScreenState(); | ||
} | ||
|
||
/// Widget for displaying informations about open source dependencies | ||
class _IssuesScreenState extends State<IssuesScreen> { | ||
PackageInfo packageInfo; | ||
String token; | ||
String _description; | ||
|
||
@override | ||
void initState() { | ||
super.initState(); | ||
PackageInfo.fromPlatform().then((value) => setState(() => packageInfo = value)); | ||
_description = ''; | ||
} | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
PackageInfo.fromPlatform().then((value) => packageInfo = value); | ||
return Scaffold( | ||
appBar: AppBar( | ||
title: Text('report_title'.tr()), | ||
), | ||
body: Builder( | ||
// Create an inner BuildContext so that the onPressed methods | ||
// can refer to the Scaffold with Scaffold.of(). | ||
builder: (BuildContext context) { | ||
return SingleChildScrollView( | ||
padding: const EdgeInsets.only( | ||
left: 8.0, top: 16.0, right: 8.0, bottom: 16.0), | ||
child: Column( | ||
children: <Widget>[ | ||
Container( | ||
padding: const EdgeInsets.fromLTRB(0.0, 16.0, 0.0, 16.0), | ||
width: 150, | ||
height: 150, | ||
child: Center( | ||
child: Image.asset("assets/app_logo_circle_broken.png"), | ||
), | ||
), | ||
Padding( | ||
padding: const EdgeInsets.fromLTRB(0.0, 16.0, 0.0, 0.0), | ||
child: Text( | ||
'report_title_txt'.tr(), | ||
style: Theme | ||
.of(context) | ||
.textTheme | ||
.headline5, | ||
), | ||
), | ||
Padding( | ||
padding: const EdgeInsets.symmetric( | ||
horizontal: 8.0, vertical: 8.0), | ||
child: Text( | ||
"${'version_txt'.tr()} ${packageInfo | ||
?.version} (${'build_txt'.tr()}${packageInfo | ||
?.buildNumber})", | ||
style: Theme | ||
.of(context) | ||
.textTheme | ||
.bodyText1, | ||
), | ||
), | ||
Padding( | ||
padding: const EdgeInsets.symmetric( | ||
horizontal: 16.0, vertical: 16.0), | ||
child: CustomFormField( | ||
labelText: 'report_description_txt'.tr(), | ||
initialValue: '', | ||
onChanged: (value) { | ||
setState(() { | ||
_description = value; | ||
}); | ||
}, | ||
validator: (value) { | ||
if (value.isEmpty) | ||
return 'too_short_error_txt'.tr(); | ||
}, | ||
), | ||
), | ||
RaisedButton( | ||
onPressed: () async { | ||
if (_description.length > 0) { | ||
String token = (await PreferenceManager.userInfo).token; | ||
String version = "${'version_txt'.tr()} ${packageInfo | ||
?.version} (${'build_txt'.tr()}${packageInfo | ||
?.buildNumber})"; | ||
String json = '{"token":"$token","version":"$version","description":"$_description"}'; | ||
_makePostRequest(json); | ||
FocusScope.of(context).unfocus(); | ||
Scaffold.of(context).showSnackBar(SnackBar( | ||
behavior: SnackBarBehavior.floating, | ||
content: Text('report_snack_true_txt'.tr()), | ||
duration: Duration(seconds: 2), | ||
)); | ||
} else { | ||
FocusScope.of(context).unfocus(); | ||
Scaffold.of(context).showSnackBar(SnackBar( | ||
behavior: SnackBarBehavior.floating, | ||
content: Text('report_snack_false_txt'.tr()), | ||
duration: Duration(seconds: 2), | ||
)); | ||
} | ||
}, | ||
child: Text('report_send_txt'.tr()) | ||
), | ||
SizedBox(height: 16), | ||
], | ||
), | ||
); | ||
}, | ||
), | ||
); | ||
} | ||
} | ||
|
||
Future<bool> _makePostRequest(var data) async { | ||
// set up POST request arguments | ||
String url = 'https://www.balancemobile.it/api/v1/db/reporting'; | ||
//String url = 'http://192.168.1.206:8000/api/v1/db/reporting'; | ||
Map<String, String> headers = {"Content-type": "application/json"}; | ||
|
||
try { | ||
Response response = await post(url, headers: headers, body: data).timeout(Duration(seconds: 30)); | ||
|
||
if (response.statusCode == 200) { | ||
return true; | ||
} else { | ||
print("_SendingData.Issues: The server answered with: "+response.statusCode.toString()); | ||
return false; | ||
} | ||
} on TimeoutException catch (_) { | ||
print("_SendingData.Issues: The connection dropped, maybe the server is congested"); | ||
return false; | ||
} on SocketException catch (_) { | ||
print("_SendingData.Issues: Communication failed. The server was not reachable"); | ||
return false; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
|
||
import 'package:flutter/material.dart'; | ||
import 'package:flutter/services.dart'; | ||
|
||
/// StatelessWidget that implements the custom | ||
/// style for a [TextFormField] | ||
class CustomFormField extends StatelessWidget { | ||
final String initialValue; | ||
final String labelText; | ||
final String suffix; | ||
final bool decimal; | ||
final ValueChanged<String> onChanged; | ||
final FormFieldValidator<String> validator; | ||
final FormFieldSetter<String> onSaved; | ||
|
||
CustomFormField({ | ||
this.labelText, | ||
this.suffix, | ||
this.decimal = false, | ||
this.initialValue, | ||
this.onSaved, | ||
this.validator, | ||
this.onChanged, | ||
}); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return GestureDetector( | ||
onTap: () { | ||
FocusScopeNode currentFocus = FocusScope.of(context); | ||
}, | ||
child: Material( | ||
elevation: 4, | ||
color: Colors.white, | ||
borderRadius: BorderRadius.circular(9), | ||
child: Padding( | ||
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 4), | ||
child: TextFormField( | ||
inputFormatters: [ | ||
new LengthLimitingTextInputFormatter(256), | ||
], | ||
keyboardType: TextInputType.multiline, | ||
maxLines: null, | ||
decoration: InputDecoration( | ||
border: InputBorder.none, | ||
hintText: labelText, | ||
suffixText: suffix, | ||
hintStyle: TextStyle( | ||
color: Color(0xFFBFBFBF), | ||
fontSize: 14, | ||
fontWeight: FontWeight.w500, | ||
), | ||
suffixStyle: TextStyle( | ||
color: Color(0xFFBFBFBF), | ||
fontSize: 14, | ||
fontWeight: FontWeight.w500, | ||
), | ||
), | ||
style: TextStyle( | ||
color: Colors.black45, | ||
fontSize: 14, | ||
fontWeight: FontWeight.w500, | ||
), | ||
autocorrect: false, | ||
initialValue: initialValue, | ||
onChanged: (newValue) => onChanged?.call(newValue), | ||
validator: validator, | ||
onSaved: onSaved, | ||
), | ||
), | ||
), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
195 changes: 195 additions & 0 deletions
195
lib/screens/main/home/widgets/measuring_condition_dialog.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,195 @@ | ||
|
||
import 'package:balance_app/manager/preference_manager.dart'; | ||
import 'package:balance_app/screens/res/colors.dart'; | ||
import 'package:easy_localization/easy_localization.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter/rendering.dart'; | ||
|
||
/// Show the [TutorialDialog] | ||
/// | ||
/// The callback [onDone] is called every time the action button | ||
/// is pressed and it lets the parent Widget start the measuring | ||
void showMeasuringConditionDialog(BuildContext context, VoidCallback onDone) { | ||
showDialog( | ||
barrierDismissible: false, | ||
context: context, | ||
builder: (context) => MeasuringConditionDialog(onDone), | ||
); | ||
} | ||
|
||
/// Widget that implements a tutorial dialog | ||
/// | ||
/// This dialog has the purpose of teaching the user | ||
/// how to correctly perform a measurement. | ||
class MeasuringConditionDialog extends StatefulWidget { | ||
final VoidCallback callback; | ||
|
||
MeasuringConditionDialog(this.callback); | ||
|
||
@override | ||
_MeasuringConditionDialogState createState() => _MeasuringConditionDialogState(); | ||
} | ||
|
||
class _MeasuringConditionDialogState extends State<MeasuringConditionDialog> { | ||
int _value; | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return AlertDialog( | ||
title: Text('Le tue condizioni'), | ||
contentPadding: const EdgeInsets.all(0.0), | ||
content: Container( | ||
child: SingleChildScrollView( | ||
child: Column( | ||
mainAxisSize: MainAxisSize.min, | ||
mainAxisAlignment: MainAxisAlignment.center, | ||
crossAxisAlignment: CrossAxisAlignment.start, | ||
children: [ | ||
Padding( | ||
padding: const EdgeInsets.all(24.0), | ||
child: Text('Conoscere la tua condizione degli ultimi 15 minuti é estremamente importante. Seleziona le icone che meglio descrivono quello che stavi facendo!'), | ||
), | ||
SizedBox(width: 4), | ||
Padding( | ||
padding: const EdgeInsets.fromLTRB(24, 0, 24, 16), | ||
child: Row( | ||
mainAxisAlignment: MainAxisAlignment.center, | ||
children: <Widget>[ | ||
GestureDetector( | ||
onTap: () => setState(() => _value = 1), | ||
child: ClipRRect( | ||
borderRadius: BorderRadius.circular(15.0), | ||
child: Container( | ||
height: 56, | ||
width: 56, | ||
color: _value == 1 ? BColors.colorPrimary : Colors.transparent, | ||
child: Center( | ||
child: Image.asset("assets/images/sleeping.png"), | ||
), | ||
), | ||
), | ||
), | ||
SizedBox(width: 4), | ||
GestureDetector( | ||
onTap: () => setState(() => _value = 2), | ||
child: ClipRRect( | ||
borderRadius: BorderRadius.circular(15.0), | ||
child: Container( | ||
height: 56, | ||
width: 56, | ||
color: _value == 2 ? BColors.colorPrimary : Colors.transparent, | ||
child: Center( | ||
child: Image.asset("assets/images/working.png"), | ||
), | ||
), | ||
), | ||
), | ||
SizedBox(width: 4), | ||
GestureDetector( | ||
onTap: () => setState(() => _value = 3), | ||
child: ClipRRect( | ||
borderRadius: BorderRadius.circular(15.0), | ||
child: Container( | ||
height: 56, | ||
width: 56, | ||
color: _value == 3 ? BColors.colorPrimary : Colors.transparent, | ||
child: Center( | ||
child: Image.asset("assets/images/walking.png"), | ||
), | ||
), | ||
), | ||
), | ||
], | ||
), | ||
), | ||
Padding( | ||
padding: const EdgeInsets.fromLTRB(24, 0, 24, 16), | ||
child: Row( | ||
mainAxisAlignment: MainAxisAlignment.center, | ||
children: <Widget>[ | ||
GestureDetector( | ||
onTap: () => setState(() => _value = 4), | ||
child: ClipRRect( | ||
borderRadius: BorderRadius.circular(15.0), | ||
child: Container( | ||
height: 56, | ||
width: 56, | ||
color: _value == 4 ? BColors.colorPrimary : Colors.transparent, | ||
child: Center( | ||
child: Image.asset("assets/images/reading.png"), | ||
), | ||
), | ||
), | ||
), | ||
SizedBox(width: 4), | ||
GestureDetector( | ||
onTap: () => setState(() => _value = 5), | ||
child: ClipRRect( | ||
borderRadius: BorderRadius.circular(15.0), | ||
child: Container( | ||
height: 56, | ||
width: 56, | ||
color: _value == 5 ? BColors.colorPrimary : Colors.transparent, | ||
child: Center( | ||
child: Image.asset("assets/images/eating.png"), | ||
), | ||
), | ||
), | ||
), | ||
SizedBox(width: 4), | ||
GestureDetector( | ||
onTap: () => setState(() => _value = 6), | ||
child: ClipRRect( | ||
borderRadius: BorderRadius.circular(15.0), | ||
child: Container( | ||
height: 56, | ||
width: 56, | ||
color: _value == 6 ? BColors.colorPrimary : Colors.transparent, | ||
child: Center( | ||
child: Image.asset("assets/images/drinking.png"), | ||
), | ||
), | ||
), | ||
), | ||
], | ||
), | ||
), | ||
Padding( | ||
padding: const EdgeInsets.fromLTRB(24, 0, 24, 16), | ||
child: Row( | ||
mainAxisAlignment: MainAxisAlignment.center, | ||
children: <Widget>[ | ||
GestureDetector( | ||
onTap: () => setState(() => _value = 7), | ||
child: ClipRRect( | ||
borderRadius: BorderRadius.circular(15.0), | ||
child: Container( | ||
height: 56, | ||
width: 56, | ||
color: _value == 7 ? BColors.colorPrimary : Colors.transparent, | ||
child: Center( | ||
child: Image.asset("assets/images/sport.png"), | ||
), | ||
), | ||
), | ||
), | ||
], | ||
), | ||
), | ||
], | ||
), | ||
), | ||
), | ||
actions: [ | ||
FlatButton( | ||
onPressed: () { | ||
widget.callback(); | ||
PreferenceManager.updateInitialCondition(_value ?? 0); | ||
Navigator.pop(context); | ||
}, | ||
child: Text('ok'.tr()) | ||
), | ||
], | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters