update example app's color & pop up menu

null_safety
小赖 4 years ago
parent 6014f3796a
commit e85c4d9628

@ -10,6 +10,7 @@ class ExamplePopUpMenu extends StatefulWidget {
}
class _ExamplePopUpMenuState extends State<ExamplePopUpMenu> {
int _value;
@override
Widget build(BuildContext context) {
return ASScaffold(
@ -22,18 +23,23 @@ class _ExamplePopUpMenuState extends State<ExamplePopUpMenu> {
trailing: Builder(
builder: (context) {
return TextButton(
child: 'test'.text.make(),
onPressed: () {
showASPopUpMenu<int>(
child: '$_value'.text.make(),
onPressed: () async {
int result = await showASPopUpMenu<int>(
context: context,
initValue: 3,
items: [
PopupMenuItem(child: 'test'.text.make(), value: 1),
PopupMenuItem(child: 'test'.text.make(), value: 2),
PopupMenuItem(child: 'test'.text.make(), value: 3),
PopupMenuItem(child: 'test'.text.make(), value: 4),
],
).then((value) {});
initValue: _value,
items: List.generate(
20,
(index) => PopupMenuItem(
child: '$index'.text.isIntrinsic.make(),
value: index,
),
),
);
if (result != null)
setState(() {
_value = result;
});
},
);
},

@ -13,7 +13,19 @@ class ExampleStyleColor extends StatefulWidget {
class _ExampleStyleColorState extends State<ExampleStyleColor> {
_buildCard(ColorObject object) {
return ListTile(
title: Text('${object.name} ${object.color.toString().substring(6, 16)}'),
title: Text(
'${object.name} ${object.color.toString().substring(6, 16)}',
style: TextStyle(
color: object.color,
shadows: [
Shadow(
color: Colors.black54,
offset: Offset.zero,
blurRadius: 2,
),
],
),
),
subtitle: Text(object.codeName),
trailing: Card(
color: object.color,

Loading…
Cancel
Save