Skip to content

Commit

Permalink
Merge pull request #14 from argorain/customizable-timelineeditortrack…
Browse files Browse the repository at this point in the history
…-action-icons

Customizable timelineeditortrack action icons and border color
  • Loading branch information
neckaros committed Dec 19, 2020
2 parents e916569 + f252020 commit c1b4389
Showing 1 changed file with 30 additions and 8 deletions.
38 changes: 30 additions & 8 deletions lib/timeline_editor_track.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ class TimelineEditorCard extends ITimelineEditorCard {
/// background color of this box
final Color color;

/// optional border color when selected
final Color borderColor;

/// optional [PopupMenuEntry] list to display if a user long press this box
final List<PopupMenuEntry> menuEntries;

Expand All @@ -34,6 +37,15 @@ class TimelineEditorCard extends ITimelineEditorCard {
/// possibility of moving this box
final void Function(Duration duration) onMovedStart;

/// optional icon for [onMovedStart]
final Icon onMovedStartIcon;

/// optional icon for [onMovedDuration]
final Icon onMovedDurationIcon;

/// optional icon for [menuEntries]
final Icon menuEntriesIcon;

const TimelineEditorCard(Duration start,
{Key key,
Duration duration,
Expand All @@ -42,10 +54,14 @@ class TimelineEditorCard extends ITimelineEditorCard {
this.onTap,
this.child,
this.color,
this.borderColor,
this.menuEntries,
this.onSelectedMenuItem,
this.onMovedDuration,
this.onMovedStart})
this.onMovedStart,
this.onMovedStartIcon,
this.onMovedDurationIcon,
this.menuEntriesIcon})
: super(key: key, start: start, duration: duration);

@override
Expand All @@ -69,7 +85,7 @@ class TimelineEditorCard extends ITimelineEditorCard {
Positioned.fill(
child: Container(
decoration: BoxDecoration(
border: Border.all(color: Colors.white, width: 6),
border: Border.all(color: borderColor != null ? borderColor : Colors.white, width: 6),
),
),
),
Expand All @@ -83,8 +99,10 @@ class TimelineEditorCard extends ITimelineEditorCard {
height: 30,
width: 30,
child: Container(
color: Colors.white,
child: Icon(
color: borderColor != null ? borderColor : Colors.white,
child: onMovedDurationIcon != null
? onMovedDurationIcon
: Icon(
Icons.swap_horiz,
color: Colors.black,
),
Expand All @@ -102,8 +120,10 @@ class TimelineEditorCard extends ITimelineEditorCard {
height: 30,
width: 30,
child: Container(
color: Colors.white,
child: Icon(
color: borderColor != null ? borderColor : Colors.white,
child: onMovedStartIcon != null
? onMovedStartIcon
: Icon(
Icons.swap_horiz,
color: Colors.black,
),
Expand All @@ -123,8 +143,10 @@ class TimelineEditorCard extends ITimelineEditorCard {
return menuEntries;
},
child: Container(
color: Colors.white,
child: Icon(
color: borderColor != null ? borderColor : Colors.white,
child: menuEntriesIcon != null
? menuEntriesIcon
: Icon(
Icons.menu,
color: Colors.black,
),
Expand Down

0 comments on commit c1b4389

Please sign in to comment.