Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue #935 #956

Open
wants to merge 7 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ linter:
# - join_return_with_assignment # not yet tested
- library_names
- library_prefixes
- lines_longer_than_80_chars # not yet tested
#- lines_longer_than_80_chars # not yet tested
- list_remove_unrelated_type
# - literal_only_boolean_expressions # too many false positives: https://github.com/dart-lang/sdk/issues/34181
- no_adjacent_strings_in_list
Expand Down
149 changes: 62 additions & 87 deletions lib/widgets/weekplan_screen_widgets/activity_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -130,99 +130,72 @@ class ActivityCard extends StatelessWidget {
);
}

if (_activity.chosenActivity != -1 &&
weekModeSnapShot.data != WeekplanMode.guardian) {
return Opacity(
opacity: _shouldActivityBeVisible(weekModeSnapShot, settingsSnapShot)
? 1.0
: 0,
child: Container(
color: theme.GirafColors.white,
margin: EdgeInsets.all(MediaQuery.of(context).size.width * 0.02),
child: FittedBox(
child: Column(
children: <Widget>[
Stack(
children: <Widget>[
Stack(
alignment: AlignmentDirectional.topEnd,
children: <Widget>[
SizedBox(
width: MediaQuery.of(context).size.width,
height: MediaQuery.of(context).size.width,
child: FittedBox(
child: _getPictogram(_activity
.pictograms[_activity.chosenActivity]),
),
),
_buildActivityStateIcon(context, _activityState,
weekModeSnapShot, settingsSnapShot),
_buildTimerIcon(context, _activity),
],
),
Stack(
alignment: AlignmentDirectional.topStart,
children: <Widget>[
_buildAvatarIcon(context),
],
),
],
),
PictogramText(_activity, _user),
],
),
)),
);
} else {
return Container(
decoration: BoxDecoration(
color: theme.GirafColors.white,
border: Border.all(
color: Colors.black,
width: MediaQuery.of(context).size.width * 0.01)),
margin: EdgeInsets.all(MediaQuery.of(context).size.width * 0.02),
child: FittedBox(
child: Column(
// Check if there is more than one activity in the choiceboard
final bool multipleActivities =
_activity.pictograms.length > 1 && _activity.isChoiceBoard;
return Container(
decoration: BoxDecoration(
color: theme.GirafColors.white,
border: Border.all(
color: Colors.black,
width: MediaQuery.of(context).size.width * 0.01,
),
),
margin: EdgeInsets.all(MediaQuery.of(context).size.width * 0.02),
child: FittedBox(
child: Column(
children: <Widget>[
Stack(
children: <Widget>[
Stack(
alignment: AlignmentDirectional.topEnd,
children: <Widget>[
Stack(
alignment: AlignmentDirectional.topEnd,
children: <Widget>[
SizedBox(
width: MediaQuery.of(context).size.width,
height: MediaQuery.of(context).size.width,
child: FittedBox(
child: Stack(
alignment: AlignmentDirectional.center,
children: <Widget>[
SizedBox(
key: const Key('WeekPlanScreenChoiceBoard'),
width: MediaQuery.of(context).size.width,
height: MediaQuery.of(context).size.width,
child: returnGridView(pictograms)),
],
)),
SizedBox(
width: MediaQuery.of(context).size.width,
height: MediaQuery.of(context).size.width,
child: FittedBox(
child: Stack(
alignment: AlignmentDirectional.center,
children: <Widget>[
SizedBox(
key: const Key('WeekPlanScreenChoiceBoard'),
width: MediaQuery.of(context).size.width,
height: MediaQuery.of(context).size.width,
child: returnGridView(pictograms),
),
],
),
_buildActivityStateIcon(context, _activityState,
weekModeSnapShot, settingsSnapShot),
_buildTimerIcon(context, _activity),
],
),
),
Stack(
alignment: AlignmentDirectional.topStart,
children: <Widget>[
_buildAvatarIcon(context),
])
_buildActivityStateIcon(
context,
_activityState,
weekModeSnapShot,
settingsSnapShot),
_buildTimerIcon(context, _activity),
],
),
PictogramText(_activity, _user),
// Remove avatar icon if there are multiple activities in the
// choiceboard
multipleActivities == false
? Stack(
alignment: AlignmentDirectional.topStart,
children: <Widget>[
_buildAvatarIcon(context),
],
)
: Container(),
],
),
));
}
PictogramText(_activity, _user),
],
),
),
);

}


///Returns the correct gridview
Center returnGridView(List<Widget> list) {
return Center(
Expand All @@ -231,15 +204,15 @@ class ActivityCard extends StatelessWidget {
crossAxisCount: 2,
children: List<Widget>.generate(
list.length,
(int index) {
(int index) {
return Padding(
padding: const EdgeInsets.all(15.0),
child: Container(
decoration: BoxDecoration(
border: Border.all(
color: Colors.black,
width: 5,
)),
color: Colors.black,
width: 5,
)),
child: list[index],
),
);
Expand Down Expand Up @@ -415,6 +388,7 @@ class ActivityCard extends StatelessWidget {
});
}


Widget _buildAvatarIcon(BuildContext context) {
return Container(
width: 400,
Expand All @@ -425,7 +399,8 @@ class ActivityCard extends StatelessWidget {
key: Key('PlaceholderAvatar'),
radius: 20,
backgroundImage:
AssetImage('assets/login_screen_background_image.png')),
AssetImage('assets/login_screen_background_image.png')),
));
}

}
Loading