Skip to content
This repository has been archived by the owner on Jan 25, 2024. It is now read-only.

suggestion : type of generate parameter. "BUILDER_TYPE.STATELESS_WIDGET" first #30

Closed
ChangJoo-Park opened this issue Sep 23, 2020 · 3 comments
Labels
Code-Generation enhancement New feature or request Feature Development Feature to be implemented HacktoberFest HacktoberFest Related Issue, lets get to hacking! High Priority High Priority issue that should be prioritized Proposal This issue is being proposed as feature development for the next iteration cycle State Management Export

Comments

@ChangJoo-Park
Copy link
Contributor

ChangJoo-Park commented Sep 23, 2020

I did not know history why choose STATEFUL_WIDGET over STATELESS_WIDGET.

nowadays flutter devs using Provider like state management system working on StatelessWidget. and on Sketch side, every page design is have no state. It stay still. If Sketch support state, Parabeac support StatefulWidget.

code of StatelessWidget is more simpler and faster.

@siliconivan
Copy link
Member

This is a really good point, eggs do have the ability modify state though. I'll get an example going tomorrow but I'd like to continue this discussion.🤔

@siliconivan siliconivan added Code-Generation enhancement New feature or request Feature Development Feature to be implemented High Priority High Priority issue that should be prioritized Proposal This issue is being proposed as feature development for the next iteration cycle labels Sep 24, 2020
@siliconivan
Copy link
Member

Cool, I am excited to revisit this now. So this is also part of a larger discussion on exporting to multiple state management frameworks. In the meantime, it'd be neat to discuss how to go about an implementation around Provider + BLoC.

The reason we put this as a stateful widget to begin with was just to prove out a simple state changing example. If you take a look at the egg template, We have an example using a switch. I'll highlight a couple lines from the generator which is what generates the flutter code.

/// Declares a parameter that is used to declare an instance variable and contructor parameter in the manager.
var value = PBParam('switchValue', 'bool', false);

/// Notifying the manager to add an instance variable to the file.
manager.addInstanceVariable(value);

buffer.write('''
   ListTileSwitch(  
      value: switchValue,  
      onChanged: (value) {  
        setState(() {  
        switchValue = value;  
        });
      },
      ...
    ),
''');

So the question is, is there a clean way for us to add a configuration to parabeac-core so that it exports using Provider+BLoC without modifying the way eggs are written. The answer is likely going to be no, we'll need to make some changes particularly with the way we write Flutter code because right now it's basically just a string.

  1. When applying value, we can grab more context if we send the PBParam. This should theoretically allow us to grab the value from the provider or from a regular instance variable depending on config.
  2. For the implementation on logic, we probably need to change this so that you can add the onChanged as something you can put logic in. When you set the logic, it should automatically wrap it in a setState() or in some function within the BLoC.

At the end of the day, the way we write code for an egg generator needs to be rethought, but it is certainly a worthy investment.

@x64Eddie, @ChangJoo-Park, @ivan-015, @SushiRoll53 your feedback will be appreciated.

@siliconivan siliconivan pinned this issue Sep 25, 2020
@Ihuds577 Ihuds577 added this to the HacktoberFest! milestone Oct 1, 2020
@Ihuds577 Ihuds577 added the HacktoberFest HacktoberFest Related Issue, lets get to hacking! label Oct 1, 2020
@x64Eddie x64Eddie unpinned this issue Oct 5, 2020
@siliconivan siliconivan pinned this issue Oct 19, 2020
@x64Eddie x64Eddie unpinned this issue Dec 10, 2020
@x64Eddie x64Eddie pinned this issue Dec 10, 2020
@siliconivan
Copy link
Member

Hi @ChangJoo-Park, have you gotten around to playing with the latest version of Parabeac-Core? I'm curious if you think we have address the issues you were having? If we have then we can close this issue out! :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Code-Generation enhancement New feature or request Feature Development Feature to be implemented HacktoberFest HacktoberFest Related Issue, lets get to hacking! High Priority High Priority issue that should be prioritized Proposal This issue is being proposed as feature development for the next iteration cycle State Management Export
Projects
No open projects
Development

No branches or pull requests

3 participants