Created
December 11, 2019 11:50
-
-
Save knaeckeKami/91cb50eb66060260fb005ab440545fff to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:built_collection/built_collection.dart'; | |
import 'package:flutter/material.dart'; | |
import 'package:flutter_form_builder/flutter_form_builder.dart'; | |
// generic widget definition | |
typedef Widget FormWidgetBuilder<T>(T t, Color textColor); | |
class FormBuilderListSelect<T> extends StatefulWidget { | |
. | |
. | |
. | |
final FormWidgetBuilder<T> widgetBuilder; | |
. | |
. | |
. | |
} | |
// then, call it like this: | |
@override | |
Widget build(BuildContext context) { | |
return FormBuilderListSelect<YourGenericType>(widgetBuilder: (item, color) => Padding(...)); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment