Commit 5d5e755b authored by Thiago Nitschke Simões's avatar Thiago Nitschke Simões
Browse files

Merge branch 'release/sprint_4'

parents 34599be2 4f15a562
Showing with 649 additions and 64 deletions
+649 -64
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="br.pucrs.ages.notar_e_anotar_app">
<uses-permission android:name="android.permission.INTERNET" />
<application
android:label="notar_e_anotar_app"
android:usesCleartextTraffic="true"
android:icon="@mipmap/ic_launcher">
<activity
android:name=".MainActivity"
......
images/avatar.png

24.6 KB

......@@ -41,5 +41,10 @@
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
</dict>
</plist>
import 'package:flutter/material.dart';
import 'package:notar_e_anotar_app/styles/global_styles.dart';
class EvaluationTaskCard extends StatefulWidget {
final String title;
final String description;
final bool challenge;
final Function callback;
final bool hasGoodEvaluation;
final bool hasBadEvaluation;
EvaluationTaskCard(
{this.title,
this.description,
this.challenge,
this.callback,
this.hasGoodEvaluation,
this.hasBadEvaluation});
@override
_EvaluationTaskCardState createState() => _EvaluationTaskCardState();
}
class _EvaluationTaskCardState extends State<EvaluationTaskCard> {
String title;
String description;
bool challenge;
bool hasGoodEvaluation;
bool hasBadEvaluation;
@override
void initState() {
super.initState();
title = widget.title;
description = widget.description;
challenge = widget.challenge;
hasGoodEvaluation = widget.hasGoodEvaluation;
hasBadEvaluation = widget.hasBadEvaluation;
}
void changeState() {
challenge = true;
}
Color calculateColorForBackground() {
if (!challenge && !hasGoodEvaluation && !hasBadEvaluation) {
return Colors.white;
} else if (challenge && !hasGoodEvaluation && !hasBadEvaluation) {
return primaryFaded;
} else if (hasGoodEvaluation) {
return blueishGreen;
} else {
return washedRed;
}
}
Color calculateColorForTitle() {
if (!challenge && !hasGoodEvaluation && !hasBadEvaluation) {
return primaryDark;
} else if (challenge && !hasGoodEvaluation && !hasBadEvaluation) {
return primaryDark;
} else {
return Colors.white;
}
}
Color calculateColorForSubtitle() {
if (!challenge && !hasGoodEvaluation && !hasBadEvaluation) {
return Colors.grey;
} else if (challenge && !hasGoodEvaluation && !hasBadEvaluation) {
return primaryDark;
} else {
return Colors.white;
}
}
Color calculateColorForGoodEvaluationButton() {
if (!challenge && !hasGoodEvaluation && !hasBadEvaluation) {
return blueishGreen;
} else if (challenge && !hasGoodEvaluation && !hasBadEvaluation) {
return blueishGreen;
} else if (hasGoodEvaluation) {
return darkBlueishGreen;
} else if (hasBadEvaluation) {
return darkWashedRed;
}
}
Color calculateColorForBadEvaluationButton() {
if (!challenge && !hasGoodEvaluation && !hasBadEvaluation) {
return washedRed;
} else if (challenge && !hasGoodEvaluation && !hasBadEvaluation) {
return washedRed;
} else if (hasBadEvaluation) {
return darkWashedRed;
} else if (hasGoodEvaluation) {
return darkBlueishGreen;
}
}
@override
Widget build(BuildContext context) {
return Card(
color: calculateColorForBackground(),
child: ListTile(
title: Text(
'$title',
style: Theme.of(context).textTheme.subtitle1.copyWith(
fontFamily: 'Baloo 2',
color: calculateColorForTitle(),
fontWeight: FontWeight.w600),
),
subtitle: Text(
'$description',
style: Theme.of(context)
.textTheme
.subtitle2
.copyWith(color: calculateColorForSubtitle()),
),
leading: CircleAvatar(
backgroundColor: calculateColorForBadEvaluationButton(),
child: IconButton(
icon: Icon(Icons.close_rounded),
color: challenge ? Colors.white : Colors.white,
onPressed: () => setState(() {
hasBadEvaluation = !hasBadEvaluation;
hasGoodEvaluation = false;
})),
),
trailing: CircleAvatar(
backgroundColor: calculateColorForGoodEvaluationButton(),
child: IconButton(
icon: Icon(Icons.done_rounded),
color: challenge ? Colors.white : Colors.white,
onPressed: () => setState(() {
hasGoodEvaluation = !hasGoodEvaluation;
hasBadEvaluation = false;
})),
),
contentPadding: EdgeInsets.only(bottom: 5, left: 16, right: 16),
visualDensity: VisualDensity.standard,
dense: false,
),
);
}
}
import 'package:date_format/date_format.dart';
import 'package:flutter/material.dart';
import 'package:notar_e_anotar_app/styles/global_styles.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:intl/intl.dart';
class TopCard extends StatelessWidget {
final String name;
final String tema;
const TopCard({this.name, this.tema});
@override
Widget build(BuildContext context) {
DateTime __data = new DateTime.now();
return Container(
padding: EdgeInsets.only(top: 8, bottom: 0, left: 24, right: 24),
decoration: BoxDecoration(
color: primaryFaded,
boxShadow: cardBoxShadow,
borderRadius: BorderRadiusDirectional.only(
bottomStart: Radius.circular(25),
bottomEnd: Radius.circular(25))),
alignment: Alignment.center,
width: double.infinity,
height: MediaQuery.of(context).size.height * 0.25,
child: SafeArea(
child: SizedBox(
child: Container(
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
Column(
children: [
Container(
child: CircleAvatar(
backgroundImage: AssetImage('images/avatar.png'),
radius: 40,
),
),
],
),
Column(
children: [
Container(
child: Column(
children: [
Text.rich(
TextSpan(
text: 'Olá,',
style:
TextStyle(color: darkGreen, fontSize: 20),
children: <TextSpan>[
TextSpan(
text: ' $name',
style: TextStyle(
color: darkGreen,
fontSize: 20,
fontWeight: FontWeight.bold),
),
],
),
),
Text(
"Semana Da Arte",
style: TextStyle(
color: Colors.black38, fontSize: 15),
)
],
),
)
],
),
Column(
children: [
Container(
//color: Colors.teal.shade200,
height: 80,
width: 80,
decoration: BoxDecoration(
color: Colors.teal.shade200,
borderRadius: BorderRadius.circular(10)),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
DateFormat("dd").format(__data),
style: TextStyle(
fontSize: 30,
),
),
],
),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
DateFormat("EEE", "pt_BR").format(__data),
style: TextStyle(
fontSize: 20,
),
),
],
),
],
),
)
],
),
/*Container(
width: 80,
height: 80,
child: Image.asset('images/teste.png'),
margin: EdgeInsets.all(10.0),
),
Text(
'Olá,',
style: TextStyle(color: darkGreen, fontSize: 20),
textAlign: TextAlign.center,
maxLines: 2,
overflow: TextOverflow.ellipsis,
),
Text(
' $name!',
style: TextStyle(
color: darkGreen, fontSize: 20, fontWeight: FontWeight.bold),
textAlign: TextAlign.center,
maxLines: 2,
overflow: TextOverflow.ellipsis,
),*/
]),
),
),
),
);
}
}
......@@ -8,8 +8,10 @@ class WeekdayTile extends StatefulWidget {
final String dayName;
final bool isLast;
final bool isToday;
final Function callback;
WeekdayTile({this.dayNumber, this.dayName, this.isLast, this.isToday});
WeekdayTile(
{this.dayNumber, this.dayName, this.isLast, this.isToday, this.callback});
@override
_WeekdayTileState createState() => _WeekdayTileState();
......@@ -20,14 +22,23 @@ class _WeekdayTileState extends State<WeekdayTile> {
String dayName;
bool isLast;
bool isToday;
Function callback;
void changeDay() {
setState(() {
this.callback(dayNumber - 1);
this.isToday = this.isToday ? false : true;
});
}
@override
void initState() {
super.initState();
dayNumber = widget.dayNumber;
dayName = widget.dayName;
isLast = widget.isLast;
isToday = widget.isToday;
this.dayNumber = widget.dayNumber;
this.dayName = widget.dayName;
this.isLast = widget.isLast;
this.isToday = widget.isToday;
this.callback = widget.callback;
}
@override
......@@ -51,7 +62,7 @@ class _WeekdayTileState extends State<WeekdayTile> {
}
}),
),
onPressed: () => print('Tapped $dayNumber $dayName button!'),
onPressed: () => changeDay(),
child: Padding(
padding: EdgeInsets.symmetric(vertical: 10, horizontal: 0),
child: Column(
......
......@@ -3,10 +3,57 @@ import 'package:notar_e_anotar_app/components/weekday_tile.dart';
import 'package:notar_e_anotar_app/styles/global_styles.dart';
import 'package:notar_e_anotar_app/utils/constants.dart';
class WeekdaysCard extends StatelessWidget {
const WeekdaysCard({
Key key,
}) : super(key: key);
class WeekdaysCard extends StatefulWidget {
final Function callback;
const WeekdaysCard({this.callback});
@override
_WeekdaysCardState createState() => _WeekdaysCardState();
}
class _WeekdaysCardState extends State<WeekdaysCard> {
int selectedDay = 0;
List<WeekdayTile> weekdaysList;
Function callback;
@override
void initState() {
super.initState();
this.selectedDay = 0;
this.weekdaysList = List.generate(
7,
(index) => WeekdayTile(
dayNumber: index + 1,
dayName: shortWeekdaysName[index],
isLast: index == 6 ? true : false,
isToday: index == selectedDay ? true : false,
callback: changeSelectedDay,
));
this.callback = widget.callback;
}
void regenerateList(int selectedDay) {
this.weekdaysList = List.generate(
7,
(index) => WeekdayTile(
dayNumber: index + 1,
dayName: shortWeekdaysName[index],
isLast: index == 6 ? true : false,
isToday: index == selectedDay ? true : false,
callback: changeSelectedDay,
));
setState(() {});
}
void changeSelectedDay(int dayNumber) {
setState(() {
this.callback(dayNumber);
this.selectedDay = dayNumber;
});
regenerateList(dayNumber);
}
@override
Widget build(BuildContext context) {
......@@ -35,15 +82,7 @@ class WeekdaysCard extends StatelessWidget {
scrollDirection: Axis.horizontal,
child: Container(
clipBehavior: Clip.none,
child: Row(
children: List.generate(
7,
(index) => WeekdayTile(
dayNumber: index + 1,
dayName: shortWeekdaysName[index],
isLast: index == 6 ? true : false,
isToday: index == 0 ? true : false,
))),
child: Row(children: weekdaysList),
),
),
)
......
import 'package:flutter/material.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:notar_e_anotar_app/pages/onboarding.dart';
import 'package:notar_e_anotar_app/styles/app_theme.dart';
......@@ -11,6 +12,11 @@ class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
localizationsDelegates: [
GlobalMaterialLocalizations.delegate,
GlobalWidgetsLocalizations.delegate
],
supportedLocales: [const Locale('pt', 'BR')],
title: 'Notar & Anotar',
theme: appTheme,
home: Onboarding(title: 'Onboarding'),
......
import 'package:flutter/material.dart';
part of swagger.api;
class AdditionalInfo {
String name;
......
import 'package:flutter/material.dart';
import 'package:objectid/objectid.dart';
part of swagger.api;
class Mood {
String id;
......
import 'package:flutter/material.dart';
import 'package:objectid/objectid.dart';
import 'additional_info.dart';
import 'mood.dart';
part of swagger.api;
class RoutineData {
String id;
......
import 'package:flutter/material.dart';
import 'package:notar_e_anotar_app/models/routine_data.dart';
import 'package:notar_e_anotar_app/models/task.dart';
import 'package:objectid/objectid.dart';
part of swagger.api;
class RoutineDay {
String id;
......
import 'package:flutter/material.dart';
import 'package:notar_e_anotar_app/models/subject.dart';
import 'package:objectid/objectid.dart';
part of swagger.api;
class RoutinePlan {
String id;
......@@ -24,7 +22,11 @@ class RoutinePlan {
}
Map<String, dynamic> toJson() {
return {'id': id, 'number_of_weeks': numberOfWeeks, 'subjects': subjects};
return {
'id': id,
'numberOfWeeks': numberOfWeeks,
'subjects': Subject.listToJson(subjects)
};
}
static List<RoutinePlan> listFromJson(List<dynamic> json) {
......
import 'package:flutter/material.dart';
import 'package:objectid/objectid.dart';
part of swagger.api;
class Subject {
String id;
......@@ -24,6 +23,14 @@ class Subject {
return {'id': id, 'name': name};
}
static List<Map<String, dynamic>> listToJson(List<Subject> subjects) {
var list = List<Map<String, dynamic>>();
for (Subject subject in subjects) {
list.add(subject.toJson());
}
return list;
}
static List<Subject> listFromJson(List<dynamic> json) {
return json == null
? new List<Subject>()
......
import 'package:flutter/material.dart';
import 'package:objectid/objectid.dart';
part of swagger.api;
class Task {
String id;
......
import 'package:flutter/material.dart';
import 'package:objectid/objectid.dart';
part of swagger.api;
class User {
String id;
......
import 'package:flutter/material.dart';
import 'package:notar_e_anotar_app/models/routine_day.dart';
import 'package:objectid/objectid.dart';
part of swagger.api;
class WeeklyRoutine {
String id;
......
import 'package:flutter/material.dart';
import 'package:notar_e_anotar_app/widgets/button_widget.dart';
import 'package:notar_e_anotar_app/components/task_card.dart';
import 'package:notar_e_anotar_app/components/top_card_user.dart';
import 'package:notar_e_anotar_app/pages/registration_activity.dart';
import 'package:notar_e_anotar_app/pages/weekly_evaluation.dart';
import 'package:notar_e_anotar_app/styles/global_styles.dart';
List<TaskCard> tasks = [
TaskCard(
title: "DESAFIO DO DIA",
description: "Especificações do desafio aqui",
challenge: false,
)
];
class HomePage extends StatelessWidget {
final String name = "Luana";
final String tema = "Aprender a relaxar";
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('título aqui'),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
'HomePage',
style: TextStyle(fontSize: 48, fontWeight: FontWeight.bold),
),
const SizedBox(height: 24),
ButtonWidget(
text: 'Voltar',
onClicked: () => goToOnBoarding(context),
),
],
textTheme: Theme.of(context).textTheme,
automaticallyImplyLeading: false,
title: Padding(
padding: const EdgeInsets.all(50),
child: Text(
'Home',
style: TextStyle(color: darkGreen),
),
),
backgroundColor: Colors.transparent,
elevation: 0.0,
),
extendBodyBehindAppBar: true,
body: Column(
children: [
TopCard(name: this.name, tema: this.tema),
ListBody(children: tasks)
],
),
floatingActionButtonLocation: FloatingActionButtonLocation.centerFloat,
floatingActionButton: Row(
mainAxisAlignment: MainAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Padding(
padding: EdgeInsets.all(20.0),
child: ElevatedButton(
child: Text('Atividades'),
style: ButtonStyle(
minimumSize: MaterialStateProperty.all(Size(150, 44))),
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => RegistrationActivity()));
})),
Padding(
padding: EdgeInsets.all(20.0),
child: ElevatedButton(
child: Text('Avaliação'),
style: ButtonStyle(
minimumSize: MaterialStateProperty.all(Size(150, 44)),
),
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => WeeklyEvaluation()));
})),
],
),
);
}
void goToOnBoarding(context) => print("Tapped button");
void goToOnBoarding(context) {
Navigator.push(context,
MaterialPageRoute(builder: (context) => RegistrationActivity()));
}
}
import 'package:flutter/material.dart';
import 'package:notar_e_anotar_app/pages/register_page.dart';
import 'package:notar_e_anotar_app/pages/routine_period_selection.dart';
import 'package:notar_e_anotar_app/styles/global_styles.dart';
import 'package:notar_e_anotar_app/widgets/secondary_button.dart';
......@@ -90,11 +91,17 @@ class LoginPage extends StatelessWidget {
Text("Não possui conta? ",
style:
TextStyle(color: primaryFaded, fontSize: 18)),
Text("Registre-se",
new GestureDetector(
onTap: () {
this.goToRegister(context);
},
child: Text("Registre-se",
style: TextStyle(
color: primaryFaded,
fontSize: 18,
fontWeight: FontWeight.bold)),
fontWeight: FontWeight.bold),
)
),
],
),
SizedBox(height: 36)
......@@ -109,4 +116,7 @@ class LoginPage extends StatelessWidget {
void goToHomePage(context) => Navigator.push(context,
MaterialPageRoute(builder: (context) => RoutinePeriodSelection()));
void goToRegister(context) => Navigator.push(context,
MaterialPageRoute(builder: (context) => RegisterPage()));
}
import 'package:flutter/material.dart';
import 'package:notar_e_anotar_app/pages/routine_period_selection.dart';
import 'package:notar_e_anotar_app/styles/global_styles.dart';
import 'package:notar_e_anotar_app/widgets/button_widget.dart';
class RegisterPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
body:
Column(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.end,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Padding(
padding: EdgeInsets.only(left: 16, top: 42),
child: Align(
alignment: Alignment.topLeft,
child: Row(
children: [
GestureDetector(
onTap: () => {
Navigator.of(context).pop()
},
child:
Icon(
Icons.arrow_back,
color: primary,
),
),
SizedBox(width: 16),
Text("Cadastro de usuário",
style: TextStyle(
color: primary, fontSize: 24))
],
)
)
),
Padding(
padding: EdgeInsets.only(left: 16, top: 24),
child: Align(
alignment: Alignment.topLeft,
child: Text("Faça seu cadastro abaixo",
style: TextStyle(
color: grey, fontSize: 18)))
),
Expanded(
child: Container(
margin: const EdgeInsets.only(top: 4),
color: Colors.transparent,
child: Container(
padding: EdgeInsets.only(left: 16, right: 16),
decoration: BoxDecoration(
color: backgroundGrey,
borderRadius: BorderRadius.only(
topLeft: const Radius.circular(24.0),
topRight: const Radius.circular(24.0),
)),
child:
SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
SizedBox(height: 16),
TextFormField(
cursorColor: Theme.of(context).cursorColor,
style: TextStyle(color: primary),
decoration: InputDecoration(
labelText: 'Nome do responsável',
labelStyle: TextStyle(
color: primary,
),
filled: true,
fillColor: primaryFaded,
enabledBorder: UnderlineInputBorder(
borderSide: BorderSide(color: primary),
),
),
),
SizedBox(height: 12),
TextFormField(
cursorColor: Theme.of(context).cursorColor,
style: TextStyle(color: primary),
decoration: InputDecoration(
labelText: 'Sobrenome do responsável',
labelStyle: TextStyle(
color: primary,
),
filled: true,
fillColor: primaryFaded,
enabledBorder: UnderlineInputBorder(
borderSide: BorderSide(color: primary),
),
),
),
SizedBox(height: 12),
TextFormField(
cursorColor: Theme.of(context).cursorColor,
style: TextStyle(color: primary),
decoration: InputDecoration(
labelText: 'Nome do dependente',
labelStyle: TextStyle(
color: primary,
),
filled: true,
fillColor: primaryFaded,
enabledBorder: UnderlineInputBorder(
borderSide: BorderSide(color: primary),
),
),
),
SizedBox(height: 12),
TextFormField(
cursorColor: Theme.of(context).cursorColor,
style: TextStyle(color: primary),
decoration: InputDecoration(
labelText: 'E-mail',
labelStyle: TextStyle(
color: primary,
),
filled: true,
fillColor: primaryFaded,
enabledBorder: UnderlineInputBorder(
borderSide: BorderSide(color: primary),
),
),
),
SizedBox(height: 12),
TextFormField(
obscureText: true,
cursorColor: Theme.of(context).cursorColor,
style: TextStyle(color: primary),
decoration: InputDecoration(
labelText: 'Senha',
suffixIcon: Icon(
Icons.remove_red_eye,
color: primary,
),
labelStyle: TextStyle(color: Theme.of(context).primaryColor),
filled: true,
fillColor: primaryFaded,
enabledBorder: UnderlineInputBorder(
borderSide: BorderSide(color: Theme.of(context).primaryColor)),
),
),
SizedBox(height: 16),
],
),
)
)
)
),
Container (
color: backgroundWhite,
child: Padding(
padding: EdgeInsets.all(16),
child: Row(
children: [
Expanded (
child: ButtonWidget(
text: 'Finalizar',
onClicked: () => goToHomePage(context),
),
)
],
),
),
)
],
),
);
}
void goToHomePage(context) => Navigator.push(context,
MaterialPageRoute(builder: (context) => RoutinePeriodSelection()));
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment