Skip to content

SweetSheet improvement - 1/3 : Do not use Strings for Title and Description #2

@MsXam

Description

@MsXam

Hi there ...

Currently your Component has a method signature such that it expects Strings for Title and Description. This should be changed so that a Widget is supplied in-place of the Strings. You need this because your current component does not support accessibility meaning that the Text(...) widget that you internally use to render the Title & Description will take its TextScaleFactor for MediaQuery.

This can lead to overflow errors when the Bottom sheet is rendered.

Suggestion

Change the method :

show({
@required BuildContext context,
Text title,
@required Text description,
@required CustomSheetColor color,
@required SweetSheetAction positive,
SweetSheetAction negative,
IconData icon,
}) {

To

show({
@required BuildContext context,
Widget title,
@required Widget description,
@required CustomSheetColor color,
@required SweetSheetAction positive,
SweetSheetAction negative,
IconData icon,
}) {

This will allow callers of Show to handle their own Accessibility for both Title & Description and Since these will be changed to Widget, we can further use composition to wrap them , i.e


show(context:context,
           title:FixedSizedTitle(child:Text('My SweetTitle')),
description:FixedSizedTitle(child:Text('My Sweet description etc')),
....
)

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