I'm a beginer of flutter and trying to write a code to display a button that looks like ElevatedButton and displays popup when it is tapped.
I wrote a code like below but didn't work.
Does anyone know how to solve this problem?
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Welcome to Flutter',
home: Scaffold(
appBar: AppBar(
title: const Text('Welcome to Flutter'),
),
body: Center(
child: PopupMenuButton(
itemBuilder: (context) => [
PopupMenuItem(
child: Column(
children: const [Text('item1'), Text('item2')]))
],
child: ElevatedButton(
onPressed: () {},
child: const Text('show popup menu'),
))),
),
);
}
}