From 344fe9057ff0f1eff7374cd0e25b48b8affd19f5 Mon Sep 17 00:00:00 2001 From: Matthew Maxwell Date: Thu, 27 Jun 2024 14:50:37 -0700 Subject: [PATCH] switch flutter_picker_plus to bottom_picker --- demo/flutter/lib/main.dart | 26 ++++++++++++++++---------- demo/flutter/pubspec.yaml | 2 +- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/demo/flutter/lib/main.dart b/demo/flutter/lib/main.dart index 603efd7a0..050b32714 100644 --- a/demo/flutter/lib/main.dart +++ b/demo/flutter/lib/main.dart @@ -14,7 +14,7 @@ import 'package:flutter/material.dart'; import 'dart:async'; import 'dart:convert'; -import 'package:flutter_picker_plus/flutter_picker_plus.dart'; +import 'package:bottom_picker/bottom_picker.dart'; import 'package:porcupine_flutter/porcupine.dart'; import 'package:porcupine_flutter/porcupine_manager.dart'; import 'package:porcupine_flutter/porcupine_error.dart'; @@ -327,14 +327,20 @@ class _MyAppState extends State with WidgetsBindingObserver { ))); showPicker(BuildContext context) { - Picker picker = Picker( - adapter: PickerDataAdapter(pickerData: _keywords.toList()), - changeToFirst: true, - textAlign: TextAlign.left, - columnPadding: const EdgeInsets.all(8.0), - onConfirm: (Picker picker, List value) { - loadNewKeyword(picker.getSelectedValues()[0]); - }); - picker.show(_scaffoldKey.currentState!); + BottomPicker picker = BottomPicker( + pickerTitle: Text( + "Choose a keyword", + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 15)), + titleAlignment: Alignment.topCenter, + items: _keywords.toList().map((x) => Center( + child: Text(x) + )).toList(), + onSubmit: (index) { + loadNewKeyword(_keywords[index]); + }, + ); + picker.show(_scaffoldKey.currentContext!); } } diff --git a/demo/flutter/pubspec.yaml b/demo/flutter/pubspec.yaml index 1caf077c4..569c67d92 100644 --- a/demo/flutter/pubspec.yaml +++ b/demo/flutter/pubspec.yaml @@ -13,7 +13,7 @@ dependencies: flutter: sdk: flutter - flutter_picker_plus: ^1.3.0 + bottom_picker: ^2.7.0 porcupine_flutter: ^3.0.3 path: ^1.8.0