In order to add a menu to your desktop app, follow the next steps:
- In your project, open the pubspec.yaml file and add the following dependency:
menubar:
git:
url: git://github.com/google/flutter-desktop-embedding.git
path: plugins/menubar
- In the http_helper.dart file in the data folder, edit the getFlutterBooks method, so that it becomes a more generic getBooks method that takes a String as a parameter, and move the params declaration inside the method, as shown here:
class HttpHelper {
final String authority = 'www.googleapis.com';
final String path = '/books/v1/volumes';
Future<List<Book>> getBooks(String query) async {
Map<String, dynamic> params = {'q':query, 'maxResults': '40', };
...
- At the top of the book_list_screen.dart file, add the menubar import:
import 'package:menubar/menubar.dart';
- Move the HttpHelper helper declaration to the top of the _BookListScreenState...