Update quill_dropdown_button.dart

pull/794/head
mark8044 3 years ago committed by GitHub
parent 53e97c81d3
commit f91ad4d4b1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      lib/src/widgets/toolbar/quill_dropdown_button.dart

@ -4,6 +4,7 @@ import '../../models/themes/quill_icon_theme.dart';
class QuillDropdownButton<T> extends StatefulWidget {
const QuillDropdownButton({
required this.initialValue,
required this.initialValueTitle,
required this.items,
required this.onSelected,
this.height = 40,
@ -19,6 +20,7 @@ class QuillDropdownButton<T> extends StatefulWidget {
final double hoverElevation;
final double highlightElevation;
final T initialValue;
final String initialValueTitle;
final List<PopupMenuEntry<T>> items;
final ValueChanged<T> onSelected;
final QuillIconTheme? iconTheme;
@ -29,12 +31,12 @@ class QuillDropdownButton<T> extends StatefulWidget {
// ignore: deprecated_member_use_from_same_package
class _QuillDropdownButtonState<T> extends State<QuillDropdownButton<T>> {
int _currentValue = 0;
String _currentValue = '';
@override
void initState() {
super.initState();
_currentValue = widget.initialValue as int;
_currentValue = widget.initialValueTitle;
}
@override
@ -87,7 +89,7 @@ class _QuillDropdownButtonState<T> extends State<QuillDropdownButton<T>> {
return null;
}
setState(() {
_currentValue = newValue as int;
_currentValue = ((widget.items[1].key) as ValueKey<String>).value;
widget.onSelected(newValue);
});
});

Loading…
Cancel
Save