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

建议能不能给toastBuilder加扩展参数 #111

Closed
wojide0301 opened this issue Feb 23, 2023 · 3 comments
Closed

建议能不能给toastBuilder加扩展参数 #111

wojide0301 opened this issue Feb 23, 2023 · 3 comments
Assignees
Labels
enhancement New feature or request

Comments

@wojide0301
Copy link

版本信息

  • Flutter版本:[举例:v2.7.3]
  • flutter_smart_dialog版本:[举例:v4.8.2+5]

描述bug/需求

面对频繁出现的showSuccessToast 或showErrorToast场景,如请求成功或失败后展示的Toast。FlutterSmartDialog.init toastBuilder 建议加一些可自定义的参数,或者作者有什么其他好的建议。

@xdd666t xdd666t self-assigned this Feb 23, 2023
@xdd666t
Copy link
Member

xdd666t commented Feb 23, 2023

可能会单开个showNotify,针对性的优化一些特性,我周末想想看

xdd666t added a commit that referenced this issue Feb 26, 2023
@xdd666t xdd666t added the enhancement New feature or request label Feb 26, 2023
xdd666t added a commit that referenced this issue Mar 5, 2023
@xdd666t
Copy link
Member

xdd666t commented Mar 5, 2023

  • 这个实现了,更新下版本吧
dependencies:
  flutter_smart_dialog: ^4.9.0+3
  • 用法
SmartDialog.showNotify(msg: '操作成功.', notifyType: NotifyType.success);
  • 可自定义配置,不同类型的全局Notify弹窗样式(支持配置任意单个类型,不配置的时候采用内置样式)
void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: SmartDialogPage(),
      navigatorObservers: [FlutterSmartDialog.observer],
      builder: FlutterSmartDialog.init(
        notifyStyle: FlutterSmartNotifyStyle(
          successBuilder: (String msg) => CustomSuccessWidget(msg: msg),
          failureBuilder: (String msg) => CustomFailureWidget(msg: msg),
          warningBuilder: (String msg) => CustomWarningWidget(msg: msg),
          alertBuilder: (String msg) => CustomAlertWidget(msg: msg),
          errorBuilder: (String msg) => CustomErrorWidget(msg: msg),
        ),
      ),
    );
  }
}

@xdd666t xdd666t closed this as completed Mar 10, 2023
@wojide0301
Copy link
Author

666

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

No branches or pull requests

2 participants