fix all build context warnings

master
Haslinger Stefan (extern) 2023-05-02 08:15:49 +02:00
parent 9382fc9ef9
commit e6352a33bc
32 changed files with 560 additions and 409 deletions

File diff suppressed because one or more lines are too long

View File

@ -26,8 +26,6 @@ linter:
# `// ignore_for_file: name_of_lint` syntax on the line or in the file
# producing the lint.
rules:
# FIXME: HAS20230406: At least as long as https://github.com/dart-lang/linter/issues/3943 is open
use_build_context_synchronously: false
# avoid_print: false # Uncomment to disable the `avoid_print` rule
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule

View File

@ -13,6 +13,7 @@ Future<void> analyseActivities({
int index = 0;
int percent;
if (context.mounted) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
duration: const Duration(seconds: 5),
@ -24,24 +25,33 @@ Future<void> analyseActivities({
),
),
);
}
for (final Activity activity in activities) {
index += 1;
await activity.setAverages();
if (context.mounted) {
ScaffoldMessenger.of(context).removeCurrentSnackBar();
}
percent = 100 * index ~/ activities.length;
if (context.mounted) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
duration: const Duration(seconds: 2),
content: Row(children: [
CircularProgressIndicator(value: percent / 100, color: MyColor.progress),
CircularProgressIndicator(
value: percent / 100, color: MyColor.progress),
Text(' recalculating »${activity.name}«')
]),
),
);
}
}
if (context.mounted) {
ScaffoldMessenger.of(context).removeCurrentSnackBar();
}
if (context.mounted) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
duration: const Duration(seconds: 5),
@ -54,3 +64,4 @@ Future<void> analyseActivities({
),
);
}
}

View File

@ -10,6 +10,7 @@ Future<void> autoTagging({
required Athlete athlete,
}) async {
if (await athlete.checkForSchemas()) {
if (context.mounted) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
duration: const Duration(seconds: 5),
@ -21,6 +22,7 @@ Future<void> autoTagging({
),
),
);
}
List<Activity> activities;
activities = await athlete.activities;
@ -28,6 +30,7 @@ Future<void> autoTagging({
int percent;
await TagGroup.deleteAllAutoTags(athlete: athlete);
if (context.mounted) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
duration: const Duration(seconds: 2),
@ -39,27 +42,36 @@ Future<void> autoTagging({
),
),
);
}
for (final Activity activity in activities) {
index += 1;
await activity.autoTagger(athlete: athlete);
if (context.mounted) {
ScaffoldMessenger.of(context).removeCurrentSnackBar();
}
percent = 100 * index ~/ activities.length;
if (context.mounted) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
duration: const Duration(seconds: 2),
content: Row(
children: [
CircularProgressIndicator(value: percent / 100, color: MyColor.progress),
CircularProgressIndicator(
value: percent / 100, color: MyColor.progress),
Text(' $percent% done (autotagging »${activity.name}« )'),
],
),
),
);
}
}
if (context.mounted) {
ScaffoldMessenger.of(context).removeCurrentSnackBar();
}
if (context.mounted) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
duration: const Duration(seconds: 5),
@ -71,7 +83,9 @@ Future<void> autoTagging({
),
),
);
}
} else {
if (context.mounted) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
duration: const Duration(seconds: 5),
@ -86,3 +100,4 @@ Future<void> autoTagging({
);
}
}
}

View File

