Skip to content

Commit

Permalink
chore: melos format
Browse files Browse the repository at this point in the history
  • Loading branch information
johannesvedder committed Jun 12, 2024
1 parent 664c4f0 commit 398a94a
Show file tree
Hide file tree
Showing 48 changed files with 828 additions and 458 deletions.
12 changes: 8 additions & 4 deletions app/lib/app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,12 @@ import 'package:studyu_core/core.dart';
import 'package:studyu_flutter_common/studyu_flutter_common.dart';

class MyApp extends StatefulWidget {
const MyApp(this.queryParameters, this.appConfig,
{super.key, required this.initialRoute,});
const MyApp(
this.queryParameters,
this.appConfig, {
super.key,
required this.initialRoute,
});
final Map<String, String> queryParameters;
final AppConfig? appConfig;
final String initialRoute;
Expand All @@ -32,8 +36,8 @@ class _MyAppState extends State<MyApp> {
return MultiProvider(
providers: [
ChangeNotifierProvider<AppLanguage>(
create: (context) =>
AppLanguage(AppLocalizations.supportedLocales),),
create: (context) => AppLanguage(AppLocalizations.supportedLocales),
),
ChangeNotifierProvider<AppState>(create: (context) => AppState()),
],
child: Consumer<AppLanguage>(
Expand Down
77 changes: 56 additions & 21 deletions app/lib/routes.dart
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ class Routes {
child: Padding(
padding: const EdgeInsets.all(16),
child: Text(
'No route defined for ${settings.name}.\nThe developers should fix this 👩‍💻',),
'No route defined for ${settings.name}.\nThe developers should fix this 👩‍💻',
),
),
),
),
Expand All @@ -56,62 +57,96 @@ class Routes {
}

static Route<dynamic>? generateRoute(
RouteSettings settings, Map<String, String> queryParameters,) {
RouteSettings settings,
Map<String, String> queryParameters,
) {
final uri = Uri.parse(settings.name!);
switch (uri.path) {
case loading:
return MaterialPageRoute(
builder: (_) => const LoadingScreen(), settings: settings,);
builder: (_) => const LoadingScreen(),
settings: settings,
);
case preview:
return MaterialPageRoute(
builder: (_) => LoadingScreen(queryParameters: queryParameters),
settings: settings,);
builder: (_) => LoadingScreen(queryParameters: queryParameters),
settings: settings,
);
case appOutdated:
return MaterialPageRoute(
builder: (_) => const AppOutdatedScreen(), settings: settings,);
builder: (_) => const AppOutdatedScreen(),
settings: settings,
);
case dashboard:
return MaterialPageRoute(
builder: (_) => const DashboardScreen(), settings: settings,);
builder: (_) => const DashboardScreen(),
settings: settings,
);
case welcome:
return MaterialPageRoute(
builder: (_) => const WelcomeScreen(), settings: settings,);
builder: (_) => const WelcomeScreen(),
settings: settings,
);
case about:
return MaterialPageRoute(
builder: (_) => const AboutScreen(), settings: settings,);
builder: (_) => const AboutScreen(),
settings: settings,
);
case terms:
return MaterialPageRoute(
builder: (_) => const TermsScreen(), settings: settings,);
builder: (_) => const TermsScreen(),
settings: settings,
);
case studySelection:
return MaterialPageRoute(
builder: (_) => const StudySelectionScreen(), settings: settings,);
builder: (_) => const StudySelectionScreen(),
settings: settings,
);
case studyOverview:
return MaterialPageRoute(
builder: (_) => const StudyOverviewScreen(), settings: settings,);
builder: (_) => const StudyOverviewScreen(),
settings: settings,
);
case interventionSelection:
return MaterialPageRoute(
builder: (_) => const InterventionSelectionScreen(),
settings: settings,);
builder: (_) => const InterventionSelectionScreen(),
settings: settings,
);
case journey:
return MaterialPageRoute(
builder: (_) => const JourneyOverviewScreen(), settings: settings,);
builder: (_) => const JourneyOverviewScreen(),
settings: settings,
);
case consent:
return MaterialPageRoute<bool>(
builder: (_) => const ConsentScreen(), settings: settings,);
builder: (_) => const ConsentScreen(),
settings: settings,
);
case kickoff:
return MaterialPageRoute(
builder: (_) => const KickoffScreen(), settings: settings,);
builder: (_) => const KickoffScreen(),
settings: settings,
);
case contact:
return MaterialPageRoute(
builder: (_) => const ContactScreen(), settings: settings,);
builder: (_) => const ContactScreen(),
settings: settings,
);
case faq:
return MaterialPageRoute(
builder: (_) => const FAQ(), settings: settings,);
builder: (_) => const FAQ(),
settings: settings,
);
case appSettings:
return MaterialPageRoute(
builder: (_) => const Settings(), settings: settings,);
builder: (_) => const Settings(),
settings: settings,
);
case reportHistory:
return MaterialPageRoute(
builder: (_) => const ReportHistoryScreen(), settings: settings,);
builder: (_) => const ReportHistoryScreen(),
settings: settings,
);
default:
//final potentialSessionString = Uri.decodeComponent(settings.name.replaceFirst('/', ''));
//return MaterialPageRoute(builder: (_) => LoadingScreen(sessionString: potentialSessionString));
Expand Down
66 changes: 47 additions & 19 deletions app/lib/screens/app_onboarding/about.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,11 @@ class AboutScreen extends StatelessWidget {
Icon(MdiIcons.equal, size: 80, color: Colors.black),
),
Expanded(
child: Icon(MdiIcons.sleepOff,
size: 80, color: Colors.black,),
child: Icon(
MdiIcons.sleepOff,
size: 80,
color: Colors.black,
),
),
],
),
Expand Down Expand Up @@ -108,8 +111,11 @@ class AboutScreen extends StatelessWidget {
Row(
children: [
Expanded(
child: Icon(MdiIcons.accountQuestion,
size: 80, color: Colors.blue,),
child: Icon(
MdiIcons.accountQuestion,
size: 80,
color: Colors.blue,
),
),
],
),
Expand Down Expand Up @@ -145,8 +151,11 @@ class AboutScreen extends StatelessWidget {
Row(
children: [
Expanded(
child: Icon(MdiIcons.exclamationThick,
size: 80, color: Colors.blue,),
child: Icon(
MdiIcons.exclamationThick,
size: 80,
color: Colors.blue,
),
),
],
),
Expand Down Expand Up @@ -182,8 +191,11 @@ class AboutScreen extends StatelessWidget {
Row(
children: [
Expanded(
child: Icon(MdiIcons.alphaNBoxOutline,
size: 80, color: Colors.blue,),
child: Icon(
MdiIcons.alphaNBoxOutline,
size: 80,
color: Colors.blue,
),
),
const Expanded(
child: Text(
Expand All @@ -193,8 +205,11 @@ class AboutScreen extends StatelessWidget {
),
),
Expanded(
child: Icon(MdiIcons.numeric1BoxOutline,
size: 80, color: Colors.blue,),
child: Icon(
MdiIcons.numeric1BoxOutline,
size: 80,
color: Colors.blue,
),
),
],
),
Expand Down Expand Up @@ -230,8 +245,11 @@ class AboutScreen extends StatelessWidget {
Row(
children: [
Expanded(
child: Icon(MdiIcons.notebookOutline,
size: 80, color: Colors.blue,),
child: Icon(
MdiIcons.notebookOutline,
size: 80,
color: Colors.blue,
),
),
],
),
Expand Down Expand Up @@ -267,8 +285,11 @@ class AboutScreen extends StatelessWidget {
Row(
children: [
Expanded(
child: Icon(MdiIcons.alignVerticalBottom,
size: 80, color: Colors.blue,),
child: Icon(
MdiIcons.alignVerticalBottom,
size: 80,
color: Colors.blue,
),
),
],
),
Expand Down Expand Up @@ -304,8 +325,11 @@ class AboutScreen extends StatelessWidget {
Row(
children: [
Expanded(
child: Icon(MdiIcons.progressCheck,
size: 80, color: Colors.blue,),
child: Icon(
MdiIcons.progressCheck,
size: 80,
color: Colors.blue,
),
),
],
),
Expand Down Expand Up @@ -338,7 +362,9 @@ class AboutScreen extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
const Image(
image: AssetImage('assets/icon/logo.png'), height: 200,),
image: AssetImage('assets/icon/logo.png'),
height: 200,
),
const SizedBox(height: 50),
Text(
AppLocalizations.of(context)!.description_part9,
Expand All @@ -350,8 +376,10 @@ class AboutScreen extends StatelessWidget {
OutlinedButton.icon(
icon: Icon(MdiIcons.rocket),
onPressed: () => Navigator.pushNamed(context, Routes.terms),
label: Text(AppLocalizations.of(context)!.get_started,
style: const TextStyle(fontSize: 20),),
label: Text(
AppLocalizations.of(context)!.get_started,
style: const TextStyle(fontSize: 20),
),
),
],
),
Expand Down
37 changes: 24 additions & 13 deletions app/lib/screens/app_onboarding/app_outdated_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -30,24 +30,35 @@ class AppOutdatedScreen extends StatelessWidget {
children: <Widget>[
const Spacer(),
const Image(
image: AssetImage('assets/icon/logo.png'), height: 200,),
image: AssetImage('assets/icon/logo.png'),
height: 200,
),
const SizedBox(height: 20),
Padding(
padding: const EdgeInsets.all(20),
child: Text(loc.app_outdated_message,
textAlign: TextAlign.center,
style: const TextStyle(fontSize: 20),),
child: Text(
loc.app_outdated_message,
textAlign: TextAlign.center,
style: const TextStyle(fontSize: 20),
),
),
const Spacer(),
if (storeUrl != null && storeIcon != null) OutlinedButton.icon(
icon: Icon(storeIcon),
onPressed: () async {
await launchUrl(Uri.parse(storeUrl!),
mode: LaunchMode.externalNonBrowserApplication,);
},
label: Text(loc.update_now,
style: const TextStyle(fontSize: 20),),
) else const SizedBox.shrink(),
if (storeUrl != null && storeIcon != null)
OutlinedButton.icon(
icon: Icon(storeIcon),
onPressed: () async {
await launchUrl(
Uri.parse(storeUrl!),
mode: LaunchMode.externalNonBrowserApplication,
);
},
label: Text(
loc.update_now,
style: const TextStyle(fontSize: 20),
),
)
else
const SizedBox.shrink(),
const Spacer(),
],
),
Expand Down
6 changes: 4 additions & 2 deletions app/lib/screens/app_onboarding/preview.dart
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,10 @@ class Preview {
}

/// createSubject: If true, the method will return a new StudySubject if none can be found. Otherwise, null is returned
Future<StudySubject?> getStudySubject(AppState state,
{bool createSubject = false,}) async {
Future<StudySubject?> getStudySubject(
AppState state, {
bool createSubject = false,
}) async {
if (selectedStudyObjectId != null) {
try {
if (selectedRoute == '/intervention') {
Expand Down
Loading

0 comments on commit 398a94a

Please sign in to comment.