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
7ecc698c
Commit
7ecc698c
authored
Apr 12, 2016
by
Eric Seidel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wip
parent
ecf1cce8
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
45 additions
and
14 deletions
+45
-14
app.dart
examples/material_gallery/lib/gallery/app.dart
+5
-1
drawer.dart
examples/material_gallery/lib/gallery/drawer.dart
+27
-8
home.dart
examples/material_gallery/lib/gallery/home.dart
+13
-5
No files found.
examples/material_gallery/lib/gallery/app.dart
View file @
7ecc698c
...
...
@@ -16,16 +16,20 @@ class GalleryApp extends StatefulWidget {
class
GalleryAppState
extends
State
<
GalleryApp
>
{
bool
_useLightTheme
=
true
;
bool
_showPerformanceOverlay
=
false
;
@override
Widget
build
(
BuildContext
context
)
{
return
new
MaterialApp
(
title:
'Flutter Material Gallery'
,
theme:
_useLightTheme
?
_kGalleryLightTheme
:
_kGalleryDarkTheme
,
showPerformanceOverlay:
_showPerformanceOverlay
,
routes:
{
'/'
:
(
BuildContext
context
)
=>
new
GalleryHome
(
t
heme:
_useLightTheme
,
useLightT
heme:
_useLightTheme
,
onThemeChanged:
(
bool
value
)
{
setState
(()
{
_useLightTheme
=
value
;
});
},
showPerformanceOverlay:
_showPerformanceOverlay
,
onShowPerformanceOverlayChanged:
(
bool
value
)
{
setState
(()
{
_showPerformanceOverlay
=
value
;
});
},
timeDilation:
timeDilation
,
onTimeDilationChanged:
(
double
value
)
{
setState
(()
{
timeDilation
=
value
;
});
}
)
...
...
examples/material_gallery/lib/gallery/drawer.dart
View file @
7ecc698c
...
...
@@ -7,21 +7,26 @@ import 'package:flutter/material.dart';
class
GalleryDrawer
extends
StatelessWidget
{
GalleryDrawer
({
Key
key
,
this
.
t
heme
,
this
.
useLightT
heme
,
this
.
onThemeChanged
,
this
.
timeDilation
,
this
.
onTimeDilationChanged
this
.
onTimeDilationChanged
,
this
.
showPerformanceOverlay
,
this
.
onShowPerformanceOverlayChanged
})
:
super
(
key:
key
)
{
assert
(
onThemeChanged
!=
null
);
assert
(
onTimeDilationChanged
!=
null
);
}
final
bool
t
heme
;
final
bool
useLightT
heme
;
final
ValueChanged
<
bool
>
onThemeChanged
;
final
double
timeDilation
;
final
ValueChanged
<
double
>
onTimeDilationChanged
;
final
bool
showPerformanceOverlay
;
final
ValueChanged
<
bool
>
onShowPerformanceOverlayChanged
;
@override
Widget
build
(
BuildContext
context
)
{
return
new
Drawer
(
...
...
@@ -31,13 +36,13 @@ class GalleryDrawer extends StatelessWidget {
new
DrawerItem
(
icon:
Icons
.
brightness_5
,
onPressed:
()
{
onThemeChanged
(
true
);
},
selected:
t
heme
,
selected:
useLightT
heme
,
child:
new
Row
(
children:
<
Widget
>[
new
Flexible
(
child:
new
Text
(
'Light'
)),
new
Radio
<
bool
>(
value:
true
,
groupValue:
t
heme
,
groupValue:
useLightT
heme
,
onChanged:
onThemeChanged
)
]
...
...
@@ -46,13 +51,13 @@ class GalleryDrawer extends StatelessWidget {
new
DrawerItem
(
icon:
Icons
.
brightness_7
,
onPressed:
()
{
onThemeChanged
(
false
);
},
selected:
t
heme
,
selected:
useLightT
heme
,
child:
new
Row
(
children:
<
Widget
>[
new
Flexible
(
child:
new
Text
(
'Dark'
)),
new
Radio
<
bool
>(
value:
false
,
groupValue:
t
heme
,
groupValue:
useLightT
heme
,
onChanged:
onThemeChanged
)
]
...
...
@@ -72,7 +77,21 @@ class GalleryDrawer extends StatelessWidget {
)
]
)
)
),
new
DrawerItem
(
icon:
Icons
.
assessment
,
onPressed:
()
{
onShowPerformanceOverlayChanged
(!
showPerformanceOverlay
);
},
selected:
showPerformanceOverlay
,
child:
new
Row
(
children:
<
Widget
>[
new
Flexible
(
child:
new
Text
(
'Performance Overlay'
)),
new
Checkbox
(
value:
showPerformanceOverlay
,
onChanged:
(
bool
value
)
{
onShowPerformanceOverlayChanged
(!
showPerformanceOverlay
);
}
)
]
)
),
]
)
);
...
...
examples/material_gallery/lib/gallery/home.dart
View file @
7ecc698c
...
...
@@ -46,21 +46,27 @@ const double _kFlexibleSpaceMaxHeight = 256.0;
class
GalleryHome
extends
StatefulWidget
{
GalleryHome
({
Key
key
,
this
.
t
heme
,
this
.
useLightT
heme
,
this
.
onThemeChanged
,
this
.
timeDilation
,
this
.
onTimeDilationChanged
this
.
onTimeDilationChanged
,
this
.
showPerformanceOverlay
,
this
.
onShowPerformanceOverlayChanged
})
:
super
(
key:
key
)
{
assert
(
onThemeChanged
!=
null
);
assert
(
onTimeDilationChanged
!=
null
);
assert
(
onShowPerformanceOverlayChanged
!=
null
);
}
final
bool
t
heme
;
final
bool
useLightT
heme
;
final
ValueChanged
<
bool
>
onThemeChanged
;
final
double
timeDilation
;
final
ValueChanged
<
double
>
onTimeDilationChanged
;
final
bool
showPerformanceOverlay
;
final
ValueChanged
<
bool
>
onShowPerformanceOverlayChanged
;
@override
GalleryHomeState
createState
()
=>
new
GalleryHomeState
();
}
...
...
@@ -76,10 +82,12 @@ class GalleryHomeState extends State<GalleryHome> {
return
new
Scaffold
(
key:
_homeKey
,
drawer:
new
GalleryDrawer
(
theme:
config
.
t
heme
,
useLightTheme:
config
.
useLightT
heme
,
onThemeChanged:
config
.
onThemeChanged
,
timeDilation:
config
.
timeDilation
,
onTimeDilationChanged:
config
.
onTimeDilationChanged
onTimeDilationChanged:
config
.
onTimeDilationChanged
,
showPerformanceOverlay:
config
.
showPerformanceOverlay
,
onShowPerformanceOverlayChanged:
config
.
onShowPerformanceOverlayChanged
),
appBar:
new
AppBar
(
expandedHeight:
_kFlexibleSpaceMaxHeight
,
...
...
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