nylo
nylo copied to clipboard
The argument type 'NyTextField Function(NyTextField)' can't be assigned to the parameter type 'String?'
Trying to use the style parameter of Field to perform an inline style override, I copied the below from the docs:
@override
fields() => [
Field("Name",
style: (NyTextField nyTextField) => nyTextField.copyWith(
decoration: InputDecoration(
labelText: "Name",
hintText: "Enter your name",
),
),
),
but get the error: The argument type 'NyTextField Function(NyTextField)' can't be assigned to the parameter type 'String?'.
I'm new to Flutter and Nylo, so maybe I'm missing something obvious? I can see that style needs to be a string in ny_form.dart though.. so perhaps your docs are for a future version?? I'm on nylo version 5.32.7
My full form file:
import 'package:flutter/material.dart';
import 'package:nylo_framework/nylo_framework.dart';
class ReminderForm extends NyFormData {
ReminderForm({String? name}) : super(name ?? "reminder");
@override
fields() => [
Field(
"Name",
style: (NyTextField nyTextField) => nyTextField.copyWith(
decoration: InputDecoration(
labelText: "Name",
hintText: "Enter your name",
),
),
),
Field(
"datetime",
cast: FormCast.datetime(
dateFormat: DateFormat.Hm(),
initialPickerDateTime: DateTime.now(),
mode: DateTimeFieldPickerMode.time,
),
dummyData: null,
style: "compact",
),
Field("notes", cast: FormCast.textArea(), style: "compact"),
];
}
Thanks in advance for any advice, and as a dev coming from Laravel - this framework is very cool!