Securrency-OSS / mirai

Mirai is a Server-Driven UI (SDUI) library for Flutter. Mirai allows you to build beautiful cross-platform applications with JSON in real time.
https://pub.dev/packages/mirai
MIT License
478 stars 58 forks source link

feat: Add support for Table Widget #272

Closed divyanshub024 closed 1 week ago

divyanshub024 commented 2 months ago

Description

Add support for the Table Widget

Requirements

Additional Context

https://api.flutter.dev/flutter/widgets/Table-class.html

superiorsd10 commented 2 months ago

Hello @divyanshub024 👋

I want to work on this issue, so please consider assigning it to me.

Thank you,

divyanshub024 commented 2 months ago

Hey @superiorsd10,

Once again thanks for your contributions. I've assigned the issue to you 🚀

superiorsd10 commented 2 months ago

Hello @divyanshub024 👋

So I was adding the support for the Table widget in Mirai. I'm encountering an issue so can you please help me?

So while writing the mirai_table parser, there are some properties like TableRow, TableColumnWidth, and Decoration. Among these, the last two are abstract classes, and Decoration is used by the class TableRow.

So I'll have to define the parse extension method on TableRow but what about the other two?

Will I need to define two more parsers for them without the parse extension method (because they are abstract classes)? If yes, what should be the arguments to them?

Thank you,

References:

TableRow TableColumnWidth Decoration

divyanshub024 commented 2 months ago

Hey @superiorsd10,

Decoration and TableColumnWidth are the abstract classes. We need to make parsers for the sub-classes.

For decoration, we already have the MiraiBoxDecoration parser which you can use.

Fpr TableColumnWidth, we need to make parser for it's subclasses like IntrinsicColumnWidth, FlexColumnWidth, FixedColumnWidth, FractionColumnWidth. We can create a parser where depending upon the type it will select the suitable TableColumnWidth class.

superiorsd10 commented 2 months ago

Should I do something like MiraiInputFormatter for TableColumnWidth?

I can define the enum like in InputFormatter each for the sub-classes to check the type and return the respective sub-class.

Or I will need to define a separate parser for each sub-class? If yes, then I will not need to define one for TableColumnWidth right as it's an abstract class?

divyanshub024 commented 2 months ago

@superiorsd10 I think the enum can also work but there are some TableColumnWidth like FractionColumnWidth that takes a value,

divyanshub024 commented 1 month ago

Hey @superiorsd10 👋🏻

Let me know if you are stuck anywhere or need any help :)

superiorsd10 commented 1 month ago

Hello @divyanshub024 👋

I'm sorry for the delay in the response as I was occupied in crafting a proposal for GSoC. So I have implemented individual parsers for the sub-classes of TableColumnWidth.

Now I'll need to identify the type and assign the suitable sub-class. But I was wondering if should I take the enum path now.

Like I can define a MiraiTableColumnWidth and ask for the type, and value. Though IntrinsicColumnWidth takes flex.

Then I can define an enum in utils, and define a method there that returns the appropriate sub-class based on the type.

Is this approach good?

Thank you,

divyanshub024 commented 1 month ago

Hey @superiorsd10 👋🏻

Good luck with the GSoC proposal, let me know if you need any help with that.

Yeah, the enum path sounds great! Let's try that :)

divyanshub024 commented 3 weeks ago

Hey @superiorsd10, How's your GSOC going?

I just wanted to check if you are still working on this issue.