Skip to content

Commit

Permalink
switch flutter_picker_plus to bottom_picker
Browse files Browse the repository at this point in the history
  • Loading branch information
matt200-ok committed Jun 27, 2024
1 parent 6dd66c7 commit 344fe90
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 11 deletions.
26 changes: 16 additions & 10 deletions demo/flutter/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -327,14 +327,20 @@ class _MyAppState extends State<MyApp> with WidgetsBindingObserver {
)));

showPicker(BuildContext context) {
Picker picker = Picker(
adapter: PickerDataAdapter<String>(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!);
}
}
2 changes: 1 addition & 1 deletion demo/flutter/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 344fe90

Please sign in to comment.