fixed sevaral warnings and deprecations

master
Haslinger Stefan (extern) 2023-04-06 08:05:10 +02:00
parent ad0bf6e3ca
commit 46967bf6a4
13 changed files with 36 additions and 29 deletions

File diff suppressed because one or more lines are too long

View File

@ -30,8 +30,10 @@ Future<void> deleteAthlete({
MyButton.delete(
onPressed: () async {
await athlete!.delete();
Navigator.of(context)
.popUntil((Route<dynamic> route) => route.isFirst);
if (context.mounted) {
Navigator.of(context)
.popUntil((Route<dynamic> route) => route.isFirst);
}
},
),
],

View File

@ -38,8 +38,8 @@ Future<void> downloadDemoData({
for (final String filename in fileNames) {
final Activity activity = Activity.fromLocalDirectory(athlete: athlete);
await dio.download(downloadDir + filename,
appDocDir.path + '/' + activity.stravaId.toString() + '.fit');
await dio.download(
downloadDir + filename, '${appDocDir.path}/${activity.stravaId}.fit');
await activity.setState('downloaded');
}

View File

@ -194,12 +194,14 @@ class Athlete {
currentStravaClient = stravaClient!;
}
await currentStravaClient.authentication
.authenticate(scopes: <AuthenticationScope>[
AuthenticationScope.read_all,
AuthenticationScope.profile_read_all,
AuthenticationScope.activity_read_all
], redirectUrl: 'stravaflutter://redirect');
await currentStravaClient.authentication.authenticate(
scopes: <AuthenticationScope>[
AuthenticationScope.read_all,
AuthenticationScope.profile_read_all,
AuthenticationScope.activity_read_all
],
redirectUrl: 'stravaflutter://redirect',
callbackUrlScheme: 'stravaflutter');
final DateTime now = DateTime.now();
final DateTime startDate =

View File

@ -16,11 +16,11 @@ class IntroductionTextScreen extends StatelessWidget {
body: SafeArea(
child: Markdown(
onTapLink: (
String _text,
String text,
String? url,
String _title,
String title,
) =>
launch(url!),
launchUrl(url as Uri),
data: '''
## What is Encrateia?

View File

@ -44,12 +44,14 @@ class StravaGetUserState extends State<StravaGetUser> {
final StravaClient stravaClient = StravaClient(
clientId: clientId, secret: secret, applicationName: athlete.uuid);
await stravaClient.authentication
.authenticate(scopes: <AuthenticationScope>[
AuthenticationScope.read_all,
AuthenticationScope.profile_read_all,
AuthenticationScope.activity_read_all
], redirectUrl: 'stravaflutter://redirect');
await stravaClient.authentication.authenticate(
scopes: <AuthenticationScope>[
AuthenticationScope.read_all,
AuthenticationScope.profile_read_all,
AuthenticationScope.activity_read_all
],
redirectUrl: 'stravaflutter://redirect',
callbackUrlScheme: 'stravaflutter');
final DetailedAthlete stravaAthlete =
await stravaClient.athletes.getAuthenticatedAthlete();

View File

@ -3,8 +3,8 @@ import 'package:flutter/material.dart';
class MyButtonStyle extends ButtonStyle {
static ButtonStyle raisedButtonStyle({Color? color, Color? textColor}) {
return ElevatedButton.styleFrom(
onPrimary: textColor ?? Colors.black,
primary: color ?? Colors.grey[300],
foregroundColor: textColor ?? Colors.black,
backgroundColor: color ?? Colors.grey[300],
minimumSize: const Size(88, 36),
padding: const EdgeInsets.symmetric(horizontal: 16),
shape: const RoundedRectangleBorder(

View File

@ -185,9 +185,9 @@ class ActivityBarGraphWidgetState extends State<ActivityBarGraphWidget> {
Future<void> getData() async {
final Activity activity = widget.activity!;
_laps = await activity.laps;
for (final Lap _lap in _laps) {
_lap.powerDistributions = await _lap.powerZoneCounts();
_lap.heartRateDistributions = await _lap.heartRateZoneCounts();
for (final Lap lap in _laps) {
lap.powerDistributions = await lap.powerZoneCounts();
lap.heartRateDistributions = await lap.heartRateZoneCounts();
}
_powerZoneSchema = await activity.powerZoneSchema;

View File

@ -45,7 +45,7 @@ class AthleteHeartRateZoneSchemaWidgetState
child: Text(
'\nHeart Rate Zone Schemas ${offset + 1} - ${offset + rows} '
'of ${heartRateZoneSchemas.length}',
style: Theme.of(context).textTheme.headline6,
style: Theme.of(context).textTheme.titleLarge,
),
),
DataTable(

View File

@ -44,7 +44,7 @@ class AthletePowerZoneSchemaWidgetState
child: Text(
'\nPowerZoneSchemas ${offset + 1} - ${offset + rows} '
'of ${powerZoneSchemas.length}',
style: Theme.of(context).textTheme.headline6,
style: Theme.of(context).textTheme.titleLarge,
),
),
DataTable(

View File

@ -38,7 +38,7 @@ class AthleteTagGroupWidgetState extends State<AthleteTagGroupWidget> {
child: Text(
'\nTag Groups ${offset + 1} - ${offset + rows} '
'of ${tagGroups!.length}',
style: Theme.of(context).textTheme.headline6,
style: Theme.of(context).textTheme.titleLarge,
),
),
DataTable(

View File

@ -194,7 +194,7 @@ packages:
source: hosted
version: "3.1.1"
cookie_jar:
dependency: transitive
dependency: "direct main"
description:
name: cookie_jar
sha256: d1cc6516a190ba667941f722b6365d202caff3dacb38de24268b8d6ff1ec8a1d

View File

@ -10,6 +10,7 @@ dependencies:
community_charts_flutter: ^1.0.1
community_charts_common: ^1.0.1
collection: ^1.17.0
cookie_jar: ^3.0.1
csv: ^5.0.1
cupertino_icons: ^1.0.4
datetime_picker_formfield: ^2.0.0