You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is there a way to reverse the order of the labels on the right side without reversing the order of the circles and if possible to also keep the default legend icons (those little clickable circles)?
Is there a way to reverse the order of the labels on the right side without reversing the order of the circles and if possible to also keep the default legend icons (those little clickable circles)?
// overview_model.dart
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:intl/intl.dart';
class OverviewModel {
final String userUID;
OverviewModel(this.userUID);
Future<List> fetchActivityCounts() async {
final now = DateTime.now();
final currentMonthYear = DateFormat('MM-yyyy').format(now);
}
Future<List> fetchTotalActivityTime() async {
final now = DateTime.now();
final currentMonthYear = DateFormat('MM-yyyy').format(now);
}
Future<List<Map<String, dynamic>>> fetchPersonalBestActivities(
List sortedActivityTypes) async {
List allActivityTypes = [
'Running',
'Cycling',
'Walking',
'Swimming',
'Volleyball',
'Bouldering',
'Football',
'Basketball',
'Fitness',
];
}
List generateExampleChartData() {
List exampleData = [
ChartData('Example 1', 3, 'No Data'),
ChartData('Example 2', 5, 'No Data'),
ChartData('Example 3', 10, 'No Data'),
ChartData('Example 4', 15, 'No Data'),
ChartData('Example 5', 20, 'No Data'),
];
}
}
class ChartData {
ChartData(this.category, this.value, this.formattedTime);
final String category;
final double value;
final String formattedTime;
}
// overview_page.dart
import 'package:flutter/material.dart';
import 'package:syncfusion_flutter_charts/charts.dart';
import 'package:sporti_angel_kolev/models/overview_model.dart';
import 'package:sporti_angel_kolev/controllers/overview_controller.dart';
import 'package:sporti_angel_kolev/common/activity_list_widget.dart';
import 'package:sporti_angel_kolev/common/profile_picture.dart';
import 'package:sporti_angel_kolev/common/user_information.dart';
class OverviewPage extends StatefulWidget {
const OverviewPage({super.key});
@OverRide
_OverviewPageState createState() => _OverviewPageState();
}
class _OverviewPageState extends State {
bool showTotalActivityTime = true;
late OverviewController _controller;
@OverRide
void initState() {
super.initState();
final userUID = UserInformation().userUID;
_controller = OverviewController(OverviewModel(userUID));
}
@OverRide
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.white,
appBar: AppBar(
surfaceTintColor: Colors.white,
title: const Text(
'Overview',
style: TextStyle(
fontWeight: FontWeight.bold,
),
),
centerTitle: true,
automaticallyImplyLeading: false,
backgroundColor: Colors.white,
actions: const [ProfilePicture()],
),
body: Center(
child: Column(
children: [
Padding(
padding: const EdgeInsets.all(16.0),
child: ElevatedButton(
onPressed: () {
setState(() {
showTotalActivityTime = !showTotalActivityTime;
});
},
style: ElevatedButton.styleFrom(
foregroundColor: Colors.white,
padding: const EdgeInsets.symmetric(
vertical: 15.0, horizontal: 30.0),
backgroundColor: Colors.redAccent,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(30.0),
),
elevation: 5,
shadowColor: Colors.black,
),
child: Text(
showTotalActivityTime
? 'Monthly Activity Count'
: 'Monthly Total Activity Time',
style: const TextStyle(
fontSize: 16,
fontWeight: FontWeight.bold,
),
),
),
),
Expanded(
child: Column(
children: [
Flexible(
child: FutureBuilder<List>(
future: showTotalActivityTime
? _controller.fetchTotalActivityTime()
: _controller.fetchActivityCounts(),
builder: (context, snapshot) {
if (snapshot.connectionState ==
ConnectionState.waiting) {
return const Center(
child: CircularProgressIndicator(
valueColor: AlwaysStoppedAnimation(
Colors.red)));
} else if (snapshot.hasError) {
return Text('Error: ${snapshot.error}');
} else {
final chartData = snapshot.data ?? [];
}
}
The text was updated successfully, but these errors were encountered: