diff --git a/lib/common/widgets/custom_toast.dart b/lib/common/widgets/custom_toast.dart index bee5c92b..73204b84 100644 --- a/lib/common/widgets/custom_toast.dart +++ b/lib/common/widgets/custom_toast.dart @@ -31,3 +31,37 @@ class CustomToast extends StatelessWidget { ); } } + +class LoadingWidget extends StatelessWidget { + const LoadingWidget({super.key, required this.msg}); + + ///loading msg + final String msg; + + @override + Widget build(BuildContext context) { + return Container( + padding: const EdgeInsets.symmetric(horizontal: 30, vertical: 20), + decoration: BoxDecoration( + color: Theme.of(context).dialogBackgroundColor, + borderRadius: BorderRadius.circular(15), + ), + child: Column(mainAxisSize: MainAxisSize.min, children: [ + //loading animation + CircularProgressIndicator( + strokeWidth: 3, + valueColor: AlwaysStoppedAnimation( + Theme.of(context).colorScheme.onSurfaceVariant), + ), + + //msg + Container( + margin: const EdgeInsets.only(top: 20), + child: Text(msg, + style: TextStyle( + color: Theme.of(context).colorScheme.onSurfaceVariant)), + ), + ]), + ); + } +} diff --git a/lib/main.dart b/lib/main.dart index f556e0b4..1b81af76 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -59,8 +59,6 @@ void main() async { Request(); await Request.setCookie(); RecommendFilter(); - SmartDialog.config.loading = - SmartConfigLoading(backType: SmartBackType.normal); // 异常捕获 logo记录 final String buildConfig = '''\n Build Time: ${BuildConfig.buildTime} @@ -209,6 +207,7 @@ class MyApp extends StatelessWidget { home: const MainApp(), builder: FlutterSmartDialog.init( toastBuilder: (String msg) => CustomToast(msg: msg), + loadingBuilder: (msg) => LoadingWidget(msg: msg), builder: (context, child) { return MediaQuery( data: MediaQuery.of(context)