SmartDialog.showNotify只显示文字,不显示success icon
Closed this issue · 7 comments
Version Information
- Flutter version: 3.22.3
- flutter_smart_dialog version: flutter_smart_dialog: ^4.9.8+3
Describe the bug/requirement
SmartDialog.showNotify(msg: '123', notifyType: NotifyType.success);
只显示文字,不显示success icon
Problem demo
@override
Widget build(BuildContext context) {
return ScreenUtilInit(
designSize: const Size(360, 690),
minTextAdapt: true,
splitScreenMode: false,
builder: (context, child) {
return MaterialApp(
localizationsDelegates: context.localizationDelegates,
supportedLocales: context.supportedLocales,
locale: context.locale,
title: 'Flutter Demo',
theme: ThemeData(
useMaterial3: true,
colorScheme: ColorScheme.fromSeed(seedColor: Colors.blue, brightness: Brightness.light),
brightness: Brightness.light,
appBarTheme: const AppBarTheme(
centerTitle: true,
elevation: 0,
backgroundColor: Colors.white,
),
),
builder: FlutterSmartDialog.init(
// notifyStyle: FlutterSmartNotifyStyle(successBuilder: (msg) => Text(msg, style: TextStyle(color: Colors.red),),),
builder: (context, child) {
return MediaQuery.withNoTextScaling(child: child ?? Container());
},
),
navigatorObservers: [FlutterSmartDialog.observer],
initialRoute: '/',
routes: {
'/': (BuildContext context) => const LoginPage(),
'/home': (BuildContext context) => const HomePage(),
},
// home: child,
);
},
child: const MyHomePage(title: 'Flutter Demo Home Page'),
);
}
SmartDialog.showNotify(msg: '123', notifyType: NotifyType.success);
@override
Widget build(BuildContext context) {
return ScreenUtilInit(
designSize: const Size(360, 690),
minTextAdapt: true,
splitScreenMode: false,
builder: (context, child) {
return MaterialApp(
localizationsDelegates: context.localizationDelegates,
supportedLocales: context.supportedLocales,
locale: context.locale,
title: 'Flutter Demo',
builder: FlutterSmartDialog.init(
notifyStyle: FlutterSmartNotifyStyle(
successBuilder: (String msg) => CustomNotifySuccess(msg: msg),
),
builder: (context, child) {
return MediaQuery.withNoTextScaling(child: child ?? Container());
},
),
navigatorObservers: [FlutterSmartDialog.observer],
initialRoute: '/',
routes: {
'/': (BuildContext context) => const LoginPage(),
'/home': (BuildContext context) => const HomePage(),
},
// home: child,
);
},
child: const MyHomePage(title: 'Flutter Demo Home Page'),
);
}
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
class CustomNotifySuccess extends StatelessWidget {
const CustomNotifySuccess({
super.key,
required this.msg,
});
final String msg;
@override
Widget build(BuildContext context) {
return Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8),
color: Colors.black,
),
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 10),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
const Icon(
Icons.check,
color: Colors.white,
size: 22,
),
const SizedBox(width: 10),
Text(
msg,
style: const TextStyle(color: Colors.white),
),
],
),
);
}
}
离谱了,在正常页面上添加一个icon也不显示
离谱了,在正常页面上添加一个icon也不显示
[✓] Flutter (Channel stable, 3.22.3, on macOS 13.1 22C65 darwin-arm64, locale
zh-Hans-CN)
• Flutter version 3.22.3 on channel stable at
/Users/zhonghezhitong/Documents/dev/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision b0850beeb2 (4 months ago), 2024-07-16 21:43:41 -0700
• Engine revision 235db911ba
• Dart version 3.4.4
• DevTools version 2.34.3
• Pub download mirror https://pub.flutter-io.cn
• Flutter download mirror https://storage.flutter-io.cn
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
• Android SDK at /Users/zhonghezhitong/Library/Android/sdk
• Platform android-34, build-tools 34.0.0
• ANDROID_HOME = /Users/zhonghezhitong/Library/Android/sdk
• Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 17.0.11+0-17.0.11b1207.24-11852314)
• All Android licenses accepted.
[!] Xcode - develop for iOS and macOS (Xcode 14.3.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 14E300c
! Flutter recommends a minimum Xcode version of 15.
Download the latest version or update via the Mac App Store.
• CocoaPods version 1.14.3
[✗] Chrome - develop for the web (Cannot find Chrome executable at /Applications/Google
Chrome.app/Contents/MacOS/Google Chrome)
! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.
[✓] Android Studio (version 2024.1)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 17.0.11+0-17.0.11b1207.24-11852314)
[✓] VS Code (version 1.95.1)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.98.0
[✓] Connected device (3 available)
• VP004 (mobile) • MDS9K21C07901131 • android-arm64 • Android 11 (API 30)
• macOS (desktop) • macos • darwin-arm64 • macOS 13.1 22C65 darwin-arm64
• Mac Designed for iPad (desktop) • mac-designed-for-ipad • darwin • macOS 13.1 22C65 darwin-arm64
[✓] Network resources
• All expected network resources are available.
! Doctor found issues in 2 categories.
应该是你项目问题吧, 自己新建demo项目看看
我这边部署的demo效果是没问题的: https://xdd666t.github.io/flutter_use/web/index.html#/smartDialog?dialogType=NotifyDialogSuccess
新建空白项目可以显示icon,原因未知;
flutter:
# The following line ensures that the Material Icons font is
# included with your application, so that you can use the icons in
# the material Icons class.
uses-material-design: true
之前设置成false了,设置为true才能正常使用icon;破案