@@ -10,7 +10,7 @@ enum _Location {
|
||||
Bermuda
|
||||
}
|
||||
|
||||
typedef Widget DemoItemBodyBuilder(DemoItem<dynamic> item);
|
||||
typedef Widget DemoItemBodyBuilder<T>(DemoItem<T> item);
|
||||
typedef String ValueToString<T>(T value);
|
||||
|
||||
class DualHeaderWithHint extends StatelessWidget {
|
||||
@@ -152,7 +152,7 @@ class DemoItem<T> {
|
||||
|
||||
final String name;
|
||||
final String hint;
|
||||
final DemoItemBodyBuilder builder;
|
||||
final DemoItemBodyBuilder<T> builder;
|
||||
final ValueToString<T> valueToString;
|
||||
T value;
|
||||
bool isExpanded = false;
|
||||
@@ -189,7 +189,7 @@ class _ExpansionPanelsDemoState extends State<ExpasionPanelsDemo> {
|
||||
value: 'Caribbean cruise',
|
||||
hint: 'Change trip name',
|
||||
valueToString: (String value) => value,
|
||||
builder: (DemoItem<String> item) { // ignore: argument_type_not_assignable, https://github.com/flutter/flutter/issues/5771
|
||||
builder: (DemoItem<String> item) {
|
||||
void close() {
|
||||
setState(() {
|
||||
item.isExpanded = false;
|
||||
@@ -223,7 +223,7 @@ class _ExpansionPanelsDemoState extends State<ExpasionPanelsDemo> {
|
||||
value: _Location.Bahamas,
|
||||
hint: 'Select location',
|
||||
valueToString: (_Location location) => location.toString().split(".")[1],
|
||||
builder: (DemoItem<_Location> item) { // ignore: argument_type_not_assignable, https://github.com/flutter/flutter/issues/5771
|
||||
builder: (DemoItem<_Location> item) {
|
||||
void close() {
|
||||
setState(() {
|
||||
item.isExpanded = false;
|
||||
@@ -293,7 +293,7 @@ class _ExpansionPanelsDemoState extends State<ExpasionPanelsDemo> {
|
||||
value: 80.0,
|
||||
hint: 'Select sun level',
|
||||
valueToString: (double amount) => '${amount.round()}',
|
||||
builder: (DemoItem<double> item) { // ignore: argument_type_not_assignable, https://github.com/flutter/flutter/issues/5771
|
||||
builder: (DemoItem<double> item) {
|
||||
void close() {
|
||||
setState(() {
|
||||
item.isExpanded = false;
|
||||
|
||||
@@ -209,7 +209,6 @@ class ListItem extends StatelessWidget {
|
||||
height: itemHeight,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16.0),
|
||||
child: new Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: children
|
||||
)
|
||||
)
|
||||
|
||||
@@ -142,9 +142,9 @@ class AssetImage extends AssetBundleImageProvider {
|
||||
if (json == null)
|
||||
return null;
|
||||
// TODO(ianh): JSON decoding really shouldn't be on the main thread.
|
||||
final Map<dynamic, dynamic> parsedManifest = JSON.decode(json);
|
||||
final Map<String, List<String>> parsedManifest = JSON.decode(json);
|
||||
// TODO(ianh): convert that data structure to the right types.
|
||||
return new SynchronousFuture<Map<dynamic, dynamic>>(parsedManifest); // ignore: return_of_invalid_type, https://github.com/flutter/flutter/issues/5771
|
||||
return new SynchronousFuture<Map<String, List<String>>>(parsedManifest);
|
||||
}
|
||||
|
||||
String _chooseVariant(String main, ImageConfiguration config, List<String> candidates) {
|
||||
|
||||
@@ -25,7 +25,7 @@ abstract class UniqueWidget<T extends State<StatefulWidget>> extends StatefulWid
|
||||
/// The [key] argument cannot be null because it identifies the unique
|
||||
/// inflated instance of this widget.
|
||||
UniqueWidget({
|
||||
@required GlobalKey key
|
||||
@required GlobalKey<T> key
|
||||
}) : super(key: key) {
|
||||
assert(key != null);
|
||||
}
|
||||
@@ -37,7 +37,7 @@ abstract class UniqueWidget<T extends State<StatefulWidget>> extends StatefulWid
|
||||
///
|
||||
/// Might be null if the widget is not currently in the tree.
|
||||
T get currentState {
|
||||
GlobalKey globalKey = key;
|
||||
return globalKey.currentState; // ignore: return_of_invalid_type, https://github.com/flutter/flutter/issues/5771
|
||||
GlobalKey<T> globalKey = key;
|
||||
return globalKey.currentState;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user