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
6111301a
Commit
6111301a
authored
Oct 08, 2015
by
Adam Barth
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1540 from abarth/rm_button_state
Remove ButtonState
parents
67367974
3308ff00
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
21 additions
and
49 deletions
+21
-49
main.dart
examples/game/lib/main.dart
+21
-6
button_state.dart
packages/flutter/lib/src/widgets/button_state.dart
+0
-39
drawer_item.dart
packages/flutter/lib/src/widgets/drawer_item.dart
+0
-1
floating_action_button.dart
packages/flutter/lib/src/widgets/floating_action_button.dart
+0
-1
material_button.dart
packages/flutter/lib/src/widgets/material_button.dart
+0
-1
widgets.dart
packages/flutter/lib/widgets.dart
+0
-1
No files found.
examples/game/lib/main.dart
View file @
6111301a
...
...
@@ -151,16 +151,18 @@ class TextureButton extends StatefulComponent {
TextureButtonState
createState
()
=>
new
TextureButtonState
();
}
class
TextureButtonState
extends
ButtonState
<
TextureButton
>
{
Widget
buildContent
(
BuildContext
context
)
{
return
new
Listener
(
class
TextureButtonState
extends
State
<
TextureButton
>
{
bool
_highlight
=
false
;
Widget
build
(
BuildContext
context
)
{
return
new
GestureDetector
(
child:
new
Container
(
width:
config
.
width
,
height:
config
.
height
,
child:
new
CustomPaint
(
callback:
paintCallback
,
token:
new
_TextureButtonToken
(
highlight
,
_
highlight
,
config
.
texture
,
config
.
textureDown
,
config
.
width
,
...
...
@@ -168,9 +170,22 @@ class TextureButtonState extends ButtonState<TextureButton> {
)
)
),
onPointerUp:
(
_
)
{
onTapDown:
()
{
setState
(()
{
_highlight
=
true
;
});
},
onTap:
()
{
setState
(()
{
_highlight
=
false
;
});
if
(
config
.
onPressed
!=
null
)
config
.
onPressed
();
},
onTapCancel:
()
{
setState
(()
{
_highlight
=
false
;
});
}
);
}
...
...
@@ -180,7 +195,7 @@ class TextureButtonState extends ButtonState<TextureButton> {
return
;
canvas
.
save
();
if
(
highlight
&&
config
.
textureDown
!=
null
)
{
if
(
_
highlight
&&
config
.
textureDown
!=
null
)
{
// Draw down state
canvas
.
scale
(
size
.
width
/
config
.
textureDown
.
size
.
width
,
size
.
height
/
config
.
textureDown
.
size
.
height
);
config
.
textureDown
.
drawTexture
(
canvas
,
Point
.
origin
,
new
Paint
());
...
...
packages/flutter/lib/src/widgets/button_state.dart
deleted
100644 → 0
View file @
67367974
// 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
'package:sky/src/widgets/basic.dart'
;
import
'package:sky/src/widgets/framework.dart'
;
abstract
class
ButtonState
<
T
extends
StatefulComponent
>
extends
State
<
T
>
{
bool
highlight
=
false
;
void
_handlePointerDown
(
_
)
{
setState
(()
{
highlight
=
true
;
});
}
void
_handlePointerUp
(
_
)
{
setState
(()
{
highlight
=
false
;
});
}
void
_handlePointerCancel
(
_
)
{
setState
(()
{
highlight
=
false
;
});
}
Widget
build
(
BuildContext
context
)
{
return
new
Listener
(
onPointerDown:
_handlePointerDown
,
onPointerUp:
_handlePointerUp
,
onPointerCancel:
_handlePointerCancel
,
child:
buildContent
(
context
)
);
}
Widget
buildContent
(
BuildContext
context
);
}
packages/flutter/lib/src/widgets/drawer_item.dart
View file @
6111301a
...
...
@@ -8,7 +8,6 @@ import 'package:sky/gestures.dart';
import
'package:sky/material.dart'
;
import
'package:sky/painting.dart'
;
import
'package:sky/src/widgets/basic.dart'
;
import
'package:sky/src/widgets/button_state.dart'
;
import
'package:sky/src/widgets/framework.dart'
;
import
'package:sky/src/widgets/icon.dart'
;
import
'package:sky/src/widgets/ink_well.dart'
;
...
...
packages/flutter/lib/src/widgets/floating_action_button.dart
View file @
6111301a
...
...
@@ -4,7 +4,6 @@
import
'package:sky/gestures.dart'
;
import
'package:sky/src/widgets/basic.dart'
;
import
'package:sky/src/widgets/button_state.dart'
;
import
'package:sky/src/widgets/framework.dart'
;
import
'package:sky/src/widgets/icon.dart'
;
import
'package:sky/src/widgets/ink_well.dart'
;
...
...
packages/flutter/lib/src/widgets/material_button.dart
View file @
6111301a
...
...
@@ -4,7 +4,6 @@
import
'package:sky/gestures.dart'
;
import
'package:sky/src/widgets/basic.dart'
;
import
'package:sky/src/widgets/button_state.dart'
;
import
'package:sky/src/widgets/framework.dart'
;
import
'package:sky/src/widgets/ink_well.dart'
;
import
'package:sky/src/widgets/material.dart'
;
...
...
packages/flutter/lib/widgets.dart
View file @
6111301a
...
...
@@ -9,7 +9,6 @@ export 'src/widgets/animated_container.dart';
export
'src/widgets/app.dart'
;
export
'src/widgets/basic.dart'
;
export
'src/widgets/binding.dart'
;
export
'src/widgets/button_state.dart'
;
export
'src/widgets/card.dart'
;
export
'src/widgets/checkbox.dart'
;
export
'src/widgets/date_picker.dart'
;
...
...
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