Skip to content

Commit

Permalink
fix: migration
Browse files Browse the repository at this point in the history
  • Loading branch information
johannesvedder committed Jan 31, 2023
1 parent c4afe51 commit 3ac8f19
Show file tree
Hide file tree
Showing 47 changed files with 86 additions and 91 deletions.
2 changes: 1 addition & 1 deletion app/lib/routes.dart
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class Routes {
case loading:
return MaterialPageRoute(builder: (_) => const LoadingScreen(), settings: settings);
case dashboard:
return MaterialPageRoute(builder: (_) => DashboardScreen(), settings: settings);
return MaterialPageRoute(builder: (_) => const DashboardScreen(), settings: settings);
case welcome:
return MaterialPageRoute(builder: (_) => WelcomeScreen(), settings: settings);
case about:
Expand Down
2 changes: 1 addition & 1 deletion app/lib/screens/app_onboarding/terms.dart
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ class LegalSection extends StatelessWidget {
final theme = Theme.of(context);
return Column(
children: [
Text(title, style: theme.textTheme.headline4.copyWith(color: theme.primaryColor)),
Text(title, style: theme.textTheme.headlineMedium.copyWith(color: theme.primaryColor)),
const SizedBox(height: 20),
Text(description),
const SizedBox(height: 20),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@ class ContactWidget extends StatelessWidget {
return Container();
}

final titles = [Text(title, style: theme.textTheme.headline6.copyWith(color: color))];
final titles = [Text(title, style: theme.textTheme.titleLarge.copyWith(color: color))];
if (subtitle != null && subtitle.isNotEmpty) {
titles.add(Text(subtitle, style: theme.textTheme.subtitle1.copyWith(fontSize: 14)));
titles.add(Text(subtitle, style: theme.textTheme.titleMedium.copyWith(fontSize: 14)));
}

return Column(
Expand Down
1 change: 1 addition & 0 deletions app/lib/screens/study/dashboard/dashboard.dart
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ class _DashboardScreenState extends State<DashboardScreen> {
onTap: () async {
final iconAuthors = ['Kiranshastry'];
final PackageInfo packageInfo = await PackageInfo.fromPlatform();
if(!mounted) return;
showAboutDialog(
context: context,
applicationIcon: const Image(image: AssetImage('assets/images/icon.png'), height: 32),
Expand Down
10 changes: 5 additions & 5 deletions app/lib/screens/study/dashboard/settings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,13 @@ class _SettingsState extends State<Settings> {
const SizedBox(height: 24),
Text(
'${AppLocalizations.of(context).study_current} ${subject.study.title}',
style: theme.textTheme.headline6,
style: theme.textTheme.titleLarge,
),
const SizedBox(height: 8),
ElevatedButton.icon(
icon: const Icon(MdiIcons.exitToApp),
label: Text(AppLocalizations.of(context).opt_out),
style: ElevatedButton.styleFrom(primary: Colors.orange[800]),
style: ElevatedButton.styleFrom(backgroundColor: Colors.orange[800]),
onPressed: () {
showDialog(context: context, builder: (_) => OptOutAlertDialog(subject: subject));
},
Expand All @@ -95,7 +95,7 @@ class _SettingsState extends State<Settings> {
ElevatedButton.icon(
icon: const Icon(Icons.delete),
label: Text(AppLocalizations.of(context).delete_data),
style: ElevatedButton.styleFrom(primary: Colors.red),
style: ElevatedButton.styleFrom(backgroundColor: Colors.red),
onPressed: () {
showDialog(context: context, builder: (_) => DeleteAlertDialog());
},
Expand Down Expand Up @@ -136,7 +136,7 @@ class OptOutAlertDialog extends StatelessWidget {
ElevatedButton.icon(
icon: const Icon(MdiIcons.exitToApp),
label: const Text('Opt-out'),
style: ElevatedButton.styleFrom(primary: Colors.orange[800], elevation: 0),
style: ElevatedButton.styleFrom(backgroundColor: Colors.orange[800], elevation: 0),
onPressed: () async {
subject.delete();
deleteActiveStudyReference();
Expand All @@ -159,7 +159,7 @@ class DeleteAlertDialog extends StatelessWidget {
ElevatedButton.icon(
icon: const Icon(Icons.delete),
label: const Text('Delete all local data'),
style: ElevatedButton.styleFrom(primary: Colors.red, elevation: 0),
style: ElevatedButton.styleFrom(backgroundColor: Colors.red, elevation: 0),
onPressed: () async {
deleteLocalData();
Navigator.pushNamedAndRemoveUntil(context, Routes.welcome, (_) => false);
Expand Down
8 changes: 4 additions & 4 deletions app/lib/screens/study/onboarding/consent.dart
Original file line number Diff line number Diff line change
Expand Up @@ -103,15 +103,15 @@ class _ConsentScreenState extends State<ConsentScreen> {
children: [
TextSpan(
text: AppLocalizations.of(context).please_give_consent,
style: theme.textTheme.subtitle1,
style: theme.textTheme.titleMedium,
),
TextSpan(
text: ' ',
style: theme.textTheme.subtitle1,
style: theme.textTheme.titleMedium,
),
TextSpan(
text: AppLocalizations.of(context).please_give_consent_why,
style: theme.textTheme.subtitle2.copyWith(color: theme.primaryColor),
style: theme.textTheme.titleSmall.copyWith(color: theme.primaryColor),
recognizer: TapGestureRecognizer()
..onTap = () => showDialog(
context: context,
Expand Down Expand Up @@ -212,7 +212,7 @@ class ConsentCard extends StatelessWidget {
children: [
Icon(MdiIcons.fromString(consent.iconName), size: 60, color: Colors.blue),
const SizedBox(height: 10),
Text(consent.title, style: Theme.of(context).textTheme.subtitle2),
Text(consent.title, style: Theme.of(context).textTheme.titleSmall),
],
),
),
Expand Down
6 changes: 3 additions & 3 deletions app/lib/screens/study/onboarding/eligibility_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class _EligibilityScreenState extends State<EligibilityScreen> {
color: Colors.green,
size: 32,
),
content: Text(AppLocalizations.of(context).eligible_yes, style: Theme.of(context).textTheme.subtitle1),
content: Text(AppLocalizations.of(context).eligible_yes, style: Theme.of(context).textTheme.titleMedium),
actions: [Container()],
forceActionsBelow: true,
backgroundColor: Colors.green[50],
Expand All @@ -92,7 +92,7 @@ class _EligibilityScreenState extends State<EligibilityScreen> {
content: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(AppLocalizations.of(context).eligible_no, style: Theme.of(context).textTheme.subtitle1),
Text(AppLocalizations.of(context).eligible_no, style: Theme.of(context).textTheme.titleMedium),
const SizedBox(height: 4),
Text(activeResult.firstFailed.reason),
const SizedBox(height: 4),
Expand Down Expand Up @@ -125,7 +125,7 @@ class _EligibilityScreenState extends State<EligibilityScreen> {
padding: const EdgeInsets.all(8),
child: Text(
AppLocalizations.of(context).please_answer_eligibility,
style: theme.textTheme.subtitle1,
style: theme.textTheme.titleMedium,
),
),
Expanded(
Expand Down
4 changes: 2 additions & 2 deletions app/lib/screens/study/onboarding/intervention_selection.dart
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ class _InterventionSelectionScreenState extends State<InterventionSelectionScree
children: [
Text(
AppLocalizations.of(context).please_select_interventions,
style: theme.textTheme.subtitle1,
style: theme.textTheme.titleMedium,
),
const SizedBox(height: 8),
Text(
AppLocalizations.of(context).please_select_interventions_description,
style: theme.textTheme.bodyText2.copyWith(color: theme.textTheme.caption.color),
style: theme.textTheme.bodyMedium.copyWith(color: theme.textTheme.bodySmall.color),
),
],
),
Expand Down
4 changes: 2 additions & 2 deletions app/lib/screens/study/onboarding/journey_overview.dart
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ class Timeline extends StatelessWidget {
date: now.add(Duration(days: index * subject.study.schedule.phaseDuration)),
isFirst: index == 0,
);
}).toList(),
}),
InterventionTile(
title: AppLocalizations.of(context).journey_results_available,
iconName: 'flagCheckered',
Expand Down Expand Up @@ -144,7 +144,7 @@ class InterventionTile extends StatelessWidget {
beforeLineStyle: LineStyle(color: theme.primaryColor),
afterLineStyle: LineStyle(color: theme.primaryColor),
endChild: TimelineChild(
child: Text(title, style: theme.textTheme.headline6.copyWith(color: theme.primaryColor)),
child: Text(title, style: theme.textTheme.titleLarge.copyWith(color: theme.primaryColor)),
),
startChild: TimelineChild(
child: Text(DateFormat('dd-MM-yyyy').format(date), style: const TextStyle(fontWeight: FontWeight.bold)),
Expand Down
8 changes: 4 additions & 4 deletions app/lib/screens/study/onboarding/study_selection.dart
Original file line number Diff line number Diff line change
Expand Up @@ -39,23 +39,23 @@ class StudySelectionScreen extends StatelessWidget {
children: [
Text(
AppLocalizations.of(context).study_selection_description,
style: theme.textTheme.headline5,
style: theme.textTheme.headlineSmall,
),
const SizedBox(height: 8),
RichText(
text: TextSpan(
children: [
TextSpan(
text: AppLocalizations.of(context).study_selection_single,
style: theme.textTheme.subtitle2,
style: theme.textTheme.titleSmall,
),
TextSpan(
text: ' ',
style: theme.textTheme.subtitle2,
style: theme.textTheme.titleSmall,
),
TextSpan(
text: AppLocalizations.of(context).study_selection_single_why,
style: theme.textTheme.subtitle2.copyWith(color: theme.primaryColor),
style: theme.textTheme.titleSmall.copyWith(color: theme.primaryColor),
recognizer: TapGestureRecognizer()
..onTap = () => showDialog(
context: context,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class PerformanceDetailsScreen extends StatelessWidget {
children: <Widget>[
Padding(
padding: const EdgeInsets.all(8),
child: Text(AppLocalizations.of(context).performance_overview, style: theme.textTheme.subtitle1),
child: Text(AppLocalizations.of(context).performance_overview, style: theme.textTheme.titleMedium),
),
Padding(
padding: const EdgeInsets.all(8),
Expand Down
2 changes: 1 addition & 1 deletion app/lib/screens/study/report/report_history.dart
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class ReportHistoryItem extends StatelessWidget {
),
Text(
subject.study.title,
style: theme.textTheme.headline5.copyWith(color: isActiveStudy ? Colors.white : Colors.black),
style: theme.textTheme.headlineSmall.copyWith(color: isActiveStudy ? Colors.white : Colors.black),
),
],
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class AverageSectionWidget extends ReportSectionWidget {
charts.ChartTitle(
AppLocalizations.of(context).report_axis_phase,
behaviorPosition: charts.BehaviorPosition.bottom,
titleStyleSpec: convertTextTheme(Theme.of(context).textTheme.caption),
titleStyleSpec: convertTextTheme(Theme.of(context).textTheme.bodySmall),
)
],
domainAxis: charts.NumericAxisSpec(
Expand Down
2 changes: 1 addition & 1 deletion app/lib/util/save_pdf.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Future<String> savePDF(BuildContext context, String title, List<pw.Widget> conte

return filePath.split(':')[1];
} catch (e) {
print('Error saving file with FileDialog ${e.toString()}');
print('Error saving file with FileDialog $e');
return null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class _AnnotatedScaleQuestionWidgetState extends State<AnnotatedScaleQuestionWid
}

Widget _constructAnnotationWidgetFor(Annotation annotation, BuildContext context) {
return Text(annotation.annotation, style: Theme.of(context).textTheme.headline6);
return Text(annotation.annotation, style: Theme.of(context).textTheme.titleLarge);
}

List<Widget> _generateAnnotations(BuildContext context) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class _ChoiceQuestionWidgetState extends State<ChoiceQuestionWidget> {
choiceWidgets.add(
ElevatedButton(
onPressed: confirm,
style: ElevatedButton.styleFrom(primary: Theme.of(context).colorScheme.secondary),
style: ElevatedButton.styleFrom(backgroundColor: Theme.of(context).colorScheme.secondary),
child: Text(AppLocalizations.of(context).confirm),
),
);
Expand Down
4 changes: 2 additions & 2 deletions app/lib/widgets/fhir_questionnaire/question_header.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class QuestionHeader extends StatelessWidget {
if (subtitle == null) return [];
return [
const SizedBox(height: 8),
Text(subtitle, style: Theme.of(context).textTheme.caption),
Text(subtitle, style: Theme.of(context).textTheme.bodySmall),
];
}

Expand Down Expand Up @@ -44,7 +44,7 @@ class QuestionHeader extends StatelessWidget {
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(prompt, style: Theme.of(context).textTheme.subtitle1),
Text(prompt, style: Theme.of(context).textTheme.titleMedium),
..._buildSubtitle(context),
],
),
Expand Down
14 changes: 7 additions & 7 deletions app/lib/widgets/intervention_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class InterventionCardTitle extends StatelessWidget {
dense: true,
title: Row(
children: [
Expanded(child: Text(intervention.name, style: theme.textTheme.headline6)),
Expanded(child: Text(intervention.name, style: theme.textTheme.titleLarge)),
if (showDescriptionButton)
IconButton(
icon: const Icon(Icons.info_outline),
Expand All @@ -85,7 +85,7 @@ class InterventionCardTitle extends StatelessWidget {
title: ListTile(
leading: Icon(MdiIcons.fromString(intervention.icon), color: theme.colorScheme.secondary),
dense: true,
title: Text(intervention.name, style: theme.textTheme.headline6),
title: Text(intervention.name, style: theme.textTheme.titleLarge),
),
content: Text(description ?? ''),
);
Expand Down Expand Up @@ -114,7 +114,7 @@ class InterventionCardDescription extends StatelessWidget {
padding: const EdgeInsets.fromLTRB(16, 4, 16, 8),
child: Text(
description,
style: theme.textTheme.bodyText2.copyWith(color: theme.textTheme.caption.color),
style: theme.textTheme.bodyMedium.copyWith(color: theme.textTheme.bodySmall.color),
),
);
}
Expand All @@ -141,7 +141,7 @@ class _TaskList extends StatelessWidget {
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(AppLocalizations.of(context).tasks_daily, style: theme.textTheme.bodyText2),
Text(AppLocalizations.of(context).tasks_daily, style: theme.textTheme.bodyMedium),
],
),
),
Expand All @@ -156,15 +156,15 @@ class _TaskList extends StatelessWidget {
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
child: Row(
children: [
Expanded(child: Text(task.title, style: theme.textTheme.bodyText2)),
Expanded(child: Text(task.title, style: theme.textTheme.bodyMedium)),
Row(
children: [
Icon(Icons.access_time, size: 16, color: theme.textTheme.caption.color),
Icon(Icons.access_time, size: 16, color: theme.textTheme.bodySmall.color),
const SizedBox(width: 4),
Text(
scheduleString(task.schedule.completionPeriods),
style:
theme.textTheme.bodyText2.copyWith(fontSize: 12, color: theme.textTheme.caption.color),
theme.textTheme.bodyMedium.copyWith(fontSize: 12, color: theme.textTheme.bodySmall.color),
),
],
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class _AnnotatedScaleQuestionWidgetState extends State<AnnotatedScaleQuestionWid
}

Widget _constructAnnotationWidgetFor(Annotation annotation, BuildContext context) {
return Text(annotation.annotation, style: Theme.of(context).textTheme.headline6);
return Text(annotation.annotation, style: Theme.of(context).textTheme.titleLarge);
}

List<Widget> _generateAnnotations(BuildContext context) {
Expand Down
4 changes: 2 additions & 2 deletions app/lib/widgets/questionnaire/question_header.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class QuestionHeader extends StatelessWidget {
if (subtitle == null) return [];
return [
const SizedBox(height: 8),
Text(subtitle, style: Theme.of(context).textTheme.caption),
Text(subtitle, style: Theme.of(context).textTheme.bodySmall),
];
}

Expand Down Expand Up @@ -44,7 +44,7 @@ class QuestionHeader extends StatelessWidget {
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(prompt, style: Theme.of(context).textTheme.subtitle1),
Text(prompt, style: Theme.of(context).textTheme.titleMedium),
..._buildSubtitle(context),
],
),
Expand Down
3 changes: 1 addition & 2 deletions app/lib/widgets/selectable_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ class SelectableButton extends StatelessWidget {
height: 48,
child: OutlinedButton(
style: OutlinedButton.styleFrom(
primary: _getTextColor(theme),
backgroundColor: _getFillColor(theme),
foregroundColor: _getTextColor(theme), backgroundColor: _getFillColor(theme),
),
onPressed: onTap,
child: child,
Expand Down
2 changes: 1 addition & 1 deletion app/lib/widgets/study_tile.dart
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class StudyTile extends StatelessWidget {
ListTile(
contentPadding: contentPadding,
onTap: onTap,
title: Center(child: Text(title, style: theme.textTheme.headline6.copyWith(color: theme.primaryColor))),
title: Center(child: Text(title, style: theme.textTheme.titleLarge.copyWith(color: theme.primaryColor))),
subtitle: Center(child: Text(description)),
leading: Icon(MdiIcons.fromString(iconName ?? 'accountHeart'), color: theme.primaryColor),
),
Expand Down
2 changes: 1 addition & 1 deletion core/lib/src/models/questionnaire/answer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class Answer<V> {
DateTime timestamp;

static const String keyResponse = 'response';
@JsonKey(ignore: true)
@JsonKey(includeToJson: false, includeFromJson: false)
late V response;

Answer(this.question, this.timestamp);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ part 'question_conditional.g.dart';
@JsonSerializable()
class QuestionConditional<V> {
static const String keyDefaultValue = 'defaultValue';
@JsonKey(ignore: true)
@JsonKey(includeToJson: false, includeFromJson: false)
V? defaultValue;
late Expression condition;

Expand Down
2 changes: 1 addition & 1 deletion core/lib/src/models/questionnaire/questionnaire_state.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class QuestionnaireState {
if (answer is Answer<T>) {
return answer.response;
} else {
throw ArgumentError("'Answer<${T.toString()}>' requested but found '${answer.runtimeType.toString()}'.");
throw ArgumentError("'Answer<$T>' requested but found '${answer.runtimeType}'.");
}
}
}
Loading

0 comments on commit 3ac8f19

Please sign in to comment.