Skip to content

Commit

Permalink
Merge branch 'release/0.0.2+1' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
chulwoo-park committed Nov 23, 2020
2 parents a5f1f8f + 832ac28 commit 76370bb
Show file tree
Hide file tree
Showing 21 changed files with 540 additions and 305 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 0.0.2+1

* Dartfmt line length changed from 120 to 80


## 0.0.2

### Add basic components
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

<p align="center">A powerful & easy to use timeline package for Flutter! 🚀</p>

> ***Caveat***: This package is an early stage. Not enough testing has been done to guarantee stability. And some apis can be change.
# Examples

Check it out on the [web](https://chulwoo.dev/timelines/) or look at the [source code](https://github.com/chulwoo-park/timelines/tree/main/example).
Expand Down
14 changes: 10 additions & 4 deletions example/lib/component_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,9 @@ class ComponentPage extends StatelessWidget {
builder: TimelineTileBuilder.connectedFromStyle(
connectionDirection: ConnectionDirection.before,
connectorStyleBuilder: (context, index) {
return (index == 1) ? ConnectorStyle.dashedLine : ConnectorStyle.solidLine;
return (index == 1)
? ConnectorStyle.dashedLine
: ConnectorStyle.solidLine;
},
indicatorStyleBuilder: (context, index) => IndicatorStyle.dot,
itemExtent: 40.0,
Expand All @@ -123,7 +125,9 @@ class ComponentPage extends StatelessWidget {
builder: TimelineTileBuilder.connectedFromStyle(
connectionDirection: ConnectionDirection.after,
connectorStyleBuilder: (context, index) {
return (index == 1) ? ConnectorStyle.dashedLine : ConnectorStyle.solidLine;
return (index == 1)
? ConnectorStyle.dashedLine
: ConnectorStyle.solidLine;
},
indicatorStyleBuilder: (context, index) => IndicatorStyle.dot,
itemExtent: 40.0,
Expand All @@ -149,7 +153,8 @@ class ComponentPage extends StatelessWidget {
child: Text('Contents'),
),
),
connectorStyleBuilder: (context, index) => ConnectorStyle.solidLine,
connectorStyleBuilder: (context, index) =>
ConnectorStyle.solidLine,
indicatorStyleBuilder: (context, index) => IndicatorStyle.dot,
itemCount: 3,
),
Expand All @@ -173,7 +178,8 @@ class ComponentPage extends StatelessWidget {
child: Text('Contents'),
),
),
connectorStyleBuilder: (context, index) => ConnectorStyle.solidLine,
connectorStyleBuilder: (context, index) =>
ConnectorStyle.solidLine,
indicatorStyleBuilder: (context, index) => IndicatorStyle.dot,
itemCount: 3,
),
Expand Down
5 changes: 4 additions & 1 deletion example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,10 @@ class WebAlert extends StatelessWidget {
height: 80.0,
child: Material(
child: Center(
child: Text('You are using the web version now.\nSome UI can be broken.'),
child: Text(
'You are using the web version now.\nSome UI can be broken.',
textAlign: TextAlign.center,
),
),
),
);
Expand Down
9 changes: 6 additions & 3 deletions example/lib/showcase/package_delivery_tracking.dart
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@ class _InnerTimeline extends StatelessWidget {
),
),
builder: TimelineTileBuilder(
indicatorBuilder: (_, index) => !isEdgeIndex(index) ? Indicator.outlined(borderWidth: 1.0) : null,
indicatorBuilder: (_, index) =>
!isEdgeIndex(index) ? Indicator.outlined(borderWidth: 1.0) : null,
startConnectorBuilder: (_, index) => Connector.solidLine(),
endConnectorBuilder: (_, index) => Connector.solidLine(),
contentsBuilder: (_, index) {
Expand All @@ -117,7 +118,8 @@ class _InnerTimeline extends StatelessWidget {
);
},
itemExtentBuilder: (_, index) => isEdgeIndex(index) ? 10.0 : 30.0,
nodeItemOverlapBuilder: (_, index) => isEdgeIndex(index) ? true : null,
nodeItemOverlapBuilder: (_, index) =>
isEdgeIndex(index) ? true : null,
itemCount: messages.length + 2,
),
),
Expand Down Expand Up @@ -257,7 +259,8 @@ _OrderInfo _data(int id) => _OrderInfo(
date: DateTime.now(),
driverInfo: _DriverInfo(
name: 'Philipe',
thumbnailUrl: 'https://i.pinimg.com/originals/08/45/81/084581e3155d339376bf1d0e17979dc6.jpg',
thumbnailUrl:
'https://i.pinimg.com/originals/08/45/81/084581e3155d339376bf1d0e17979dc6.jpg',
),
deliveryProcesses: [
_DeliveryProcess(
Expand Down
18 changes: 13 additions & 5 deletions example/lib/showcase/process_timeline.dart
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ class _ProcessTimelinePageState extends State<ProcessTimelinePage> {
),
builder: TimelineTileBuilder.connected(
connectionDirection: ConnectionDirection.before,
itemExtentBuilder: (_, __) => MediaQuery.of(context).size.width / _processes.length,
itemExtentBuilder: (_, __) =>
MediaQuery.of(context).size.width / _processes.length,
oppositeContentsBuilder: (context, index) {
return Padding(
padding: const EdgeInsets.only(bottom: 15.0),
Expand Down Expand Up @@ -137,7 +138,10 @@ class _ProcessTimelinePageState extends State<ProcessTimelinePage> {
if (type == ConnectorType.start) {
gradientColors = [Color.lerp(prevColor, color, 0.5), color];
} else {
gradientColors = [prevColor, Color.lerp(prevColor, color, 0.5)];
gradientColors = [
prevColor,
Color.lerp(prevColor, color, 0.5)
];
}
return DecoratedLineConnector(
decoration: BoxDecoration(
Expand Down Expand Up @@ -211,7 +215,8 @@ class _BezierPainter extends CustomPainter {
offset2 = _offset(radius, -angle);
path = Path()
..moveTo(offset1.dx, offset1.dy)
..quadraticBezierTo(0.0, size.height / 2, -radius, radius) // TODO connector start & gradient
..quadraticBezierTo(0.0, size.height / 2, -radius,
radius) // TODO connector start & gradient
..quadraticBezierTo(0.0, size.height / 2, offset2.dx, offset2.dy)
..close();

Expand All @@ -224,7 +229,8 @@ class _BezierPainter extends CustomPainter {

path = Path()
..moveTo(offset1.dx, offset1.dy)
..quadraticBezierTo(size.width, size.height / 2, size.width + radius, radius) // TODO connector end & gradient
..quadraticBezierTo(size.width, size.height / 2, size.width + radius,
radius) // TODO connector end & gradient
..quadraticBezierTo(size.width, size.height / 2, offset2.dx, offset2.dy)
..close();

Expand All @@ -234,7 +240,9 @@ class _BezierPainter extends CustomPainter {

@override
bool shouldRepaint(_BezierPainter oldDelegate) {
return oldDelegate.color != color || oldDelegate.drawStart != drawStart || oldDelegate.drawEnd != drawEnd;
return oldDelegate.color != color ||
oldDelegate.drawStart != drawStart ||
oldDelegate.drawEnd != drawEnd;
}
}

Expand Down
18 changes: 13 additions & 5 deletions example/lib/showcase/timeline_status.dart
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,9 @@ class _Timeline2 extends StatelessWidget {
connectorBuilder: (_, index, connectorType) {
var color;
if (index + 1 < data.length - 1) {
color = data[index].isInProgress && data[index + 1].isInProgress ? Color(0xff193fcc) : null;
color = data[index].isInProgress && data[index + 1].isInProgress
? Color(0xff193fcc)
: null;
}
return SolidLineConnector(
indent: connectorType == ConnectorType.start ? 0 : 2.0,
Expand Down Expand Up @@ -169,14 +171,18 @@ class _Timeline3 extends StatelessWidget {
indicatorBuilder: (context, index) {
final status = data[index];
return OutlinedDotIndicator(
color: status.isInProgress ? Color(0xff6ad192) : Color(0xffe6e7e9),
backgroundColor: status.isInProgress ? Color(0xffd4f5d6) : Color(0xffc2c5c9),
color:
status.isInProgress ? Color(0xff6ad192) : Color(0xffe6e7e9),
backgroundColor:
status.isInProgress ? Color(0xffd4f5d6) : Color(0xffc2c5c9),
borderWidth: status.isInProgress ? 3.0 : 2.5,
);
},
connectorBuilder: (context, index, connectorType) {
var color;
if (index + 1 < data.length - 1 && data[index].isInProgress && data[index + 1].isInProgress) {
if (index + 1 < data.length - 1 &&
data[index].isInProgress &&
data[index + 1].isInProgress) {
color = data[index].isInProgress ? Color(0xff6ad192) : null;
}
return SolidLineConnector(
Expand All @@ -185,7 +191,9 @@ class _Timeline3 extends StatelessWidget {
},
contentsBuilder: (context, index) {
var height;
if (index + 1 < data.length - 1 && data[index].isInProgress && data[index + 1].isInProgress) {
if (index + 1 < data.length - 1 &&
data[index].isInProgress &&
data[index + 1].isInProgress) {
height = kTileHeight - 10;
} else {
height = kTileHeight + 5;
Expand Down
3 changes: 2 additions & 1 deletion example/lib/showcase_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ class ShowcasePage extends StatelessWidget {
image: 'assets/images/timeline_status.png',
title: 'Timeline Status',
designer: 'Tridip Thrizu',
url: 'https://dribbble.com/shots/5659998-Daily-UI-Component-4-Timeline-Status',
url:
'https://dribbble.com/shots/5659998-Daily-UI-Component-4-Timeline-Status',
navigationBuilder: () => TimelineStatusPage(),
),
_ShowcaseCard(
Expand Down
30 changes: 20 additions & 10 deletions example/lib/theme_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,8 @@ class _ThemePageState extends State<ThemePage> {
Checkbox(
value: _theme.nodeItemOverlap,
onChanged: (overlap) {
_updateTheme(_theme.copyWith(nodeItemOverlap: overlap));
_updateTheme(
_theme.copyWith(nodeItemOverlap: overlap));
},
),
],
Expand All @@ -116,14 +117,16 @@ class _ThemePageState extends State<ThemePage> {
title: 'Node Position',
value: _theme.nodePosition,
onChanged: (nodePosition) {
_updateTheme(_theme.copyWith(nodePosition: nodePosition));
_updateTheme(
_theme.copyWith(nodePosition: nodePosition));
},
),
_ThemeSlider(
title: 'Indicator Position',
value: _theme.indicatorPosition,
onChanged: (indicatorPosition) {
_updateTheme(_theme.copyWith(indicatorPosition: indicatorPosition));
_updateTheme(_theme.copyWith(
indicatorPosition: indicatorPosition));
},
),
],
Expand All @@ -146,7 +149,8 @@ class _ThemePageState extends State<ThemePage> {
onChanged: (color) {
_updateTheme(
_theme.copyWith(
indicatorTheme: _theme.indicatorTheme.copyWith(color: color),
indicatorTheme:
_theme.indicatorTheme.copyWith(color: color),
),
);
},
Expand All @@ -158,7 +162,8 @@ class _ThemePageState extends State<ThemePage> {
onChanged: (position) {
_updateTheme(
_theme.copyWith(
indicatorTheme: _theme.indicatorTheme.copyWith(position: position),
indicatorTheme: _theme.indicatorTheme
.copyWith(position: position),
),
);
},
Expand All @@ -170,7 +175,8 @@ class _ThemePageState extends State<ThemePage> {
onChanged: (size) {
_updateTheme(
_theme.copyWith(
indicatorTheme: _theme.indicatorTheme.copyWith(size: size),
indicatorTheme:
_theme.indicatorTheme.copyWith(size: size),
),
);
},
Expand All @@ -195,7 +201,8 @@ class _ThemePageState extends State<ThemePage> {
onChanged: (color) {
_updateTheme(
_theme.copyWith(
connectorTheme: _theme.connectorTheme.copyWith(color: color),
connectorTheme:
_theme.connectorTheme.copyWith(color: color),
),
);
},
Expand All @@ -208,7 +215,8 @@ class _ThemePageState extends State<ThemePage> {
onChanged: (space) {
_updateTheme(
_theme.copyWith(
connectorTheme: _theme.connectorTheme.copyWith(space: space),
connectorTheme:
_theme.connectorTheme.copyWith(space: space),
),
);
},
Expand All @@ -220,7 +228,8 @@ class _ThemePageState extends State<ThemePage> {
onChanged: (indent) {
_updateTheme(
_theme.copyWith(
connectorTheme: _theme.connectorTheme.copyWith(indent: indent),
connectorTheme: _theme.connectorTheme
.copyWith(indent: indent),
),
);
},
Expand All @@ -232,7 +241,8 @@ class _ThemePageState extends State<ThemePage> {
onChanged: (thickness) {
_updateTheme(
_theme.copyWith(
connectorTheme: _theme.connectorTheme.copyWith(thickness: thickness),
connectorTheme: _theme.connectorTheme
.copyWith(thickness: thickness),
),
);
},
Expand Down
3 changes: 2 additions & 1 deletion example/lib/widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ class NavigationCard extends StatelessWidget with NavigateMixin {
const NavigationCard({
Key key,
this.margin,
this.borderRadius = const BorderRadius.all(Radius.circular(kNavigationCardRadius)),
this.borderRadius =
const BorderRadius.all(Radius.circular(kNavigationCardRadius)),
this.navigationBuilder,
@required this.child,
}) : super(key: key);
Expand Down
Loading

0 comments on commit 76370bb

Please sign in to comment.