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
121c7a03
Commit
121c7a03
authored
Mar 18, 2016
by
Ian Hickson
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2728 from Hixie/widgetsapp
Widgets App fixes and minor newton cleanup
parents
6d55f5d3
d8c74736
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
33 additions
and
27 deletions
+33
-27
app.dart
packages/flutter/lib/src/material/app.dart
+3
-1
app.dart
packages/flutter/lib/src/widgets/app.dart
+28
-24
scroll_simulation.dart
packages/newton/lib/src/scroll_simulation.dart
+1
-1
simulation.dart
packages/newton/lib/src/simulation.dart
+1
-1
No files found.
packages/flutter/lib/src/material/app.dart
View file @
121c7a03
...
...
@@ -36,12 +36,12 @@ class MaterialApp extends WidgetsApp {
bool
showSemanticsDebugger:
false
,
bool
debugShowCheckedModeBanner:
true
})
:
theme
=
theme
,
routes
=
routes
,
super
(
key:
key
,
title:
title
,
textStyle:
_errorTextStyle
,
color:
theme
?.
primaryColor
??
Colors
.
blue
[
500
],
// blue[500] is the primary color of the default theme
routes:
routes
,
onGenerateRoute:
(
RouteSettings
settings
)
{
WidgetBuilder
builder
=
routes
[
settings
.
name
];
if
(
builder
!=
null
)
{
...
...
@@ -65,6 +65,8 @@ class MaterialApp extends WidgetsApp {
/// The colors to use for the application's widgets.
final
ThemeData
theme
;
final
Map
<
String
,
WidgetBuilder
>
routes
;
/// Turns on a [GridPaper] overlay that paints a baseline grid
/// Material apps:
/// https://www.google.com/design/spec/layout/metrics-keylines.html
...
...
packages/flutter/lib/src/widgets/app.dart
View file @
121c7a03
...
...
@@ -30,21 +30,28 @@ final AssetBundle _defaultBundle = _initDefaultBundle();
typedef
Future
<
LocaleQueryData
>
LocaleChangedCallback
(
Locale
locale
);
/// A convenience class that wraps a number of widgets that are commonly
/// required for an application.
///
/// See also: [CheckedModeBanner], [DefaultTextStyle], [MediaQuery],
/// [LocaleQuery], [AssetVendor], [Title], [Navigator], [Overlay],
/// [SemanticsDebugger] (the widgets wrapped by this one).
///
/// The [onGenerateRoute] argument is required, and corresponds to
/// [Navigator.onGenerateRoute].
class
WidgetsApp
extends
StatefulWidget
{
WidgetsApp
({
Key
key
,
this
.
title
,
this
.
textStyle
,
this
.
color
,
this
.
routes
:
const
<
String
,
WidgetBuilder
>{},
this
.
onGenerateRoute
,
this
.
onLocaleChanged
,
this
.
showPerformanceOverlay
:
false
,
this
.
showSemanticsDebugger
:
false
,
this
.
debugShowCheckedModeBanner
:
true
})
:
super
(
key:
key
)
{
assert
(
routes
!=
null
);
assert
(
routes
.
containsKey
(
Navigator
.
defaultRouteName
)
||
onGenerateRoute
!=
null
);
assert
(
onGenerateRoute
!=
null
);
assert
(
showPerformanceOverlay
!=
null
);
assert
(
showSemanticsDebugger
!=
null
);
}
...
...
@@ -62,14 +69,8 @@ class WidgetsApp extends StatefulWidget {
/// application switcher.
final
Color
color
;
/// The default table of routes for the application. When the
/// [Navigator] is given a named route, the name will be looked up
/// in this table first. If the name is not available, then
/// [onGenerateRoute] will be called instead.
final
Map
<
String
,
WidgetBuilder
>
routes
;
/// The route generator callback used when the app is navigated to a
/// named route
but the name is not in the [routes] table
.
/// named route.
final
RouteFactory
onGenerateRoute
;
/// Callback that is invoked when the operating system changes the
...
...
@@ -179,25 +180,28 @@ class WidgetsAppState<T extends WidgetsApp> extends State<T> implements BindingO
),
child:
new
LocaleQuery
(
data:
_localeData
,
child:
new
DefaultTextStyle
(
style:
config
.
textStyle
,
child:
new
AssetVendor
(
bundle:
_defaultBundle
,
devicePixelRatio:
ui
.
window
.
devicePixelRatio
,
child:
new
Title
(
title:
config
.
title
,
color:
config
.
color
,
child:
new
Navigator
(
key:
_navigator
,
initialRoute:
ui
.
window
.
defaultRouteName
,
onGenerateRoute:
config
.
onGenerateRoute
,
observer:
navigatorObserver
)
child:
new
AssetVendor
(
bundle:
_defaultBundle
,
devicePixelRatio:
ui
.
window
.
devicePixelRatio
,
child:
new
Title
(
title:
config
.
title
,
color:
config
.
color
,
child:
new
Navigator
(
key:
_navigator
,
initialRoute:
ui
.
window
.
defaultRouteName
,
onGenerateRoute:
config
.
onGenerateRoute
,
observer:
navigatorObserver
)
)
)
)
);
if
(
config
.
textStyle
!=
null
)
{
new
DefaultTextStyle
(
style:
config
.
textStyle
,
child:
result
);
}
if
(
config
.
showPerformanceOverlay
)
{
result
=
new
Stack
(
children:
<
Widget
>[
...
...
packages/newton/lib/src/scroll_simulation.dart
View file @
121c7a03
...
...
@@ -45,7 +45,7 @@ class ScrollSimulation extends SimulationGroup {
if
(
_spring
==
null
&&
(
position
>
_trailingExtent
||
position
<
_leadingExtent
))
return
false
;
//
/
This simulation can only step forward.
// This simulation can only step forward.
if
(!
_isSpringing
)
{
if
(
position
>
_trailingExtent
)
{
_isSpringing
=
true
;
...
...
packages/newton/lib/src/simulation.dart
View file @
121c7a03
...
...
@@ -14,7 +14,7 @@ abstract class Simulation {
double
x
(
double
time
);
/// The current velocity of the object in the simulation
double
dx
(
double
time
);
// TODO(ianh): remove this; see https://github.com/flutter/flutter/issues/2092
double
dx
(
double
time
);
/// Returns if the simulation is done at a given time
bool
isDone
(
double
time
);
...
...
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