Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Widget: Tag Input #1893

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
Open

New Widget: Tag Input #1893

wants to merge 14 commits into from

Conversation

mehsaandev
Copy link
Contributor

@mehsaandev mehsaandev commented Feb 27, 2025

Ticket: #1825

Example

    - TagInput:
        id: inputId
        multiline: true
        endingWidget:
          IconButton:
            onTap:
              showDialog:
                body:
                  Text:
                    text: ${inputId.value}
            icon:
              name: send
        styles:
          expanded: true
          mentionStyle:
            color: red 
        triggers:
          - character: '#'
            tagStyle:
              color: pink 
        itemTemplate:
          label: ${user.key}
          data:
            [
              { label: 'Ehsaan', key: 'ehsaan', id: '452365124-sdfsdf' },
              { label: 'Nouman Butt', key: 'thenoumandev', id: "432" },
              { label: 'Ridsa Shabbir', key: 'Ridsa', id: '345' },
              { label: 'Khurram Mahmood', key: 'Khurram', id: '654' },
              { label: 'Amin Nassiri', key: 'Amin', id: '6234' },
              { label: 'Sharjeel Yunus', key: 'Sharjeel', id: '873' },
              { label: 'Anser Waseem', key: 'Anser', id: '234' }
            ]
          name: user
          value: ${user.id}
          labelWidget:
            Text:
              text: ${user.label}

Demo:

Screen.Recording.2025-02-28.at.7.23.53.PM.mov

CC: @sharjeelyunus @ridsashabbir

@mehsaandev mehsaandev self-assigned this Feb 28, 2025
Copy link
Member

@sharjeelyunus sharjeelyunus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

most of the code is duplicated for TextInput. Can't we create a common util clean this up?

@@ -144,6 +145,7 @@ class WidgetRegistry {
RadioButton.type: () => RadioButton(),
EnsembleForm.type: () => EnsembleForm(),
TextInput.type: () => TextInput(),
TagInput.type: () => TagInput(),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please don't register new widgets in legacyWidgetMap, this should be registered in _registeredWidgets map

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure

Comment on lines 10 to 35
import 'package:ensemble/framework/action.dart';
import 'package:ensemble/framework/widget/widget.dart';
import 'package:ensemble/layout/form.dart';
import 'package:ensemble/model/item_template.dart';
import 'package:ensemble/screen_controller.dart';
import 'package:ensemble/util/debouncer.dart';
import 'package:ensemble/util/input_formatter.dart';
import 'package:ensemble/util/input_validator.dart';
import 'package:ensemble/util/utils.dart';
import 'package:ensemble/widget/helpers/HasTextPlaceholder.dart';
import 'package:ensemble/widget/helpers/form_helper.dart';
import 'package:ensemble/widget/helpers/input_wrapper.dart';
import 'package:ensemble/widget/helpers/widgets.dart';
import 'package:ensemble_ts_interpreter/invokables/invokablecontroller.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:ensemble/layout/templated.dart';
import 'package:ensemble_ts_interpreter/invokables/invokable.dart';
import 'package:email_validator/email_validator.dart';
import 'package:ensemble/framework/model.dart' as model;
import 'package:flutter/services.dart';
import 'package:flutter_html/flutter_html.dart';
import 'package:flutter_i18n/flutter_i18n.dart';
import 'package:form_validator/form_validator.dart';
import 'package:mask_text_input_formatter/mask_text_input_formatter.dart';
import 'package:fluttertagger/fluttertagger.dart';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why are there so many unused imports here? please only import the package/file which are required

@mehsaandev
Copy link
Contributor Author

most of the code is duplicated for TextInput. Can't we create a common util clean this up?

we can do this, I'll make the common util for text and tag input

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants