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
eda87925
Commit
eda87925
authored
Oct 01, 2015
by
Ian Hickson
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1437 from Hixie/mixed_viewport_demo
Remove the mixed_viewport demo
parents
4d186e3c
13ffcaff
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
125 deletions
+0
-125
mixed_viewport.dart
examples/widgets/mixed_viewport.dart
+0
-125
No files found.
examples/widgets/mixed_viewport.dart
deleted
100644 → 0
View file @
4d186e3c
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import
'dart:math'
as
math
;
import
'package:sky/widgets.dart'
;
class
MixedViewportApp
extends
App
{
MixedViewportLayoutState
layoutState
=
new
MixedViewportLayoutState
();
List
<
double
>
lengths
=
<
double
>[];
double
offset
=
0.0
;
static
const
double
kMaxLength
=
100.0
;
static
math
.
Random
rand
=
new
math
.
Random
();
void
addBox
()
{
lengths
.
add
(
rand
.
nextDouble
()
*
kMaxLength
);
updateEnabledState
();
}
void
removeBox
(
int
index
)
{
lengths
.
removeAt
(
index
);
updateEnabledState
();
}
void
goUp
()
{
offset
-=
9.9
;
updateEnabledState
();
}
void
goDown
()
{
offset
+=
20.45
;
updateEnabledState
();
}
bool
enabledDown
=
true
;
bool
enabledUp
=
true
;
bool
enabledAdd
=
true
;
bool
enabledRemove
=
false
;
void
updateEnabledState
()
{
setState
(()
{
enabledUp
=
offset
>
-
100.0
;
enabledDown
=
offset
<
lengths
.
fold
(
0.0
,
(
double
result
,
double
len
)
=>
result
+
len
)
+
100.0
;
enabledAdd
=
true
;
enabledRemove
=
lengths
.
length
>
0
;
});
}
Widget
build
()
{
return
new
Theme
(
data:
new
ThemeData
.
light
(),
child:
new
Scaffold
(
toolbar:
new
ToolBar
(
center:
new
Text
(
'Block Viewport Demo'
)),
body:
new
Material
(
type:
MaterialType
.
canvas
,
child:
new
Column
([
new
Container
(
padding:
new
EdgeDims
.
symmetric
(
horizontal:
8.0
,
vertical:
25.0
),
child:
new
Row
([
new
RaisedButton
(
enabled:
enabledAdd
,
child:
new
Text
(
'ADD'
),
onPressed:
addBox
),
new
RaisedButton
(
enabled:
enabledUp
,
child:
new
Text
(
'UP'
),
onPressed:
goUp
),
new
RaisedButton
(
enabled:
enabledDown
,
child:
new
Text
(
'DOWN'
),
onPressed:
goDown
)
],
justifyContent:
FlexJustifyContent
.
spaceAround
)
),
new
Flexible
(
child:
new
Container
(
margin:
new
EdgeDims
.
all
(
8.0
),
decoration:
new
BoxDecoration
(
border:
new
Border
.
all
(
color:
new
Color
(
0xFF000000
))
),
padding:
new
EdgeDims
.
all
(
16.0
),
child:
new
MixedViewport
(
builder:
builder
,
startOffset:
offset
,
token:
lengths
.
length
,
layoutState:
layoutState
)
)
),
],
justifyContent:
FlexJustifyContent
.
spaceBetween
)
)
)
);
}
Widget
builder
(
int
index
)
{
if
(
index
>=
lengths
.
length
)
return
null
;
return
new
GestureDetector
(
key:
new
ValueKey
<
double
>(
lengths
[
index
]),
onTap:
()
=>
removeBox
(
index
),
child:
new
Container
(
decoration:
new
BoxDecoration
(
backgroundColor:
new
Color
((
0xFF000000
+
0xFFFFFF
*
lengths
[
index
]
/
kMaxLength
).
round
())
),
height:
lengths
[
index
]
+
12.0
)
);
}
}
void
main
(
)
{
runApp
(
new
MixedViewportApp
());
}
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