Skip to content

Commit

Permalink
Calander page
Browse files Browse the repository at this point in the history
  • Loading branch information
SebRincon committed Sep 23, 2023
1 parent edb9d39 commit 2ccef51
Show file tree
Hide file tree
Showing 3 changed files with 136 additions and 0 deletions.
103 changes: 103 additions & 0 deletions frontend/carbon_footprint/lib/pages/CalanderPage/calanderPage.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
// ignore_for_file: prefer_const_constructors, prefer_const_literals_to_create_immutables, unused_local_variable

import 'package:carbon_footprint/NavigationSidebar.dart';
import 'package:carbon_footprint/constants.dart';
import 'package:carbon_footprint/pages/ExampleStrucutre/widgets/useful_tile.dart';
import 'package:flutter/material.dart';
import 'package:syncfusion_flutter_calendar/calendar.dart';

class MobileCalanderPage extends StatefulWidget {
const MobileCalanderPage({Key? key}) : super(key: key);

@override
State<MobileCalanderPage> createState() => _MobileScaffCalander();
}

class Event extends Appointment {
Event({
required DateTime startTime,
required DateTime endTime,
required String subject,
required Color color,
}) : super(
startTime: startTime,
endTime: endTime,
subject: subject,
color: color,
);
}

class EventDataSource extends CalendarDataSource {
EventDataSource(List<Event> source) {
appointments = source;
}
}

class _MobileScaffCalander extends State<MobileCalanderPage> {
List<Event> weeklyEvents = [
Event(
startTime: DateTime.now(),
endTime: DateTime.now().add(Duration(hours: 2)),
subject: 'Meeting',
color: Colors.blue,
),
Event(
startTime: DateTime.now().add(Duration(days: 1)),
endTime: DateTime.now().add(Duration(days: 1, hours: 2)),
subject: 'Workshop',
color: Colors.red,
),
Event(
startTime: DateTime.now().add(Duration(days: 2)),
endTime: DateTime.now().add(Duration(days: 2, hours: 1)),
subject: 'Team Lunch',
color: Colors.green,
),
Event(
startTime: DateTime.now().add(Duration(days: 3)),
endTime: DateTime.now().add(Duration(days: 3, hours: 3)),
subject: 'Project Review',
color: Colors.purple,
),
Event(
startTime: DateTime.now().add(Duration(days: 4)),
endTime: DateTime.now().add(Duration(days: 4, hours: 2)),
subject: 'Client Meeting',
color: Colors.orange,
),
Event(
startTime: DateTime.now().add(Duration(days: 5)),
endTime: DateTime.now().add(Duration(days: 5, hours: 2)),
subject: 'Brainstorming Session',
color: Colors.pink,
),
Event(
startTime: DateTime.now().add(Duration(days: 6)),
endTime: DateTime.now().add(Duration(days: 6, hours: 2)),
subject: 'Weekly Wrap-up',
color: Colors.teal,
),
];

@override
Widget build(BuildContext context) {
final EventDataSource eventDataSource = EventDataSource(weeklyEvents);

return Scaffold(
backgroundColor: Colors.grey[300],
appBar: rootAppbar,
drawer: CustomDrawer(),
body: Container(
height: 600,
child: Column(children: [
Expanded(
child: SfCalendar(
view: CalendarView.week,
dataSource: eventDataSource,
),
),
]),
),
);
}
}
32 changes: 32 additions & 0 deletions frontend/carbon_footprint/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,30 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.2.0"
syncfusion_flutter_calendar:
dependency: "direct main"
description:
name: syncfusion_flutter_calendar
sha256: "26524caedc21fabc26297da4a32bf20089029fabcdbe609eacdbf11559ba0fbd"
url: "https://pub.dev"
source: hosted
version: "23.1.36"
syncfusion_flutter_core:
dependency: transitive
description:
name: syncfusion_flutter_core
sha256: aea119c8117953fa5decf4a313b431e556b0959cd35ff88f8fbdc0eda9bedb06
url: "https://pub.dev"
source: hosted
version: "23.1.36"
syncfusion_flutter_datepicker:
dependency: transitive
description:
name: syncfusion_flutter_datepicker
sha256: "74eeebbf388bf89327fa2593942765aad2049e99d46128402ba0e32c03df5d08"
url: "https://pub.dev"
source: hosted
version: "23.1.36"
term_glyph:
dependency: transitive
description:
Expand All @@ -485,6 +509,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "0.6.0"
timezone:
dependency: transitive
description:
name: timezone
sha256: "1cfd8ddc2d1cfd836bc93e67b9be88c3adaeca6f40a00ca999104c30693cdca0"
url: "https://pub.dev"
source: hosted
version: "0.9.2"
tuple:
dependency: transitive
description:
Expand Down
1 change: 1 addition & 0 deletions frontend/carbon_footprint/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ dependencies:
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^1.0.2
firebase_core: ^2.16.0
syncfusion_flutter_calendar: ^23.1.36

dev_dependencies:
flutter_test:
Expand Down

0 comments on commit 2ccef51

Please sign in to comment.