Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom scrollview refactor #17

Merged
merged 25 commits into from
Feb 23, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
8ad9f62
Label column
lpickford-pixelbeard Feb 20, 2024
7be76a9
Implemented grids
lpickford-pixelbeard Feb 20, 2024
b4c5e68
cellWidth
lpickford-pixelbeard Feb 20, 2024
fc873c4
dates
lpickford-pixelbeard Feb 20, 2024
0acd8b4
Cells now rendered on a canvas again
lpickford-pixelbeard Feb 21, 2024
3bd47c8
taskBar height
lpickford-pixelbeard Feb 21, 2024
776e19d
max height on taskBar
lpickford-pixelbeard Feb 21, 2024
8806b80
Scroll listeners
lpickford-pixelbeard Feb 21, 2024
0b9e6b0
Simplified tree
lpickford-pixelbeard Feb 21, 2024
2260f1a
Grid Rows and Tooltips reimplemented
lpickford-pixelbeard Feb 21, 2024
e993ba3
Render area fix
lpickford-pixelbeard Feb 22, 2024
697332d
Controller simplified
lpickford-pixelbeard Feb 22, 2024
1bff629
Controller moved down the tree
lpickford-pixelbeard Feb 22, 2024
0ec76c0
Label grid
lpickford-pixelbeard Feb 22, 2024
78d7890
Styling fixes
lpickford-pixelbeard Feb 22, 2024
cef280e
Axes dividers
lpickford-pixelbeard Feb 22, 2024
26bc789
tooltip position fix
lpickford-pixelbeard Feb 22, 2024
4a540fb
Content split into separate files
lpickford-pixelbeard Feb 22, 2024
652e127
dataHeight fix
lpickford-pixelbeard Feb 22, 2024
705e78d
Cleanup
lpickford-pixelbeard Feb 22, 2024
845f32d
Date labels are now fully customisable
lpickford-pixelbeard Feb 22, 2024
123ad38
Redundant tests removed
lpickford-pixelbeard Feb 22, 2024
edc9682
Cleanup
lpickford-pixelbeard Feb 22, 2024
d1c647f
Readme updates
lpickford-pixelbeard Feb 22, 2024
9f6b5dd
Dispose controllers
lpickford-pixelbeard Feb 23, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Label column
  • Loading branch information
lpickford-pixelbeard committed Feb 20, 2024
commit 8ad9f623acf29721c2ff942225b33bdc60f44197
5 changes: 0 additions & 5 deletions benchmark/benchmarks.dart

This file was deleted.

25 changes: 0 additions & 25 deletions benchmark/model/gantt_data_benchmark.dart

This file was deleted.

41 changes: 28 additions & 13 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,22 +31,37 @@ class MyHomePage extends StatefulWidget {
class _MyHomePageState extends State<MyHomePage> {
late GanttChartController<ExampleEventItem> _controller;

final List<ExampleEventItem> _items = Data.dummyData;

@override
void initState() {
super.initState();
_controller = GanttChartController<ExampleEventItem>(
items: Data.dummyData,
taskBuilder: (item) => GanttTask(
label: item.title,
startDate: item.start,
endDate: item.end,
tooltip:
'${item.title}\n${item.start.formattedDate} - ${item.end.formattedDate}',
),
taskSort: (a, b) => a.startDate.compareTo(b.startDate),
activityLabelBuilder: (item) => item.group,
activitySort: (a, b) =>
a.tasks.first.startDate.compareTo(b.tasks.first.startDate),
items: _items,
itemBuilder: (items) {
List<GanttActivity> activities = [];
Map<String, List<GanttTask>> labelTasks = {};

for (var item in items) {
final label = item.group;
(labelTasks[label] ??= []).add(GanttTask(
label: item.title,
startDate: item.start,
endDate: item.end,
tooltip:
'${item.title}\n${item.start.formattedDate} - ${item.end.formattedDate}',
));
}

activities = labelTasks.entries.map((e) {
final tasks = e.value;
tasks.sort((a, b) => a.startDate.compareTo(b.startDate));
return GanttActivity(label: e.key, tasks: tasks);
}).toList();
activities.sort((a, b) =>
a.tasks.first.startDate.compareTo(b.tasks.first.startDate));
return activities;
},
highlightedDates: [DateTime.now().add(const Duration(days: 5))],
showFullWeeks: false,
);
Expand Down Expand Up @@ -91,7 +106,7 @@ class _MyHomePageState extends State<MyHomePage> {
),
floatingActionButton: FloatingActionButton(
backgroundColor: Colors.redAccent,
onPressed: () => _controller.addItems(Data.dummyData),
onPressed: () => setState(() => _controller.addItems(Data.dummyData)),
child: const Icon(Icons.restore, color: Colors.white),
),
);
Expand Down
7 changes: 6 additions & 1 deletion example/windows/flutter/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ include(${EPHEMERAL_DIR}/generated_config.cmake)
# https://github.com/flutter/flutter/issues/57146.
set(WRAPPER_ROOT "${EPHEMERAL_DIR}/cpp_client_wrapper")

# Set fallback configurations for older versions of the flutter tool.
if (NOT DEFINED FLUTTER_TARGET_PLATFORM)
set(FLUTTER_TARGET_PLATFORM "windows-x64")
endif()

# === Flutter Library ===
set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/flutter_windows.dll")

Expand Down Expand Up @@ -92,7 +97,7 @@ add_custom_command(
COMMAND ${CMAKE_COMMAND} -E env
${FLUTTER_TOOL_ENVIRONMENT}
"${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.bat"
windows-x64 $<CONFIG>
${FLUTTER_TARGET_PLATFORM} $<CONFIG>
VERBATIM
)
add_custom_target(flutter_assemble DEPENDS
Expand Down
1 change: 1 addition & 0 deletions lib/gantt_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export 'src/gantt_chart.dart';

export 'src/controller/gantt_data_controller.dart';

export 'src/model/gantt_activity.dart';
export 'src/model/gantt_task.dart';
export 'src/model/timeline_axis_type.dart';
export 'src/model/tooltip_type.dart';
Expand Down
76 changes: 0 additions & 76 deletions lib/src/controller/builder/activity/activity_builder.dart

This file was deleted.

Loading