nylo-core / nylo

Nylo is the fastest way to build your next Flutter mobile app. Streamline your projects with Nylo's opinionated approach to building Flutter apps. Develop your next idea ⚡️
https://nylo.dev
MIT License
599 stars 61 forks source link

The argument type 'NyTextField Function(NyTextField)' can't be assigned to the parameter type 'String?' #166

Closed jeremyj11 closed 4 days ago

jeremyj11 commented 2 months ago

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!

agordn52 commented 2 months ago

Hey @jeremyj11,

Thanks for the feedback :)

With Nylo v6 around the corner, I've been busy with development but I'll take a look at this when I get chance.

sizoune commented 1 week ago

Hey @jeremyj11,

Thanks for the feedback :)

With Nylo v6 around the corner, I've been busy with development but I'll take a look at this when I get chance.

hi @agordn52 , any update about v6 release date ?

agordn52 commented 1 week ago

Hey @jeremyj11, Thanks for the feedback :) With Nylo v6 around the corner, I've been busy with development but I'll take a look at this when I get chance.

hi @agordn52 , any update about v6 release date ?

Live now 🎉🎉

agordn52 commented 4 days ago

Reopen this if you're still having issues