Skip to content

Padding around the Choice widget #9

Closed

Description

@aro-wolo

Screenshot 2024-03-06 at 6 07 44 PM

Hello,

Nice job on the widget,

Please how can i adjust the padding on the widget (top, left, right and bottom), and also the font size of the choice widget value

Thank you

Activity

  1. aro-wolo commented on Mar 6, 2024

    @aro-wolo
    Author

    Screenshot 2024-03-06 at 6 12 45 PM

    I want to Style the Choice widget to at least look like this

  2. davigmacode commented on Mar 7, 2024

    @davigmacode
    Owner

    Hello, you can create a custom anchorBuilder that can be combined with predefined builder

    Screenshot 12-15 07 March 2024

    PromptedChoice<String>.multiple(
      title: 'Category',
      clearable: true,
      value: multipleSelected,
      onChanged: setMultipleSelected,
      itemCount: choices.length,
      itemBuilder: (state, i) {
        return CheckboxListTile(
          value: state.selected(choices[i]),
          onChanged: state.onSelected(choices[i]),
          title: ChoiceText(
            choices[i],
            highlight: state.search?.value,
          ),
        );
      },
      anchorBuilder: (state, openModal) {
        return ListTileTheme(
          data: const ListTileThemeData(
            contentPadding: EdgeInsets.symmetric(
              vertical: 0,
              horizontal: 10,
            ),
            visualDensity: VisualDensity(horizontal: 0, vertical: -4),
            titleTextStyle: TextStyle(
              color: Colors.blue,
            ),
            subtitleTextStyle: TextStyle(
              color: Colors.blue,
              fontWeight: FontWeight.bold,
            ),
          ),
          child: Container(
            width: 300,
            decoration: BoxDecoration(
              border: Border.all(
                color: Colors.lightBlue,
              ),
              borderRadius: BorderRadius.circular(5),
            ),
            child: ChoiceAnchor.create(
              valueTruncate: 2,
              trailing: const Icon(
                Icons.arrow_drop_down,
                color: Colors.grey,
              ),
            )(state, openModal),
          ),
        );
      },
    )
    
  3. Repository owner locked and limited conversation to collaborators on Mar 7, 2024
  4. converted this issue into a discussion #10 on Mar 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions