Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
c4f8977a
Commit
c4f8977a
authored
Aug 12, 2015
by
Collin Jackson
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #568 from collinjackson/playfair
Add support for charts to fitness app
parents
b4e3f859
98d4c3af
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
47 additions
and
14 deletions
+47
-14
feed.dart
examples/fitness/lib/feed.dart
+45
-14
main.dart
examples/fitness/lib/main.dart
+1
-0
pubspec.yaml
examples/fitness/pubspec.yaml
+1
-0
No files found.
examples/fitness/lib/feed.dart
View file @
c4f8977a
...
...
@@ -173,28 +173,59 @@ class FeedFragment extends StatefulComponent {
});
}
Widget
buildChart
()
{
double
startX
;
double
endX
;
double
startY
;
double
endY
;
List
<
Point
>
dataSet
=
new
List
<
Point
>();
for
(
FitnessItem
item
in
userData
)
{
if
(
item
is
Measurement
)
{
double
x
=
item
.
when
.
millisecondsSinceEpoch
.
toDouble
();
double
y
=
item
.
weight
;
if
(
startX
==
null
)
startX
=
x
;
endX
=
x
;
if
(
startY
==
null
||
startY
>
y
)
startY
=
y
;
if
(
endY
==
null
||
endY
<
y
)
endY
=
y
;
dataSet
.
add
(
new
Point
(
x
,
y
));
}
}
playfair
.
ChartData
data
=
new
playfair
.
ChartData
(
startX:
startX
,
startY:
startY
,
endX:
endX
,
endY:
endY
,
dataSet:
dataSet
);
return
new
playfair
.
Chart
(
data:
data
);
}
Widget
buildBody
()
{
TextStyle
style
=
Theme
.
of
(
this
).
text
.
title
;
if
(
userData
.
length
==
0
)
return
new
Material
(
type:
MaterialType
.
canvas
,
child:
new
Flex
(
[
new
Text
(
"No data yet.
\n
Add some!"
,
style:
style
)],
justifyContent:
FlexJustifyContent
.
center
)
);
switch
(
_fitnessMode
)
{
case
FitnessMode
.
feed
:
if
(
userData
.
length
>
0
)
return
new
FitnessItemList
(
items:
userData
,
onDismissed:
_handleItemDismissed
);
return
new
Material
(
type:
MaterialType
.
canvas
,
child:
new
Flex
(
[
new
Text
(
"No data yet.
\n
Add some!"
,
style:
style
)],
justifyContent:
FlexJustifyContent
.
center
)
return
new
FitnessItemList
(
items:
userData
,
onDismissed:
_handleItemDismissed
);
case
FitnessMode
.
chart
:
return
new
Material
(
type:
MaterialType
.
canvas
,
child:
new
Flex
([
new
Text
(
"Charts are coming soon!"
,
style:
style
)
],
justifyContent:
FlexJustifyContent
.
center
)
child:
new
Container
(
padding:
const
EdgeDims
.
all
(
20.0
),
child:
buildChart
()
)
);
}
}
...
...
examples/fitness/lib/main.dart
View file @
c4f8977a
...
...
@@ -4,6 +4,7 @@
library
fitness
;
import
'package:playfair/playfair.dart'
as
playfair
;
import
'package:sky/editing/input.dart'
;
import
'package:sky/painting/text_style.dart'
;
import
'package:sky/theme/colors.dart'
as
colors
;
...
...
examples/fitness/pubspec.yaml
View file @
c4f8977a
...
...
@@ -2,6 +2,7 @@ name: fitness
dependencies
:
sky
:
any
sky_tools
:
any
playfair
:
any
path
:
"
^1.3.6"
dependency_overrides
:
material_design_icons
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment