Skip to content

Commit 15cfc02

Browse files
Upgrade to Dart 3 (Flutter 3?) and packages to latest major versions
- Fixed problems with DropdownButton2 in `lib/components/button.dart` - Tried to match behaviour off old version, might not be 100% correct - Update generated linux bindings Signed-off-by: Erick Howard <needlesslygrim@proton.me>
1 parent b7a0df9 commit 15cfc02

5 files changed

Lines changed: 212 additions & 166 deletions

File tree

lib/components/button.dart

Lines changed: 80 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ class _MLongDropdownButtonState extends State<MLongDropdownButton> {
246246
final String? selectedValue = widget.value;
247247
return DropdownButtonHideUnderline(
248248
child: DropdownButton2(
249-
searchInnerWidgetHeight: 20,
249+
250250
isExpanded: true,
251251
customButton: RawMaterialButton(
252252
onPressed: null,
@@ -316,32 +316,45 @@ class _MLongDropdownButtonState extends State<MLongDropdownButton> {
316316
value: selectedValue,
317317
onChanged: (value) {
318318
setState(() {
319-
widget.onChanged(context, value);
319+
widget.onChanged(context, value as String?);
320320
});
321321
},
322-
buttonHeight: 40,
323-
dropdownElevation: 0,
324-
itemHeight: 40,
325-
dropdownMaxHeight: 360,
326-
dropdownDecoration: BoxDecoration(
327-
color: MColors.white,
328-
borderRadius: BorderRadius.circular(8),
329-
border: Border.all(color: MColors.grey.shade200),
330-
boxShadow: const [
331-
BoxShadow(
332-
color: Color(0x19101828),
333-
offset: Offset(0, 4),
334-
blurRadius: 8,
335-
spreadRadius: -2,
336-
),
337-
BoxShadow(
338-
color: Color(0x10101828),
339-
offset: Offset(0, 2),
340-
blurRadius: 4,
341-
spreadRadius: -2,
342-
),
343-
],
322+
buttonStyleData: const ButtonStyleData(height: 40),
323+
onMenuStateChange: (isOpen) {
324+
if (!isOpen) {
325+
textEditingController.clear();
326+
}
327+
},
328+
dropdownStyleData: DropdownStyleData(
329+
elevation: 0,
330+
maxHeight: 360,
331+
padding: const EdgeInsets.only(bottom: 6),
332+
333+
decoration: BoxDecoration(
334+
color: MColors.white,
335+
borderRadius: BorderRadius.circular(8),
336+
border: Border.all(color: MColors.grey.shade200),
337+
boxShadow: const [
338+
BoxShadow(
339+
color: Color(0x19101828),
340+
offset: Offset(0, 4),
341+
blurRadius: 8,
342+
spreadRadius: -2,
343+
),
344+
BoxShadow(
345+
color: Color(0x10101828),
346+
offset: Offset(0, 2),
347+
blurRadius: 4,
348+
spreadRadius: -2,
349+
),
350+
],
351+
),
344352
),
353+
menuItemStyleData: const MenuItemStyleData(height: 40),
354+
355+
356+
dropdownSearchData: DropdownSearchData(
357+
searchInnerWidgetHeight: 20,
345358
searchController: textEditingController,
346359
searchInnerWidget: Padding(
347360
padding: const EdgeInsets.only(
@@ -374,12 +387,8 @@ class _MLongDropdownButtonState extends State<MLongDropdownButton> {
374387
.toLowerCase()
375388
.contains(searchValue.toLowerCase());
376389
},
377-
dropdownPadding: const EdgeInsets.only(bottom: 6),
378-
onMenuStateChange: (isOpen) {
379-
if (!isOpen) {
380-
textEditingController.clear();
381-
}
382-
},
390+
391+
)
383392
),
384393
);
385394
}
@@ -425,7 +434,9 @@ class _MLongComboDropdownButtonState extends State<MLongComboDropdownButton> {
425434
return DropdownButtonHideUnderline(
426435
child: DropdownButton2(
427436
isExpanded: true,
428-
scrollbarAlwaysShow: true,
437+
// FIXME: Fix this:
438+
// scrollbarAlwaysShow: true,
439+
429440
customButton: RawMaterialButton(
430441
onPressed: null,
431442
constraints: const BoxConstraints(),
@@ -519,33 +530,47 @@ class _MLongComboDropdownButtonState extends State<MLongComboDropdownButton> {
519530
)
520531
.toList(),
521532
value: selectedValue.isEmpty ? null : selectedValue.last,
522-
selectedItemHighlightColor: MColors.transparent,
533+
// FIXME: Fix this
534+
// selectedItemHighlightColor: MColors.transparent,
523535
onChanged: (value) {},
524-
buttonHeight: 40,
525-
dropdownElevation: 0,
526-
itemHeight: 40,
527-
dropdownMaxHeight: 360,
528-
dropdownDecoration: BoxDecoration(
529-
color: MColors.white,
530-
borderRadius: BorderRadius.circular(8),
531-
border: Border.all(color: MColors.grey.shade200),
532-
boxShadow: const [
533-
BoxShadow(
534-
color: Color(0x19101828),
535-
offset: Offset(0, 4),
536-
blurRadius: 8,
537-
spreadRadius: -2,
538-
),
539-
BoxShadow(
540-
color: Color(0x10101828),
541-
offset: Offset(0, 2),
542-
blurRadius: 4,
543-
spreadRadius: -2,
544-
),
536+
buttonStyleData: const ButtonStyleData(
537+
height: 40,
538+
),
539+
dropdownStyleData: DropdownStyleData(
540+
scrollbarTheme: ScrollbarThemeData(
541+
// I think this does the right thing...
542+
thumbVisibility: MaterialStateProperty.all(true)
543+
),
544+
elevation: 0,
545+
padding: const EdgeInsets.only(bottom: 6),
546+
maxHeight: 360,
547+
decoration: BoxDecoration(
548+
color: MColors.white,
549+
borderRadius: BorderRadius.circular(8),
550+
border: Border.all(color: MColors.grey.shade200),
551+
boxShadow: const [
552+
BoxShadow(
553+
color: Color(0x19101828),
554+
offset: Offset(0, 4),
555+
blurRadius: 8,
556+
spreadRadius: -2,
557+
),
558+
BoxShadow(
559+
color: Color(0x10101828),
560+
offset: Offset(0, 2),
561+
blurRadius: 4,
562+
spreadRadius: -2,
563+
),
545564
],
546565
),
547-
itemPadding: EdgeInsets.zero,
548-
dropdownPadding: const EdgeInsets.only(bottom: 6),
566+
),
567+
menuItemStyleData: const MenuItemStyleData(
568+
height: 40,
569+
padding: EdgeInsets.zero
570+
),
571+
572+
573+
549574
onMenuStateChange: (isOpen) {},
550575
),
551576
);

linux/flutter/generated_plugin_registrant.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,15 @@
66

77
#include "generated_plugin_registrant.h"
88

9+
#include <rive_common/rive_plugin.h>
910
#include <screen_retriever/screen_retriever_plugin.h>
1011
#include <url_launcher_linux/url_launcher_plugin.h>
1112
#include <window_manager/window_manager_plugin.h>
1213

1314
void fl_register_plugins(FlPluginRegistry* registry) {
15+
g_autoptr(FlPluginRegistrar) rive_common_registrar =
16+
fl_plugin_registry_get_registrar_for_plugin(registry, "RivePlugin");
17+
rive_plugin_register_with_registrar(rive_common_registrar);
1418
g_autoptr(FlPluginRegistrar) screen_retriever_registrar =
1519
fl_plugin_registry_get_registrar_for_plugin(registry, "ScreenRetrieverPlugin");
1620
screen_retriever_plugin_register_with_registrar(screen_retriever_registrar);

linux/flutter/generated_plugins.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#
44

55
list(APPEND FLUTTER_PLUGIN_LIST
6+
rive_common
67
screen_retriever
78
url_launcher_linux
89
window_manager

0 commit comments

Comments
 (0)