Commit 2765c370 authored by Administrator's avatar Administrator

converted athlete screen to button table instead of tabview

parent bdaac7be
......@@ -43,13 +43,13 @@ class ShowActivityScreen extends StatelessWidget {
title: "Overview",
icon: MyIcon.overView,
context: context,
widget: ActivityOverviewWidget(activity: activity),
nextWidget: ActivityOverviewWidget(activity: activity),
),
detailTile(
title: 'Laps',
icon: MyIcon.laps,
context: context,
widget: LapsListWidget(activity: activity),
nextWidget: LapsListWidget(activity: activity),
),
],
),
......@@ -58,13 +58,13 @@ class ShowActivityScreen extends StatelessWidget {
title: "Heart Rate",
icon: MyIcon.heartRate,
context: context,
widget: ActivityHeartRateWidget(activity: activity),
nextWidget: ActivityHeartRateWidget(activity: activity),
),
detailTile(
title: "Power",
icon: MyIcon.power,
context: context,
widget: ActivityPowerWidget(activity: activity),
nextWidget: ActivityPowerWidget(activity: activity),
),
]),
TableRow(children: [
......@@ -72,13 +72,13 @@ class ShowActivityScreen extends StatelessWidget {
title: "Power Duration",
icon: MyIcon.powerDuration,
context: context,
widget: ActivityPowerDurationWidget(activity: activity),
nextWidget: ActivityPowerDurationWidget(activity: activity),
),
detailTile(
title: "Power /\nHeart Rate",
icon: MyIcon.power,
context: context,
widget: ActivityPowerPerHeartRateWidget(activity: activity),
nextWidget: ActivityPowerPerHeartRateWidget(activity: activity),
),
]),
TableRow(children: [
......@@ -86,13 +86,13 @@ class ShowActivityScreen extends StatelessWidget {
title: "Speed /\nHeart Rate",
icon: MyIcon.speed,
context: context,
widget: ActivitySpeedPerHeartRateWidget(activity: activity),
nextWidget: ActivitySpeedPerHeartRateWidget(activity: activity),
),
detailTile(
title: "Ground Time",
icon: MyIcon.groundTime,
context: context,
widget: ActivityGroundTimeWidget(activity: activity),
nextWidget: ActivityGroundTimeWidget(activity: activity),
),
]),
TableRow(children: [
......@@ -100,13 +100,13 @@ class ShowActivityScreen extends StatelessWidget {
title: "Form Power",
icon: MyIcon.formPower,
context: context,
widget: ActivityFormPowerWidget(activity: activity),
nextWidget: ActivityFormPowerWidget(activity: activity),
),
detailTile(
title: "Power Ratio",
icon: MyIcon.formPower,
context: context,
widget: ActivityPowerRatioWidget(activity: activity),
nextWidget: ActivityPowerRatioWidget(activity: activity),
),
]),
TableRow(children: [
......@@ -114,13 +114,13 @@ class ShowActivityScreen extends StatelessWidget {
title: "Cadence",
icon: MyIcon.cadence,
context: context,
widget: ActivityStrydCadenceWidget(activity: activity),
nextWidget: ActivityStrydCadenceWidget(activity: activity),
),
detailTile(
title: "Vertical Oscillation",
icon: MyIcon.verticalOscillation,
context: context,
widget: ActivityVerticalOscillationWidget(activity: activity),
nextWidget: ActivityVerticalOscillationWidget(activity: activity),
),
]),
TableRow(children: [
......@@ -128,13 +128,13 @@ class ShowActivityScreen extends StatelessWidget {
title: "Leg Spring Stiffness",
icon: MyIcon.legSpringStiffness,
context: context,
widget: ActivityLegSpringStiffnessWidget(activity: activity),
nextWidget: ActivityLegSpringStiffnessWidget(activity: activity),
),
detailTile(
title: "Metadata",
icon: MyIcon.metaData,
context: context,
widget: ActivityMetadataWidget(activity: activity),
nextWidget: ActivityMetadataWidget(activity: activity),
),
]),
],
......@@ -144,7 +144,7 @@ class ShowActivityScreen extends StatelessWidget {
detailTile({
BuildContext context,
Widget widget,
Widget nextWidget,
Widget icon,
String title,
}) {
......@@ -158,7 +158,7 @@ class ShowActivityScreen extends StatelessWidget {
MaterialPageRoute(
builder: (context) => ShowActivityDetailScreen(
activity: activity,
widget: widget,
widget: nextWidget,
title: title,
),
),
......
import 'package:flutter/material.dart';
import 'package:encrateia/models/athlete.dart';
class ShowAthleteDetailScreen extends StatelessWidget {
final Athlete athlete;
final Widget widget;
final String title;
const ShowAthleteDetailScreen({
Key key,
this.athlete,
this.widget,
this.title,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(
'$title: ${athlete.db.firstName} ${athlete.db.lastName}',
overflow: TextOverflow.ellipsis,
),
),
body: widget,
);
}
}
......@@ -6,13 +6,17 @@ import 'package:encrateia/widgets/athlete_widgets/athlete_power_widget.dart';
import 'package:encrateia/widgets/athlete_widgets/athlete_settings_widget.dart';
import 'package:encrateia/widgets/athlete_widgets/athlete_power_per_heart_rate_widget.dart';
import 'package:encrateia/widgets/athlete_widgets/athlete_speed_per_heart_rate_widget.dart';
import 'package:encrateia/screens/show_athlete_detail_screen.dart';
import 'package:encrateia/utils/icon_utils.dart';
import 'package:flushbar/flushbar.dart';
class ShowAthleteScreen extends StatefulWidget {
final Athlete athlete;
const ShowAthleteScreen({Key key, this.athlete}) : super(key: key);
const ShowAthleteScreen({
Key key,
this.athlete,
}) : super(key: key);
@override
_ShowAthleteScreenState createState() => _ShowAthleteScreenState();
......@@ -32,50 +36,78 @@ class _ShowAthleteScreenState extends State<ShowAthleteScreen> {
@override
Widget build(BuildContext context) {
return DefaultTabController(
length: 5,
child: Scaffold(
floatingActionButton: Visibility(
visible: floatingActionButtonVisible,
child: FloatingActionButton.extended(
onPressed: () => updateJob(),
label: Text("from Strava"),
icon: MyIcon.stravaDownload,
),
return Scaffold(
appBar: AppBar(
title: Text(
'${widget.athlete.db.firstName} ${widget.athlete.db.lastName}',
overflow: TextOverflow.ellipsis,
),
appBar: AppBar(
title: Text(
widget.athlete.db.firstName + " " + widget.athlete.db.lastName),
bottom: TabBar(isScrollable: true, tabs: [
Tab(
icon: MyIcon.settings,
text: "Settings",
),
Tab(
icon: MyIcon.activities,
text: "Activities",
),
Tab(
icon: MyIcon.power,
text: "Power",
),
Tab(
icon: MyIcon.power,
text: "Power/HR",
),
Tab(
icon: MyIcon.speed,
text: "Speed/HR",
)
]),
),
floatingActionButton: Visibility(
visible: floatingActionButtonVisible,
child: FloatingActionButton.extended(
onPressed: () => updateJob(),
label: Text("from Strava"),
icon: MyIcon.stravaDownload,
),
body: TabBarView(children: [
AthleteSettingsWidget(athlete: widget.athlete),
ActivitiesListWidget(athlete: widget.athlete),
AthletePowerWidget(athlete: widget.athlete),
AthletePowerPerHeartRateWidget(athlete: widget.athlete),
AthleteSpeedPerHeartRateWidget(athlete: widget.athlete),
),
body: Table(children: [
TableRow(children: [
detailTile(
title: "Activities List",
icon: MyIcon.activities,
nextWidget: ActivitiesListWidget(athlete: widget.athlete),
),
detailTile(
title: "Settings",
icon: MyIcon.settings,
nextWidget: AthleteSettingsWidget(athlete: widget.athlete),
)
]),
TableRow(children: [
detailTile(
title: "Power",
icon: MyIcon.power,
nextWidget: AthletePowerWidget(athlete: widget.athlete),
),
detailTile(
title: "Power /\nHeart Rate",
icon: MyIcon.power,
nextWidget: AthletePowerPerHeartRateWidget(athlete: widget.athlete),
),
]),
TableRow(children: [
detailTile(
title: "Speed /\nHeart Rate",
icon: MyIcon.speed,
nextWidget: AthleteSpeedPerHeartRateWidget(athlete: widget.athlete),
),
Text(""),
]),
]),
);
}
detailTile({
Widget nextWidget,
Widget icon,
String title,
}) {
return Card(
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(25)),
child: ListTile(
leading: icon,
title: Text(title),
onTap: () => Navigator.push(
context,
MaterialPageRoute(
builder: (context) => ShowAthleteDetailScreen(
athlete: widget.athlete,
widget: nextWidget,
title: title,
),
),
),
),
);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment