mirror of
https://github.com/flutter/samples.git
synced 2025-11-08 22:09:06 +00:00
Flutter 3.29 beta (#2571)
This commit is contained in:
@@ -4,10 +4,7 @@ import 'package:flutter/material.dart';
|
||||
typedef PlatformCallback = void Function(TargetPlatform platform);
|
||||
|
||||
class PlatformSelector extends StatefulWidget {
|
||||
const PlatformSelector({
|
||||
super.key,
|
||||
required this.onChangedPlatform,
|
||||
});
|
||||
const PlatformSelector({super.key, required this.onChangedPlatform});
|
||||
|
||||
final PlatformCallback onChangedPlatform;
|
||||
|
||||
@@ -40,21 +37,19 @@ class _PlatformSelectorState extends State<PlatformSelector> {
|
||||
widget.onChangedPlatform(value);
|
||||
setState(() {});
|
||||
},
|
||||
items: TargetPlatform.values.map((platform) {
|
||||
return DropdownMenuItem<TargetPlatform>(
|
||||
value: platform,
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
if (platform == originaPlatform)
|
||||
const Icon(
|
||||
Icons.home,
|
||||
color: Color(0xff616161),
|
||||
),
|
||||
Text(_platformToString(platform)),
|
||||
],
|
||||
),
|
||||
);
|
||||
}).toList(),
|
||||
items:
|
||||
TargetPlatform.values.map((platform) {
|
||||
return DropdownMenuItem<TargetPlatform>(
|
||||
value: platform,
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
if (platform == originaPlatform)
|
||||
const Icon(Icons.home, color: Color(0xff616161)),
|
||||
Text(_platformToString(platform)),
|
||||
],
|
||||
),
|
||||
);
|
||||
}).toList(),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user