@ -21,6 +21,7 @@ Future<void> downloadActivity({
await activity.download(athlete: athlete);
if (context.mounted) {
ScaffoldMessenger.of(context).removeCurrentSnackBar();
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
@ -34,3 +35,4 @@ Future<void> downloadActivity({
),
);
}
}

View File

@ -24,6 +24,7 @@ Future<void> downloadDemoData({
'upper_palatinate_winter_challenge_half_marathon.fit',
];
if (context.mounted) {
ScaffoldMessenger.of(context).removeCurrentSnackBar();
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
@ -35,6 +36,7 @@ Future<void> downloadDemoData({
),
),
);
}
for (final String filename in fileNames) {
final Activity activity = Activity.fromLocalDirectory(athlete: athlete);
@ -52,19 +54,23 @@ Future<void> downloadDemoData({
activity.excluded != true)
.toList();
for (final Activity activity in downloadedActivities) {
if (context.mounted) {
await parseActivity(
context: context,
activity: activity,
athlete: athlete,
);
}
if (context.mounted) {
ScaffoldMessenger.of(context).removeCurrentSnackBar();
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text(' Tagging »${activity.name}«')),
);
}
await activity.autoTagger(athlete: athlete);
}
if (context.mounted) {
ScaffoldMessenger.of(context).removeCurrentSnackBar();
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
@ -76,7 +82,9 @@ Future<void> downloadDemoData({
),
),
);
}
} else {
if (context.mounted) {
ScaffoldMessenger.of(context).removeCurrentSnackBar();
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(
@ -86,3 +94,4 @@ Future<void> downloadDemoData({
);
}
}
}

View File

@ -23,6 +23,7 @@ Future<void> importActivitiesLocally({
);
await Activity.importFromLocalDirectory(athlete: athlete);
if (context.mounted) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
duration: const Duration(seconds: 1),
@ -34,6 +35,7 @@ Future<void> importActivitiesLocally({
),
),
);
}
activities = await athlete.activities;
final List<Activity> downloadedActivities = activities
@ -44,13 +46,17 @@ Future<void> importActivitiesLocally({
activity.excluded != true)
.toList();
for (final Activity activity in downloadedActivities) {
if (context.mounted) {
await parseActivity(
context: context,
activity: activity,
athlete: athlete,
);
}
await activity.autoTagger(athlete: athlete);
}
if (context.mounted) {
ScaffoldMessenger.of(context).removeCurrentSnackBar();
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
@ -64,3 +70,4 @@ Future<void> importActivitiesLocally({
),
);
}
}

View File

