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
98d4c3af
Commit
98d4c3af
authored
Aug 11, 2015
by
Collin Jackson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add weight chart to fitness app
parent
0fcf1912
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 @
98d4c3af
...
@@ -173,28 +173,59 @@ class FeedFragment extends StatefulComponent {
...
@@ -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
()
{
Widget
buildBody
()
{
TextStyle
style
=
Theme
.
of
(
this
).
text
.
title
;
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
)
{
switch
(
_fitnessMode
)
{
case
FitnessMode
.
feed
:
case
FitnessMode
.
feed
:
if
(
userData
.
length
>
0
)
return
new
FitnessItemList
(
return
new
FitnessItemList
(
items:
userData
,
items:
userData
,
onDismissed:
_handleItemDismissed
onDismissed:
_handleItemDismissed
);
return
new
Material
(
type:
MaterialType
.
canvas
,
child:
new
Flex
(
[
new
Text
(
"No data yet.
\n
Add some!"
,
style:
style
)],
justifyContent:
FlexJustifyContent
.
center
)
);
);
case
FitnessMode
.
chart
:
case
FitnessMode
.
chart
:
return
new
Material
(
return
new
Material
(
type:
MaterialType
.
canvas
,
type:
MaterialType
.
canvas
,
child:
new
Flex
([
child:
new
Container
(
new
Text
(
"Charts are coming soon!"
,
style:
style
)
padding:
const
EdgeDims
.
all
(
20.0
),
],
justifyContent:
FlexJustifyContent
.
center
)
child:
buildChart
()
)
);
);
}
}
}
}
...
...
examples/fitness/lib/main.dart
View file @
98d4c3af
...
@@ -4,6 +4,7 @@
...
@@ -4,6 +4,7 @@
library
fitness
;
library
fitness
;
import
'package:playfair/playfair.dart'
as
playfair
;
import
'package:sky/editing/input.dart'
;
import
'package:sky/editing/input.dart'
;
import
'package:sky/painting/text_style.dart'
;
import
'package:sky/painting/text_style.dart'
;
import
'package:sky/theme/colors.dart'
as
colors
;
import
'package:sky/theme/colors.dart'
as
colors
;
...
...
examples/fitness/pubspec.yaml
View file @
98d4c3af
...
@@ -2,6 +2,7 @@ name: fitness
...
@@ -2,6 +2,7 @@ name: fitness
dependencies
:
dependencies
:
sky
:
any
sky
:
any
sky_tools
:
any
sky_tools
:
any
playfair
:
any
path
:
"
^1.3.6"
path
:
"
^1.3.6"
dependency_overrides
:
dependency_overrides
:
material_design_icons
:
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