不能将 FlutterEasyLoading 用在main MaterialApp外层
报出 No MediaQuery widget found. 的错误在于 查找context并非MaterialApp的context 而是FlutterEasyLoading的context
修改为:
return MaterialApp( routes: GyRoutersManager.defaultList, theme: GyGlobalTheme.themeLightDefault(), onGenerateRoute: GyRoutersManager.onGenerateRoute, onUnknownRoute: GyRoutersManager.onUnknowRouter, builder: (context, child) { return FlutterEasyLoading(child: child); }, );
不用担心, 放在MaterialApp中 builder中 也能作用到以路由控制的页面跳转中