@ -60,8 +60,9 @@ Future<void> parseActivity({
await log.save();
activity.nonParsable = true;
await activity.save();
ScaffoldMessenger.of(context).removeCurrentSnackBar();
if (context.mounted) {
ScaffoldMessenger.of(context).removeCurrentSnackBar();
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(
duration: Duration(seconds: 2),
@ -69,3 +70,4 @@ Future<void> parseActivity({
);
}
}
}

View File

@ -19,6 +19,7 @@ Future<void> queryStrava({
);
await athlete.queryStrava();
if (context.mounted) {
ScaffoldMessenger.of(context).removeCurrentSnackBar();
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
@ -32,3 +33,4 @@ Future<void> queryStrava({
),
);
}
}

View File

@ -25,10 +25,13 @@ Future<void> setupDemoAthlete({
weight.date = DateTime(2015);
await weight.save();
if (context.mounted) {
await downloadDemoData(
context: context,
athlete: athlete,
);
}
if (context.mounted) {
ScaffoldMessenger.of(context).removeCurrentSnackBar();
}
}

View File

@ -13,21 +13,25 @@ Future<void> updateJob({
List<Activity> activities;
if (await athlete.checkForSchemas()) {
if (context.mounted) {
await queryStrava(
context: context,
athlete: athlete,
);
}
activities = await athlete.activities;
final Iterable<Activity> newActivities =
activities.where((Activity activity) => activity.state == 'new');
for (final Activity activity in newActivities) {
if (context.mounted) {
await downloadActivity(
context: context,
activity: activity,
athlete: athlete,
);
}
}
final Iterable<Activity> downloadedActivities = activities.where(
(Activity activity) =>
@ -36,13 +40,17 @@ Future<void> updateJob({
activity.nonParsable != true &&
activity.excluded != true);
for (final Activity activity in downloadedActivities) {
if (context.mounted) {
await parseActivity(
context: context,
activity: activity,
athlete: athlete,
);
}
await activity.autoTagger(athlete: athlete);
}
if (context.mounted) {
ScaffoldMessenger.of(context).removeCurrentSnackBar();
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
@ -55,7 +63,9 @@ Future<void> updateJob({
),
),
);
}
} else {
if (context.mounted) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
duration: const Duration(seconds: 5),
@ -70,3 +80,4 @@ Future<void> updateJob({
);
}
}
}

View File

@ -189,8 +189,10 @@ class AddHeartRateZoneSchemaScreenState
Future<void> saveHeartRateZoneSchema(BuildContext context) async {
await widget.heartRateZoneSchema.save();
await HeartRateZone.upsertAll(heartRateZones);
if (context.mounted) {
Navigator.of(context).pop();
}
}
Future<void> getData() async {
heartRateZones = await widget.heartRateZoneSchema.heartRateZones;
@ -200,8 +202,10 @@ class AddHeartRateZoneSchemaScreenState
Future<void> deleteHeartRateZoneSchema(
{required HeartRateZoneSchema heartRateZoneSchema}) async {
await heartRateZoneSchema.delete();
if (context.mounted) {
Navigator.of(context).pop();
}
}
void updateHeartRateZoneBase({int? base}) {
setState(() {
@ -227,16 +231,19 @@ class AddHeartRateZoneSchemaScreenState
}
await HeartRateZone.upsertAll(heartRateZones);
await getData();
if (context.mounted) {
showDialog<BuildContext>(
context: context,
builder: (_) => AlertDialog(
builder: (_) =>
AlertDialog(
title: const Text('Heart Rate Zone Schema has been copied'),
content: const Text(
'If you only wanted to fix the date you need to delete the old heart'
' rate zone schema manually.'),
actions: <Widget>[
ElevatedButton(
style: MyButtonStyle.raisedButtonStyle(color: MyColor.primary),
style: MyButtonStyle.raisedButtonStyle(
color: MyColor.primary),
child: const Text('OK'),
onPressed: () => Navigator.of(context).pop(),
),
@ -245,3 +252,4 @@ class AddHeartRateZoneSchemaScreenState
);
}
}
}

View File

@ -169,11 +169,15 @@ class AddHeartRateZoneScreenState extends State<AddHeartRateZoneScreen> {
Future<void> saveHeartRateZone(BuildContext context) async {
await widget.heartRateZone!.save();
if (context.mounted) {
Navigator.of(context).pop();
}
}
Future<void> deleteHeartRateZone(BuildContext context) async {
await widget.heartRateZone!.delete();
if (context.mounted) {
Navigator.of(context).pop();
}
}
}

View File

@ -182,8 +182,10 @@ class AddPowerZoneSchemaScreenState extends State<AddPowerZoneSchemaScreen> {
Future<void> savePowerZoneSchema(BuildContext context) async {
await widget.powerZoneSchema.save();
await PowerZone.upsertAll(powerZones);
if (context.mounted) {
Navigator.of(context).pop();
}
}
Future<void> getData() async {
powerZones = await widget.powerZoneSchema.powerZones;
@ -193,8 +195,10 @@ class AddPowerZoneSchemaScreenState extends State<AddPowerZoneSchemaScreen> {
Future<void> deletePowerZoneSchema(
{required PowerZoneSchema powerZoneSchema}) async {
await powerZoneSchema.delete();
if (context.mounted) {
Navigator.of(context).pop();
}
}
Future<void>? updatePowerZoneBase({int? base}) {
setState(() {
@ -221,16 +225,20 @@ class AddPowerZoneSchemaScreenState extends State<AddPowerZoneSchemaScreen> {
}
await PowerZone.upsertAll(powerZones);
await getData();
if (context.mounted) {
showDialog<BuildContext>(
context: context,
builder: (_) => AlertDialog(
builder: (_) =>
AlertDialog(
title: const Text('Power Zone Schema has been copied'),
content: const Text(
'If you only wanted to fix the date you need to delete the old '
'power zone schema manually.'),
actions: <Widget>[
ElevatedButton(
style: MyButtonStyle.raisedButtonStyle(color: MyColor.primary),
style: MyButtonStyle.raisedButtonStyle(
color: MyColor.primary),
child: const Text('OK'),
onPressed: () => Navigator.of(context).pop(),
),
@ -239,3 +247,4 @@ class AddPowerZoneSchemaScreenState extends State<AddPowerZoneSchemaScreen> {
);
}
}
}

View File

@ -166,11 +166,15 @@ class AddPowerZoneScreenState extends State<AddPowerZoneScreen> {
Future<void> savePowerZone(BuildContext context) async {
await widget.powerZone!.save();
if (context.mounted) {
Navigator.of(context).pop();
}
}
Future<void> deletePowerZone(BuildContext context) async {
await widget.powerZone!.delete();
if (context.mounted) {
Navigator.of(context).pop();
}
}
}

View File

@ -180,8 +180,10 @@ class AddTagGroupScreenState extends State<AddTagGroupScreen> {
Future<void> saveTagGroup(BuildContext context) async {
await widget.tagGroup!.save();
await Tag.upsertAll(tags);
if (context.mounted) {
Navigator.of(context).pop();
}
}
Future<void> getData() async {
tags = await widget.tagGroup!.tags;
@ -190,6 +192,8 @@ class AddTagGroupScreenState extends State<AddTagGroupScreen> {
Future<void> deleteTagGroup({required TagGroup tagGroup}) async {
await tagGroup.delete();
if (context.mounted) {
Navigator.of(context).pop();
}
}
}

View File

@ -105,11 +105,15 @@ class AddTagScreenState extends State<AddTagScreen> {
Future<void> saveTag(BuildContext context) async {
await widget.tag!.save();
if (context.mounted) {
Navigator.of(context).pop();
}
}
Future<void> deleteTag(BuildContext context) async {
await widget.tag!.delete();
if (context.mounted) {
Navigator.of(context).pop();
}
}
}

View File

@ -66,11 +66,15 @@ class AddWeightScreen extends StatelessWidget {
Future<void> saveWeight(BuildContext context) async {
await weight!.save();
if (context.mounted) {
Navigator.of(context).pop();
}
}
Future<void> deleteWeight(BuildContext context) async {
await weight!.delete();
if (context.mounted) {
Navigator.of(context).pop();
}
}
}

View File

@ -52,6 +52,7 @@ class DashboardState extends State<Dashboard> {
title: Text('${athlete.firstName} ${athlete.lastName}'),
onTap: () async {
await athlete.readCredentials();
if (context.mounted) {
await Navigator.push(
context,
MaterialPageRoute<BuildContext>(
@ -59,6 +60,7 @@ class DashboardState extends State<Dashboard> {
ShowAthleteScreen(athlete: athlete),
),
);
}
await getData();
},
),
@ -107,6 +109,7 @@ class DashboardState extends State<Dashboard> {
athletes = await Athlete.all();
logs = await Log.one();
if (athletes.isEmpty) {
if (context.mounted) {
await Navigator.pushReplacement(
context,
MaterialPageRoute<BuildContext>(
@ -114,6 +117,7 @@ class DashboardState extends State<Dashboard> {
const OnboardingIntroductionScreen(),
),
);
}
} else {
final PackageInfo packageInfo = await PackageInfo.fromPlatform();
version = packageInfo.version;

View File

@ -74,6 +74,7 @@ class EditEventScreenState extends State<EditEventScreen> {
firstDate: DateTime(1969),
initialDate: currentValue ?? DateTime.now(),
lastDate: DateTime(2100));
if (context.mounted) {
if (date != null) {
final TimeOfDay? time = await showTimePicker(
context: context,
@ -84,6 +85,9 @@ class EditEventScreenState extends State<EditEventScreen> {
} else {
return currentValue;
}
} else {
return currentValue;
}
},
onChanged: (DateTime? value) =>
widget.record!.timeStamp = value,
@ -270,7 +274,9 @@ class EditEventScreenState extends State<EditEventScreen> {
child: MyButton.save(
onPressed: () async {
await widget.record!.save();
if (context.mounted) {
Navigator.of(context).pop();
}
},
),
),

View File

@ -71,6 +71,7 @@ class OnBoardingBodyWeightScreenState
Future<void> nextButton() async {
await widget.athlete!.save();
debugPrint('OK');
if (context.mounted) {
Navigator.pushReplacement(
context,
MaterialPageRoute<BuildContext>(
@ -79,3 +80,4 @@ class OnBoardingBodyWeightScreenState
);
}
}
}

View File

@ -55,6 +55,7 @@ class OnboardingCreateUserScreenState
child: const Text('Create Demo User'),
onPressed: () async {
await setupDemoAthlete(context: context);
if (context.mounted) {
await Navigator.pushReplacement(
context,
MaterialPageRoute<BuildContext>(
@ -62,6 +63,7 @@ class OnboardingCreateUserScreenState
const OnboardingFinishedScreen(),
),
);
}
},
)
],
@ -95,6 +97,7 @@ class OnboardingCreateUserScreenState
StravaGetUser(athlete: athlete),
),
);
if (context.mounted) {
Navigator.pushReplacement(
context,
MaterialPageRoute<BuildContext>(
@ -103,6 +106,7 @@ class OnboardingCreateUserScreenState
athlete: athlete),
),
);
}
},
)
],

View File

@ -77,13 +77,16 @@ class OnBoardingHeartRateZoneSchemaScreenState
Future<void> nextButton() async {
await widget.athlete!.save();
if (context.mounted) {
Navigator.pushReplacement(
context,
MaterialPageRoute<BuildContext>(
builder: (BuildContext _) => OnBoardingBodyWeightScreen(
builder: (BuildContext _) =>
OnBoardingBodyWeightScreen(
athlete: widget.athlete,
),
),
);
}
}
}

View File

@ -75,13 +75,16 @@ class OnBoardingPowerZoneSchemaScreenState
Future<void> nextButton() async {
await widget.athlete!.save();
if (context.mounted) {
Navigator.pushReplacement(
context,
MaterialPageRoute<BuildContext>(
builder: (BuildContext _) => OnBoardingHeartRateZoneSchemaScreen(
builder: (BuildContext _) =>
OnBoardingHeartRateZoneSchemaScreen(
athlete: widget.athlete,
),
),
);
}
}
}

View File

@ -474,6 +474,7 @@ class ShowActivityScreenState extends State<ShowActivityScreen> {
await widget.activity.autoTagger(athlete: widget.athlete);
if (context.mounted) {
ScaffoldMessenger.of(context).removeCurrentSnackBar();
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
@ -486,6 +487,7 @@ class ShowActivityScreenState extends State<ShowActivityScreen> {
),
),
);
}
setState(() {});
}
@ -503,8 +505,10 @@ class ShowActivityScreenState extends State<ShowActivityScreen> {
Future<void> delete() async {
await widget.activity.delete();
if (context.mounted) {
Navigator.of(context).pop();
}
}
Future<void> download() async {
ScaffoldMessenger.of(context).showSnackBar(
@ -521,6 +525,7 @@ class ShowActivityScreenState extends State<ShowActivityScreen> {
await widget.activity.download(athlete: widget.athlete);
if (context.mounted) {
ScaffoldMessenger.of(context).removeCurrentSnackBar();
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
@ -533,8 +538,10 @@ class ShowActivityScreenState extends State<ShowActivityScreen> {
),
),
);
}
await parse();
if (context.mounted) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
duration: const Duration(seconds: 2),
@ -542,6 +549,7 @@ class ShowActivityScreenState extends State<ShowActivityScreen> {
),
);
}
}
Future<void> parse() async {
ScaffoldMessenger.of(context).showSnackBar(

View File

@ -332,13 +332,16 @@ class ShowAthleteScreenState extends State<ShowAthleteScreen> {
Future<void> goToEditAthleteScreen({required Athlete athlete}) async {
await athlete.readCredentials();
if (context.mounted) {
await Navigator.push(
context,
MaterialPageRoute<BuildContext>(
builder: (BuildContext context) => EditAthleteScreen(athlete: athlete),
builder: (BuildContext context) =>
EditAthleteScreen(athlete: athlete),
),
);
}
}
Future<void> goToEditActivityScreen({required Athlete athlete}) async {
final Activity activity = Activity.manual(athlete: athlete);

View File

@ -177,7 +177,9 @@ class ShowIntervalScreen extends StatelessWidget {
onPressed: () async {
await interval.delete();
activity!.cachedIntervals = <encrateia.Interval>[];
if (context.mounted) {
Navigator.of(context).pop();
}
},
),
];
@ -215,8 +217,7 @@ class ShowIntervalScreen extends StatelessWidget {
}) {
return ElevatedButton.icon(
style: MyButtonStyle.raisedButtonStyle(
color: color,
textColor: MyColor.textColor(backgroundColor: color)),
color: color, textColor: MyColor.textColor(backgroundColor: color)),
icon: icon,
label: Expanded(
child: Text(title),

View File

@ -64,7 +64,9 @@ class StravaGetUserState extends State<StravaGetUser> {
setState(() {});
}
if (widget.athlete.state == 'fromStrava') {
if (context.mounted) {
Navigator.of(context).pop();
}
}
}
}

View File

@ -113,6 +113,7 @@ class ActivitiesListWidgetState extends State<ActivitiesListWidget> {
);
await activity.download(athlete: widget.athlete);
if (context.mounted) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
duration: const Duration(seconds: 3),
@ -124,6 +125,7 @@ class ActivitiesListWidgetState extends State<ActivitiesListWidget> {
),
),
);
}
setState(() {});
}

View File

@ -60,6 +60,7 @@ class EditActivityWidgetState extends State<EditActivityWidget> {
firstDate: DateTime(1969),
initialDate: currentValue ?? DateTime.now(),
lastDate: DateTime(2100));
if (context.mounted) {
if (date != null) {
final TimeOfDay? time = await showTimePicker(
context: context,
@ -70,6 +71,9 @@ class EditActivityWidgetState extends State<EditActivityWidget> {
} else {
return currentValue;
}
} else {
return currentValue;
}
},
onChanged: (DateTime? value) {
widget.activity!.timeStamp = value;
@ -194,7 +198,9 @@ class EditActivityWidgetState extends State<EditActivityWidget> {
child: MyButton.save(
onPressed: () async {
await widget.activity!.save();
if (context.mounted) {
Navigator.of(context).pop();
}
},
),
),

View File

@ -72,6 +72,7 @@ class EditStandaloneAthleteWidgetState
final List<PowerZoneSchema> powerZoneSchemas =
await widget.athlete!.powerZoneSchemas;
if (powerZoneSchemas.isEmpty) {
if (context.mounted) {
Navigator.pushReplacement(
context,
MaterialPageRoute<BuildContext>(
@ -79,8 +80,11 @@ class EditStandaloneAthleteWidgetState
OnBoardingPowerZoneSchemaScreen(athlete: widget.athlete),
),
);
}
} else {
if (context.mounted) {
Navigator.of(context).pop();
}
}
}
}

View File

@ -81,6 +81,7 @@ class EditStravaAthleteWidgetState extends State<EditStravaAthleteWidget> {
Future<void> saveStravaUser(BuildContext context) async {
await widget.athlete!.save();
await widget.athlete!.storeCredentials();
if (context.mounted) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
duration: const Duration(seconds: 10),
@ -92,10 +93,12 @@ class EditStravaAthleteWidgetState extends State<EditStravaAthleteWidget> {
),
),
);
}
if (await StravaFitDownload.credentialsAreValid(athlete: widget.athlete!)) {
final List<PowerZoneSchema> powerZoneSchemas =
await widget.athlete!.powerZoneSchemas;
if (context.mounted) {
ScaffoldMessenger.of(context).removeCurrentSnackBar();
if (powerZoneSchemas.isEmpty) {
Navigator.pushReplacement(
@ -105,10 +108,12 @@ class EditStravaAthleteWidgetState extends State<EditStravaAthleteWidget> {
OnBoardingPowerZoneSchemaScreen(athlete: widget.athlete),
),
);
}
} else {
Navigator.of(context).pop();
}
} else {
if (context.mounted) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
duration: const Duration(seconds: 5),
@ -123,3 +128,4 @@ class EditStravaAthleteWidgetState extends State<EditStravaAthleteWidget> {
}
}
}
}