Skip to content

Commit

Permalink
Merge pull request #9 from softeng-feup/acitivity-creator
Browse files Browse the repository at this point in the history
Custom sessions done
  • Loading branch information
daviddias99 authored Dec 8, 2019
2 parents 7cde6b7 + 7748510 commit e74bf31
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 12 deletions.
2 changes: 1 addition & 1 deletion AMA/lib/constants/Utility.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const String aboutText = "Hello, and welcome to AMA, an agenda mobile app for th

const String noSessionsTitle = "This schedule has no sessions!";

const String noSessionsText = "Tap the ADD button in order to discover all the sessions available to you on this day! Swipe left on a session and click the green button to add it to the schedule, or click on the session to learn more about it.";
const String noSessionsText = "Tap the ADD button in order to discover all the sessions available to you on this day! \n\nSwipe left on a session and click the green button to add it to the schedule, or click on the session to learn more about it.\n\nAlternatively, you can go to the \"Activity Creator\" menu in order to create your own custom sessions!";

const int scanTimeBLE = 5;
const int numMinutesForSessionBLE = 30;
Expand Down
2 changes: 1 addition & 1 deletion AMA/lib/controller/database/DatabaseMapper.dart
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class DatabaseMapper {


static Future<List<String>> getLocationsByOrder(Database db) async {
var results = await db.rawQuery('SELECT DISTINCT location FROM Session ORDER BY location COLLATE NOCASE ASC');
var results = await db.rawQuery('SELECT DISTINCT location FROM Session WHERE isCustom = 0 ORDER BY location COLLATE NOCASE ASC');
List<String> locations = [];
for(int i = 0; i < results.length; i++) {
locations.add(results.elementAt(i)['location']);
Expand Down
1 change: 0 additions & 1 deletion AMA/lib/controller/json/JsonMapper.dart
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ class JsonMapper {

static Session session(Map<String, dynamic> json) {

print(json['Day'] + ' ' + json['Time'].substring(0, 5) + ':00');
return Session(
title: json['Title'] as String,
key: json['Key'] as String,
Expand Down
2 changes: 1 addition & 1 deletion AMA/lib/view/components/CreatorForm.dart
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ class CreatorFormState extends State<CreatorForm> {

Controller.instance().addSession(newSession);
Controller.instance().addSessionToSchedule(newSession);

Navigator.of(context).pop();
},
tooltip: 'Scan',
backgroundColor: bgColor,
Expand Down
26 changes: 18 additions & 8 deletions AMA/lib/view/components/SessionContainer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -111,15 +111,15 @@ class SessionContainer extends StatelessWidget {

if (this.activity.description == "") {
text = Text(
'- ' + "No description available",
"No description available",
maxLines: 4,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.justify,
style: TextStyle(color: Colors.black38),
);
} else
text = Text(
'- ' + this.activity.description,
this.activity.description,
maxLines: 2,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.justify,
Expand Down Expand Up @@ -209,12 +209,22 @@ class SessionContainer extends StatelessWidget {
Widget drawLocationCustom() {
Text locationText;

locationText = Text(
this.activity.location,
maxLines: 1,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.justify,
);
if (this.activity.location != "") {
locationText = Text(
this.activity.location,
maxLines: 1,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.justify,
);
} else {
locationText = Text(
"No location available",
maxLines: 1,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.justify,
style: TextStyle(color: Colors.black38),
);
}

return Row(
children: <Widget>[
Expand Down

0 comments on commit e74bf31

Please sign in to comment.